在将glassfish 2.1迁移到4.0之后,没有找到EJB和类



我在将带有SOAP web服务和包含jar的EJB从Glassfish 2.1迁移到Glassfish 4.0时遇到了麻烦。与此同时,我把我的操作系统(XP->Windows 7)和netbeans版本7.3换成了7.4。Glassfish 4.0是一个有2个实例的集群。

我使用源代码创建了新的包。使用的jar被作为库包含(就像在gf2.0中一样)。EJB构建得很好,但是当我部署时,我得到了这些错误。

[2014-05-07T11:05:36.974+0200] [glassfish 4.0] [SEVERE] [] [global] [tid: _ThreadID=208 _ThreadName=admin-listener(13)] [timeMillis: 1399453536974] [levelValue: 1000] [[
Class [ nl/amnesty/sys/webform/entity/Form ] not found. Error while loading [ class nl.amnesty.webservice.form.FormExternal ]]]
[2014-05-07T11:05:36.975+0200] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=208 _ThreadName=admin-listener(13)] [timeMillis: 1399453536975] [levelValue: 1000] [[
  Exception while deploying the app [CRMWebserviceForm]]]
[2014-05-07T11:05:36.976+0200] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=208 _ThreadName=admin-listener(13)] [timeMillis: 1399453536976] [levelValue: 1000] [[
  Exception during lifecycle processing
java.lang.IllegalArgumentException: Invalid ejb jar CRMWebserviceForm: it contains zero ejb. A valid ejb jar requires at least one session/entity/message driven bean.
    at org.glassfish.ejb.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:147)
    at org.glassfish.ejb.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:112)
    at com.sun.enterprise.deployment.BundleDescriptor.visit(BundleDescriptor.java:621)
    at org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl.visit(EjbBundleDescriptorImpl.java:757)
    at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:116)
    at com.sun.enterprise.deployment.BundleDescriptor.visit(BundleDescriptor.java:621)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:190)
    at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:198)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:222)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:878)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:818)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:374)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:356)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:231)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:231)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:724)
]]
[2014-05-07T11:05:36.979+0200] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=208 _ThreadName=admin-listener(13)] [timeMillis: 1399453536979] [levelValue: 1000] [[
 Exception while deploying the app [CRMWebserviceForm] : Invalid ejb jar CRMWebserviceForm: it contains zero ejb. A valid ejb jar requires at least one session/entity/message driven bean.]]

EJB的一部分:

import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
@Stateless
public class FormExternal {

    @WebMethod(operationName = "submitform")
    public long submitform(@WebParam(name = "form") Form form) {
    CRMWebformController.processForm(form);
    return form.getSubmissionid();
    }
}

这里有一些关于如何包含jar库的信息。

- CRMWebserviceForm
  + Source packages
  + Test packages
    - Libraries
      - NLAmestyCRM - dist/NLAmnestyCRM.jar
      - ...
      - NLAmnestyWEBFORM - dist/NLAmnestyWEBFORM.jar
      + JDK 1.7 (default)
      + Cluster (glassfish)

在EJB属性(库)中,它们被选择为在运行时需要的。我后来"错误地"添加了库文件夹。它是。libnblibraries。属性和没有任何区别。更准确地说,我通过点击"浏览"在EJB属性"库文件夹"中添加了该值,但没有向该文件夹添加任何内容。

选择打包选项"Package required JARS in EJB jar"。

Run: Java EE version is Java EE5。它与平台JDK 1.7兼容吗?

任何帮助都是感激的。

[Edit: some code added][编辑:添加图书馆信息]

这些问题是相关的。因为找不到类nl.amnesty.sys.webform.entity.Form,所以无法加载使用该类的EJB,因此您得到消息:

java.lang.IllegalArgumentException: Invalid ejb jar CRMWebserviceForm: it contains
 zero ejb. A valid ejb jar requires at least one session/entity/message driven bean.

你必须确保类被打包在你的web应用程序中,或者在你的GlassFish安装的lib文件夹中可用,以便它可以被服务器加载。

我不知道你是如何包装你的应用程序,但如果你不能让它工作,也许一些信息是有帮助的。

相关内容

  • 没有找到相关文章

最新更新