[jboss-dev-forums] [JBoss AS7 Development] - SAR cannot specify multiple module dependecies

Matt Drees do-not-reply at jboss.com
Tue May 24 13:26:27 EDT 2011


Matt Drees [http://community.jboss.org/people/matt.drees] created the discussion

"SAR cannot specify multiple module dependecies"

To view the discussion, visit: http://community.jboss.org/message/606782#606782

--------------------------------------------------------------
I have a SAR I am trying to deploy.  I want it to depend on both the "org.apache.log4j" module and the "org.jboss.common-core" module (I'd like it to log a message on startup, and also bind itself into JNDI with NonSerializableObjectFactory.

As indicated on  https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7 https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7, the right way to do this is with a Manifest entry in my SAR that looks like:


Dependencies: org.apache.log4j org.jboss.common-core


However, when I do this, I get a CNFE for org.jboss.util.naming.NonSerializableFactory:


10:40:41,727 WARN  [org.ccci.ha.HighAvailabilityDataSource] (MSC service thread 1-2) Starting up HighAvailabilityDataSource ccpDatasource in PRIMARY mode
10:40:41,728 INFO  [stdout] (MSC service thread 1-2) fullName=jdbc/ccpDatasource
10:40:41,729 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.mbean.service."jboss.jca:name=jdbc/ccpDatasource,service=DataSourceBinding".start: org.jboss.msc.service.StartException in service jboss.mbean.service."jboss.jca:name=jdbc/ccpDatasource,service=DataSourceBinding".start: Failed to execute legacy service start() method
    at org.jboss.as.service.StartStopService.start(StartStopService.java:51)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1675)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_24]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
    at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_24]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
    at org.jboss.as.service.AbstractService.invokeLifecycleMethod(AbstractService.java:59)
    at org.jboss.as.service.StartStopService.start(StartStopService.java:49)
    ... 4 more
Caused by: java.lang.NoClassDefFoundError: org/jboss/util/naming/NonSerializableFactory
    at org.ccci.ha.HighAvailabilityDataSource.rebind(HighAvailabilityDataSource.java:53)
    at org.ccci.ha.HighAvailabilityDataSource.start(HighAvailabilityDataSource.java:34)
    ... 10 more
Caused by: java.lang.ClassNotFoundException: org.jboss.util.naming.NonSerializableFactory from [Module "deployment.jboss-addons-3.0-SNAPSHOT.sar:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:188) [:1.0.0.CR2]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:357) [:1.0.0.CR2]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:329) [:1.0.0.CR2]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:306) [:1.0.0.CR2]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:100) [:1.0.0.CR2]
    ... 12 more


Note, however, that the logging is working correctly, so Log4j is being resolved.

So, on a whim, I switched up my Dependencies entry in the Manifest:

Dependencies: org.jboss.common-core org.apache.log4j


This, however, gives me a CNFE for org.apache.log4j.Logger:


10:39:43,720 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "jboss-addons-3.0-SNAPSHOT.sar"
10:39:43,744 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."jboss-addons-3.0-SNAPSHOT.sar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."jboss-addons-3.0-SNAPSHOT.sar".INSTALL: Failed to process phase INSTALL of deployment "jboss-addons-3.0-SNAPSHOT.sar"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1675)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_24]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
    at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger;
    at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0_24]
    at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [:1.6.0_24]
    at java.lang.Class.getDeclaredFields(Class.java:1743) [:1.6.0_24]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57)
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:65)
    at org.jboss.as.service.ParsedServiceDeploymentProcessor.addServices(ParsedServiceDeploymentProcessor.java:112)
    at org.jboss.as.service.ParsedServiceDeploymentProcessor.deploy(ParsedServiceDeploymentProcessor.java:102)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
    ... 4 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger from [Module "deployment.jboss-addons-3.0-SNAPSHOT.sar:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:188) [:1.0.0.CR2]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:357) [:1.0.0.CR2]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:329) [:1.0.0.CR2]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:306) [:1.0.0.CR2]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:100) [:1.0.0.CR2]
    ... 12 more


I later commented out the logging, and verified that NonSerializableFactory is in fact being loaded.  (It fails for another reason, but I'll get to that in another post.)

So, it appears that only the first entry in the Dependencies: manifest entry gets resolved by Jboss Modules.  This looks like a bug, right?  I don't think I'm just screwing up the manifest syntax or something.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/606782#606782]

Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110524/090f1fa6/attachment.html 


More information about the jboss-dev-forums mailing list