eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
386 stars 144 forks source link

NoClassDefFoundError: Cannot deploy EAR with beans.xml and session bean contained in WAR #11536

Closed glassfishrobot closed 13 years ago

glassfishrobot commented 14 years ago

The attached enterprise application (NetBeans project) fails to deploy in glassfish.

The war module works standalone but not within the ear.

Here is the log:

INFO:

{felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\Programme\sges-v3\glassfish\domains\domain1\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\DOKUME~1\MAM020~1.000\LOKALE~1\Temp\fileinstall-1216822139805894261, felix.fileinstall.filter = null}

INFO: Portable JNDI names for EJB TestBean1 : [java:global/EnterpriseApplication1/EnterpriseApplication1-ejb/TestBean1, java:global/EnterpriseApplication1/EnterpriseApplication1-ejb/TestBean1!module.ejb.TestBean1] INFO: Portable JNDI names for EJB TestBean2 : [java:global/EnterpriseApplication1/EnterpriseApplication1-war/TestBean2!module.war.TestBean2, java:global/EnterpriseApplication1/EnterpriseApplication1-war/TestBean2] INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. INFO: nullID: /C:/Dokumente und Einstellungen/mam02072/Eigene Dateien/NetBeansProjects/security-scratch/EnterpriseApplication1/dist/gfdeploy/EnterpriseApplication1/EnterpriseApplication1-war_war/ CLASSES: [class module.war.TestBean2, class org.netbeans.rest.application.config.ApplicationConfig]

SCHWERWIEGEND: Exception while loading the app org.glassfish.deployment.common.DeploymentException: by java.lang.NoClassDefFoundError: module/war/TestBean2 at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:169) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125) at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:224) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: module/war/TestBean2 at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:344) at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:314) at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:273) at org.jboss.weld.util.Proxies.createProxyClass(Proxies.java:153) at org.jboss.weld.util.Proxies.createProxyClass(Proxies.java:141) at org.jboss.weld.bean.SessionBean.initProxyClass(SessionBean.java:210) at org.jboss.weld.bean.SessionBean.initialize(SessionBean.java:121) at org.jboss.weld.bootstrap.AbstractBeanDeployer.deploy(AbstractBeanDeployer.java:111) at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:151) at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:367) at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:167) ... 30 more Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: module/war/TestBean2 at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169) at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:339) ... 40 more Caused by: java.lang.NoClassDefFoundError: module/war/TestBean2 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181) at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163) ... 41 more Caused by: java.lang.ClassNotFoundException: module.war.TestBean2 at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:713) at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:626) at java.lang.ClassLoader.loadClass(ClassLoader.java:303) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316) ... 48 more

Environment

Operating System: Windows XP Platform: All

Affected Versions

[V3]

glassfishrobot commented 6 years ago
glassfishrobot commented 14 years ago

@glassfishrobot Commented keil@java.net said: Created an attachment (id=4211) NetBeans project, deployment fails in glassfish

glassfishrobot commented 14 years ago

@glassfishrobot Commented @honghzzhang said: assign to cdi category for initial evaluation

glassfishrobot commented 14 years ago

@glassfishrobot Commented rogerk said: Any chance you can provide a packaged ear/war so I can immediatley deploy it?

glassfishrobot commented 14 years ago

@glassfishrobot Commented keil@java.net said: Created an attachment (id=4212) packaged ear

glassfishrobot commented 14 years ago

@glassfishrobot Commented keil@java.net said: Created an attachment (id=4213) working standalone war

glassfishrobot commented 14 years ago

@glassfishrobot Commented rogerk said: Starting..

glassfishrobot commented 14 years ago

