2012-08-27 103 views
1

我已經將2個項目添加爲我的ejb項目的類庫。這些cliass庫項目只有SE Java類用於域和其他一些值對象。我使用GlassFish 3,IDE是Netbeans 7.0.1。所有類庫項目,ejb項目和web項目(存在JSP和servlet)的任務'Clean & Builds'都是成功的,並且這個清潔& Build由IDE完成。但ejb項目無法部署,因爲它提供了例外(java.lang.RuntimeException: java.lang.NoClassDefFoundError:),表示找不到類庫。在GlassFish中EJB應用程序部署失敗

我刪除並多次添加這些庫。但總是相同的錯誤。當我不使用這些類庫並且不使用它們時,那​​麼可以部署ejb應用程序。正如我的想法,問題是,如果任何其他項目已導入並添加到ejb應用程序中,IDE無法部署ejb應用程序(我不確切,但我猜)。

我是新來的ejb。請讓我知道如何與其他項目一起部署這個ejb應用程序。在此先感謝
這裏是錯誤。

SEVERE: DPL8008: method/class loading failure : (EjbDescriptor.getBusinessMethodDescriptors()) 
method/class name - {1} 
SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer load method 
java.lang.RuntimeException: EJB Container initialization error 
    at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:242) 
    at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:290) 
    at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:101) 
    at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186) 
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:257) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) 
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232) 
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459) 
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209) 
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168) 
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238) 
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828) 
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725) 
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019) 
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 
    at java.lang.Thread.run(Thread.java:619) 
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/app/model/User 
    at org.glassfish.ejb.security.factory.EJBSecurityManagerFactory.createManager(EJBSecurityManagerFactory.java:219) 
    at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:229) 
    ... 32 more 
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/app/model/User 
    at com.sun.enterprise.deployment.EjbDescriptor.getLocalRemoteBusinessMethodDescriptors(EjbDescriptor.java:2302) 
    at com.sun.enterprise.deployment.EjbDescriptor.getBusinessMethodDescriptors(EjbDescriptor.java:2312) 
    at com.sun.enterprise.deployment.EjbDescriptor.getMethodDescriptors(EjbDescriptor.java:2217) 
    at org.glassfish.ejb.security.application.EJBSecurityManager.convertEJBMethodPermissions(EJBSecurityManager.java:546) 
    at org.glassfish.ejb.security.application.EJBSecurityManager.loadPolicyConfiguration(EJBSecurityManager.java:256) 
    at org.glassfish.ejb.security.application.EJBSecurityManager.initialize(EJBSecurityManager.java:317) 
    at org.glassfish.ejb.security.application.EJBSecurityManager.<init>(EJBSecurityManager.java:190) 
    at org.glassfish.ejb.security.factory.EJBSecurityManagerFactory.createManager(EJBSecurityManagerFactory.java:209) 
    ... 33 more 
Caused by: java.lang.NoClassDefFoundError: com/app/model/User 
    at java.lang.Class.getDeclaredMethods0(Native Method) 
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) 
    at java.lang.Class.privateGetPublicMethods(Class.java:2547) 
    at java.lang.Class.getMethods(Class.java:1410) 
    at com.sun.enterprise.deployment.EjbDescriptor.addAllInterfaceMethodsIn(EjbDescriptor.java:2327) 
    at com.sun.enterprise.deployment.EjbDescriptor.getLocalRemoteBusinessMethodDescriptors(EjbDescriptor.java:2280) 
    ... 40 more 

回答

0

您需要(例如,在WEB-INF/lib)你的戰爭中部署的外部lib或以某種方式將其放置在容器類路徑中(不推薦)。如何做到這一點取決於你的容器和你的buildtool/ide。

+0

謝謝。有幾個擔心。將模塊放入'WEB-INF'內的文件夾對我來說可能是個問題,因爲每次對特定項目進行任何更改時都必須包含這些模塊。另一件事是;如果應用程序部署在商業託管服務器中(他們不會讓我們將自己的庫放入他們的類路徑中),否則我不會將jar放入類路徑中。 –

相關問題