File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Dependencies : Jboss 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Dependencies : Jboss 7" Watch "Dependencies : Jboss 7" New topic
Author

Dependencies : Jboss 7

Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
I am trying to deploy a war file on jboss 7..but i am getting an error saying Class not found.
I tried goggling it and found that the dependecies in the WAR files have to be explicitly mentioned in the Manifest.mf.
I tried doing that....But still getting the same error....I am not sure as to what is to be specified in the ClassPath and Dependencies.(Since the same war file worked properly when i used it with jboss 4.2)
My war File is basically dependent on one Ejb-Jar file.

What changes do i make in the War file so that It is correctly deployed.
Class-Path :
Dependencies :

I am a newbie to jboss 7.

Any help would be really appreciated.

Thanking you,
Vectors.
Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
I have included the Ejb-jar file in the buildpath.

However if i specify :

Class path : First-Ejb3Tutorial.jar
Dependecies : First-Ejb3Tutorial.jar

I am getting the following error log :


Caused by: org.jboss.modules.ModuleNotFoundException: Module FirstEjb3Tutorial.jar:main is not found
at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:121)
at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:245)
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:194)
at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:97)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:176)
at org.jboss.modules.Module.linkImports(Module.java:1041)
at org.jboss.modules.Module.relink(Module.java:1153)
at org.jboss.modules.ModuleLoader.relink(ModuleLoader.java:400)
at org.jboss.as.server.moduleservice.ServiceModuleLoader.relinkModule(ServiceModuleLoader.java:204) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:64) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
... 5 more

main is not found ???
I didnt get that. My jar file however does not have a main function.

Any help appreciated.

Thank you,

Vectors
Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
Any one???....I am still stuck at the same point.....how do you resolve dependencies.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Don't add the (module) dependencies for now. Post the ClassNotFoundException exception stacktrace that you see. Also tell us more about how your war is packaged, specifically where exactly in the .war does that class reside?

[My Blog] [JavaRanch Journal]
Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
Thanks Jaikiran for replying,

This is my stack trace :


07:44:40,501 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "Aurora_android1.war" was rolled back with failure message {"Failed services" => {"jboss.deployment.unit.\"Aurora_android1.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Aurora_android1.war\".STRUCTURE: Failed to process phase STRUCTURE of deployment \"Aurora_android1.war\""}}
07:44:40,502 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) Stopped deployment Aurora_android1.war in 0ms
07:44:40,504 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Failed services" => {"jboss.deployment.unit.\"Aurora_android1.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Aurora_android1.war\".STRUCTURE: Failed to process phase STRUCTURE of deployment \"Aurora_android1.war\""}}}}
07:46:05,618 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "Aurora_android1.war"
07:46:05,786 INFO [org.jboss.as.jpa] (MSC service thread 1-3) added javax.persistence.api dependency to Aurora_android1.war
07:46:06,000 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."Aurora_android1.war".INSTALL: org.jboss.msc.service.StartException in service
jboss.deployment.unit."Aurora_android1.war".INSTALL: Failed to process phase INSTALL of deployment "Aurora_android1.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [:1.6.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [:1.6.0]
at java.lang.Thread.run(Thread.java:619) [:1.6.0]

Caused by: java.lang.RuntimeException: Error getting reflective information for class com.aurora_android1.TestServlet
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
at org.jboss.as.ee.component.EEModuleClassDescription$DefaultConfigurator.configure(EEModuleClassDescription.java:176)
at org.jboss.as.ee.component.deployers.EEClassConfigurationProcessor$1.compute(EEClassConfigurationProcessor.java:147)
at org.jboss.as.ee.component.deployers.EEClassConfigurationProcessor$1.compute(EEClassConfigurationProcessor.java:122)
at org.jboss.as.ee.component.LazyValue.get(LazyValue.java:40)
at org.jboss.as.ee.component.EEApplicationDescription.getClassConfiguration(EEApplicationDescription.java:183)
at org.jboss.as.ee.component.ComponentDescription.createConfiguration(ComponentDescription.java:153)
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:70)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
Caused by: java.lang.NoClassDefFoundError: Lde/laliluna/library/BookTestBeanLocal; (This is the class file whose function i am trying to call...from aurora_android1.TestServlet)
at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0]
at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [:1.6.0]
at java.lang.Class.getDeclaredFields(Class.java:1743) [:1.6.0]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57)
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66)
... 13 more

07:46:06,210 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "Aurora_android1.war" was rolled back with failure message {"Failed services" => {"jboss.deployment.unit.\"Aurora_android1.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Aurora_android1.war\".INSTALL: Failed to process phase INSTALL of deployment \"Aurora_android1.war\""},"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.Aurora_android1.Aurora_android1.ValidatorFactory missing [ jboss.naming.context.java.module.Aurora_android1.Aurora_android1 ]","jboss.naming.context.java.module.Aurora_android1.Aurora_android1.Validator missing [ jboss.naming.context.java.module.Aurora_android1.Aurora_android1 ]"]}
07:46:06,235 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Stopped deployment Aurora_android1.war in 25ms
07:46:06,238 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Failed services" => {"jboss.deployment.unit.\"Aurora_android1.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Aurora_android1.war\".INSTALL: Failed to process phase INSTALL of deployment \"Aurora_android1.war\""},"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.Aurora_android1.Aurora_android1.ValidatorFactory missing [ jboss.naming.context.java.module.Aurora_android1.Aurora_android1 ]","jboss.naming.context.java.module.Aurora_android1.Aurora_android1.Validator missing [ jboss.naming.context.java.module.Aurora_android1.Aurora_android1 ]"]}}}


