war uses jar file from peer war lib directory in ear - java

Say there is a ear1, inside ear1 there are war1 and war2. Structure likes below
ear1
lib
war1
war2
We use glassfish as the server and maven as the build tool. After deploy the ear1 onto glassfish, war1 got broken which because of a jar inside WEB-INF/lib of war2.
I have to pointed out this jar file is not in the lib directory of ear level or in the war1.
After remove that jar in war2 in the glassfish server application directory and restart glassfish, war1 will be ok. But the thing is war2 need that jar in order to work.
I have no idea why war1 will pick up that jar in war2 runtime and how to solve it.

I do not know if this would be possible for you. But what if you create a project as a pom.xml (aggregator) and inside it, some different submodules (lib, war1, war2). And instead of deploying the whole ear in the server, deploy separately in the server the war1 and the war2.

Related

jboss-deployment-structure.xml equivalent in jetty Server

Is there any structure.xml file in jetty where I need to mention that some pre-defined jars to be taken from the lib folder while deploying the war file.

Deployment in JBoss without WAR/EAR

Can I deploy an application without WAR/EAR in JBoss 6.4.0 eap ?
I need to migrate an application from Weblogic to JBoss. Is it possible to do so without creating the WAR ?
Deploy your app as an exploded set of files within directories, rather than packaged up within war and ear files. For example, assume you have xxx.ear which contains aaa.war. Under the deploy directory, create a directory named xxx.ear. In that directory create two more directories aaa.war. Into those directories place the contents of the two war files. Also, in the xxx.ear directory place the rest of the contents that would have been in the ear file, such as the META-INF/application.xml file.
Now, for example, you can easily add deploy/xxx.ear/aaa.war/some-new-file.html or edit deploy/xxx.ear/aaa.war/some-file.jsp.

JBoss removes JAR files when deploying EAR file

I recently migrated from JBoss EAR 6.4.0 to 7.0.0. In my deployments folder, I have a EAR containing numerous JAR files of my project. When I unpack the file after building, all files are there as desired.
But as soon as I start the server and the EAR file gets unpacked by JBoss, a couple of my project JARs vanish. The files are simply not there, so my server starts incompletely and my EJB client cannot connect ("No EJB receiver for handling...").
Is there any 'smart' mechanism in JBoss that may cause this behaviour?
My colleagues are working on the same project (but different IDE) with no problems.
You must specify each jar as a module in the application.xml file in the ear context.
<display-name>Your-ear-file-display-name</display-name>
<module>
<java>YourEJBJar.jar</java>
</module>
...

Custom Shared jars in TomEE

Trying to have unique jars for each application, so using
"org.apache.catalina.loader.VirtualWebappLoader
configuration in context.xml. The application is an EAR, deployed in 'apps' folder under TomEE install directory. context.xml is in
/apps/myApp/META-INF/
but the jars are not visible to app. Question is,
1) is this the right location? or should it be in META-INF of the webApp inside ear - /apps/myApp/webApp/META-INF
2) VirtualWebappLoader is only for webApps and for EAR under apps?

How to create war from ear

I have developed a web-service client and tested it as ear on local jboss always. this ear work fine. Now I want to create war for this application. whenever I tries:
project:export:war file
in eclipse, it creates war without any third party dependency jars files added to it. This war does not gets deployed on jboss successfully.
Can anybody guide me hw to create war from ear.
you cannot create war from ear. ear is enterprise archive, and war is web archive. ear may contain many war files. So when you are creating war using eclipse, it creates a web archive. To add your third party jars, put them into the lib folder of your web application, that way it will be included into your war.

Categories