@glassfishrobot Commented rogerk said: Can you provide the Java source in addition to the class files (ok if they are contained in ear/jar/war.

glassfishrobot commented 14 years ago

@glassfishrobot Commented keil@java.net said: Java source is already attached. Have a look at EnterpriseApplication1.zip (first attachment)

glassfishrobot commented 14 years ago

@glassfishrobot Commented rogerk said: More information -

The exception does indeed occur when module.war.TestBean2 is an ejb within the war. The deployment is fine, however, when module.war.TestBean2 is NOT an ejb within the war.

glassfishrobot commented 14 years ago

@glassfishrobot Commented keil@java.net said: I'm not sure if your last comment describes the problem correctly.

module.war.TestBean2 is an EJB contained in the war. The war has no dependencies to any other ejb module.

Deployment of the war works for the standalone war. But if this war is part of an ear deployment fails.

In other words: cdi in glassfish does not work for enterprise application archives (ear).

glassfishrobot commented 14 years ago

@glassfishrobot Commented rogerk said: Assigning to Sahoo.

glassfishrobot commented 14 years ago

@glassfishrobot Commented keil@java.net said: I've tested the attached EnterpriseApplication1.ear with glassfish-3.0.1-b17 and the problem still exists.

Is there a chance that this Bug will be fixed in release 3.0.1?

glassfishrobot commented 14 years ago

@glassfishrobot Commented ss141213 said: I can still see the issue with recent trunk builds. This bug does not belong to classloader module. It appears to me that incorrect classloader is used to bootstrap Weld which is more likely to be caused by incorrect classloader being set as the thread's context classloader by deployment backend. Assigning it to deployment team to investigate further.

glassfishrobot commented 14 years ago

@glassfishrobot Commented @honghzzhang said: The thread context classloader of the APPLICATION_LOADED event (which sent from ApplicationInfo) is set to be the top level application classloader. In case of a standalone module, it's the same as the module classloader which knows how to load classes in the module, but in case of ear, the top level application classloader is different than the web module classloader which does not know how to load classes in the module.

Seems like the CDI code needs to listen to Deployment.MODULE_LOADED event instead (sent from ModuleInfo class) so it gets the module classloader instead.

I have modified the ModueInfo class so that when we send the module load event, the thread context has the proper classloader (module classloader).

glassfishrobot commented 13 years ago

@glassfishrobot Commented @sivakumart said: This issue is the same as 14842. A fix for that is being worked on and a fix would be checked in a few days.

glassfishrobot commented 13 years ago

@glassfishrobot Commented @sivakumart said: Marking this as a duplicate. I was able to ensure that the attached EAR in this application also works with the fix for 14842

glassfishrobot commented 13 years ago

@glassfishrobot Commented alniks said: The problem remains in glassfish 3.1.1. I have reproduced it in a simple CDI maven EAR application attached, with the following exception:

Caused by: java.lang.ClassNotFoundException: com.alniks.test.cdi.web.LoggingInterceptor at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:787) at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:696) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at org.jboss.weld.resources.DefaultResourceLoader.classForName(DefaultResourceLoader.java:52) at org.jboss.weld.manager.Enabled$ClassLoader.apply(Enabled.java:71) ... 41 more

PS: The attached application has been deployed through Netbeans on Windows 7 x64. The application deploys and runs fine on JBoss 7.

glassfishrobot commented 14 years ago

@glassfishrobot Commented File: EnterpriseApplication1-war.war Attached By: keil@java.net

glassfishrobot commented 14 years ago

@glassfishrobot Commented File: EnterpriseApplication1.ear Attached By: keil@java.net

glassfishrobot commented 14 years ago

@glassfishrobot Commented File: EnterpriseApplication1.zip Attached By: keil@java.net

glassfishrobot commented 13 years ago

@glassfishrobot Commented File: mavencdiproject.zip Attached By: alniks

glassfishrobot commented 14 years ago

@glassfishrobot Commented Issue-Links: duplicates GLASSFISH-14842

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-11536

glassfishrobot commented 14 years ago

@glassfishrobot Commented Reported by keil@java.net

glassfishrobot commented 13 years ago

@glassfishrobot Commented Marked as duplicate on Wednesday, December 1st 2010, 12:24:02 am