The war file basically contains a servlet which contains a post method - that calls a function(Test) that is defined in the the class of the ejb-jar file.
This thing basically i am trying to check the user name password thats it.

I have successfully deployed the ejb-jar file in standalone/deployment/
and i am trying to deploy the war file at the same place.

I have also included the jar file in the buildpath of the war file.

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

de/laliluna/library/BookTestBeanLocal


Where's that class located in the .war file?
Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
Thanks Jaikiran,

I have that class in the jar file and i import that as " import de.laliluna.library.* ".
And since i have included the jar file in the build path of the project....It was able to use the "test" function from BookTestBeabLocal in the earlier version , that is jboss 4.2...but now it says no class not found.
I feel it should be able to access that class since i have included the jar file (which contains "de/laliuna/library/BookTestBeanLocal").

Thanking you,
Vectors.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Vinit Parakh wrote:
I have that class in the jar file and i import that as " import de.laliluna.library.* ".
And since i have included the jar file in the build path of the project....


Let's keep out the build environment for now. Where exactly is that jar file within the deployed .war file?
Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
In libraries of the war file.
This is the tree structure :

Project/JavaResources/Library/FirstEjb3Tutorial.jar
Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
Hey Jaikiran ,
Thanks for your reply.


Vectors.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Vinit Parakh wrote:In libraries of the war file.
This is the tree structure :

Project/JavaResources/Library/FirstEjb3Tutorial.jar


No, I actually meant the final .war that gets deployed. Where in that .war is the jar located. Post the output of:

Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
Thanks Jaikiran,

This is what you asked for :

C:\Users\vinit\Desktop\jboss-as-web-7.0.2.Final\jboss-as-web-7.0.2.Final\standal
one\deployments>jar -tf Aurora_android1.war
META-INF/MANIFEST.MF
Index.jsp
META-INF/
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/com/
WEB-INF/classes/com/aurora_android1/
WEB-INF/classes/com/aurora_android1/TestServlet.class
WEB-INF/lib/
WEB-INF/web.xml

But I dont think the jar file is there in this. But i did it the same way by putting it in the libraries and it worked for me but i dont know...about jboss 7.
Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
Hey Jaikiran,

I am still stuck.....What do i do next....??

Thanking you,
Vectors.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

So that jar isn't packaged in the .war at all. Where is it placed on the running server then? Deployed separately? Why not package that jar within the .war/lib of the application. If you still want to deploy them separately, then you can do that. But you'll then have to add the dependency via the jboss-deployment-structure.xml (or MANIFEST.MF) to point to the module of the other deployment (ex: deployment.myjar.jar). See this for the full details https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7
Vinit Parakh
Greenhorn

Joined: Oct 20, 2011
Posts: 21
Hey Jaikiran,

It worked i was successfully able to deploy the war file and my project is running. I did it by deploying the jar in the web-inf/lib folder. But this is a tedious task, I mean if i make even little changes to the jar file i again have to go there and deploy the jar file. The other method(specifying dependencies in manifest.mf) seems to overcome this problem. I tried doing it through that method my specifying the dependencies in the manifest.mf but i dont know what exactly is to be specified in the class path. I am getting an error if i set the classpath to the jboss deployment folder.

This is the error log :

Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to get manifest for deployment "/C:/Users/vinit/Desktop/jboss-as-web-7.0.2.Final/jboss-as-web-7.0.2.Final/bin/content/Aurora_android2.war"
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:73) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
... 5 more
Caused by: java.io.IOException: invalid header field name: Dependencies
at java.util.jar.Attributes.read(Attributes.java:416) [:1.6.0]
at java.util.jar.Manifest.read(Manifest.java:182) [:1.6.0]
at java.util.jar.Manifest.<init>(Manifest.java:52) [:1.6.0]
at org.jboss.vfs.VFSUtils.readManifest(VFSUtils.java:215)
at org.jboss.vfs.VFSUtils.getManifest(VFSUtils.java:198)
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:69) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
... 6 more

18:15:50,055 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) Service status report
Services which failed to start:
service jboss.deployment.unit."Aurora_android2.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."Aurora_android2.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "Aurora_android2.war"



anil kumar khichar
Greenhorn

Joined: Dec 23, 2010
Posts: 8
Hi vinit, could you please share me your META-INF/MANIFEST.MF file.

i would expect your file like :



And you don't need to add your ejb jar into the lib of web project. Your file structure should resemble as :

C:\Users\vinit\Desktop\jboss-as-web-7.0.2.Final\jboss-as-web-7.0.2.Final\standalone\deployments\Aurora_android1.war
C:\Users\vinit\Desktop\jboss-as-web-7.0.2.Final\jboss-as-web-7.0.2.Final\standalone\deployments\FirstEjb3Tutorial.jar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dependencies : Jboss 7
 
Similar Threads
classpath to a war
Jboss Configuration Property
Deploying EAR files on JBOSS
Error during Migrating from Jboss4.0.5.GA to Jboss5.0.0.GA
Helloworld using Jboss7 and ejb3