JBoss equivalent for Weblogic APP-INF/classes - jboss

In Weblogic, inside an EAR, you can put classes under APP-INF/classes folder. These classes are shared across all EAR modules (WAR's, EJB's, JAR's).
Does JBoss allow any similar path?
We do not want to package these classes under a JAR.

I found a workaround with the JAR "upacked" libraries. I put all my classes under a folder lib/myFakeJAR.jar/, where lib is the libraries folder of my EAR.

Related

Unable to access .ear/lib jars in ear's subdeployments

Some utility jars which are required by multiple EJBs are in the .ear\lib folder, and these jars should be available for all the EJBs but EJBs can not access classes of lib folder.
This structure was working fine in wildly 10.1.0 but after migrating to 20.0.1, it is not working.
Can someone help me, why lib files are not loaded?
Thanks

classes in jar are not accessible during war deployment in Wildfly

I am trying to migrate my application server from JBoss4 to Wildfly 9. The structure of my war is
myWar.war
- WEB-INF
-lib
-jar1
-jar2
When I deploy this war in Wildfly, classes inside these jars are not accessible (ClassNotFoundException).
After reading more about Wildfly, I learnt that classloading is changed in Wildfly and dependencies need to be explicitly mentioned in file jboss-deployment-structure.xml or in Manifest.mf
I am a little confused and have 2 questions -
Is it required to specify this dependency in
jboss-deployment-structure.xml or manifest.mf (as the jars within
the war's lib) ?
If yes, how to exactly specify this dependency of jars ? I tried some ways of mentioning dependencies by their jar names/package
names in jboss-deployment-structure.xml, etc but with no luck
(everytime I get missing dependencies or module not found exception,
etc)
Do I have to create a module under Wildfly's modules directory also ? But these jars are dynamically created and packaged in war file with my build scripts, so I cannot place jars under modules folder (like quartz or mysql jars) as these are not static.
Please help.
jars inside the war's lib folder don´t need to be declared in MANIFEST.MF or jboss-deployment-structure.xml.
Those files are used to declare dependencies to wildfly modules (for example jdbc driver, cxf dependencies, etc).
Are you sure your ClassNotFoundException comes from jars included in your war's lib folder? You don´t need to do anything special to load classes from the lib folder of your war.
Wildfly 9 do expect a particular-way structured web-archives. From the war structure every thing looks fine. Do re-check the war structure is in conformance with Widfly 9. Right structure should be like :
myWar.war
---WEB-INF
------- lib
---- Jar 1
---- Jar 2
-------- classes
---- Your classeses here
-------- web.xml

JBOSS7 external jar with dependency on ear file

I am using JBOSS 7
In my custom jar I am implementing an Interface. The interface is in a jar packaged with ECM.ear file. Unless I put my custom jar inside the web-inf/lib folder (of the war file located in ear file) I am getting ClassNotFoundException w.r.to the interface.
I created a module for my custom jar but I don't how to set up a dependency with ear file. I copied the jar containing the interface say mdm.jar and placed it in the module and also added an entry in the resource root of module.xml. After restarting I am getting ClassNotFoundException for the classes referred by mdm.jar, which arein ear file.
How to achieve this dependency?
Thanks,
Raghu
JBOSS 7 needs you to place the packaged jar files in the lib folders of your web-inf/lib or the ear/lib cos of the Class Loading Precedence that JBOSS server follows.
Alternatively you could load it as a module, but you need to specify any addition of this kind outside of JBOSS default supplied modules using your MANIFEST file or jboss-deployment-structure.xml
This link should provide you more insight on what would suit you best.
Hope it helps.

JBoss jar library files

In JBoss, if you have an ear archive file, the way to tell the environment the place
of the lib folder, where it can find the library files, is the application.xml file.
Now I splitted the ear file into separate .war and .jar files. I do not have an ear folder anymore, so I deploy the war and jars directly in JBoss.
In the war archive I have the html and servlet files. In the jar archive I have the bean files. Now the library files are just needed by the java beans, not by the servlets.
So I need a folder in the .jar file to put the lib files and a way to tell the system the place of this folder.
If you want to have your jar libraries inside an ejb-jar: you can't, the standard specification doesn't allow you to have a jar inside another jar. Maybe some vendors provide specific solutions for that, but those are not standard. The standard solution would be to place all the related jars inside an ear. What you can do, and it's standard, is placing library jars inside the WEB-INF/lib directory of a war; but ejb-jar don't provide a similar structure.

How to include external jar in ejb-jar

How can I include external jar file in my ejb3 jar file? There is one external jar project with all helper classes and manifest.mf file. Now I have this jar in my classpath in eclipse. But when eclipse build the ejb-jar I want it to include this external jar file so in Application server when my ejb loads and run it can use classes in external jar. Right now I am adding a reference in Manifest.mf for ejb-jar, still when eclipse build the ejb-jar it is not packaging this external jar and during runtime I am getting ClassNotFoundException.
Can somebody please give me an example how to achieve this? I am using Eclipse 3.6 and EJB3
You have to create ear or war deployment and include your ejb.jar and a third-party.jar into it. Then deploy it to jboss
I found a solution.
Method 2 Worked for me. the tutorial uses Rational, but I assume Eclipse will be similar.
http://www.ibm.com/developerworks/rational/library/07/1211_schrag/index.html
check it out.