How to make an EAR refer WAR shared library - java

I would like to get a help from you all. The below is the issue I am currently facing with.
I have added a reference of WAR shared library in weblogic-application.xml of EAR file.
In EAR, I do have a ejb module which has "library-directory" tag in application.xml. I want ejb module to refer jar files in shared library but it looks for jar files in lib folder of EAR.
In lib folder of EAR, jar files are not available but the jars are available in WAR shared library.
How to resolve this issue and make the ejb module of EAR refer the jars of WAR shared library.
Please add a comment if the problem is not completely understandable.
Many thanks in advance for your help!

Try defining the jars you need as modules in application.xml. Something like:
<module>
<java>pathToWarLib/needed.jar</java>
</module>

Related

Resources file configurable in multi module maven project

I have one parent project which has WAR and JAR project. Currently the .xml and .properties files are packaged with jar. My requirement is that I want the resources folder of jar project which as .xml and .properties files to be available in WEB-INF folder of the war when the war project is build.
So that I can edit the files when the war is deployed on server.
There are a few ways to share resources across multiple projects or modules:
Cut and paste them.
Use Assembly and Dependency plugins
Use the maven-remote-resources-plugin
the second approach is described here
the third approach is described here

JBoss 7.1 How to add a module

I use the annotation #WebContext in my project using JBoss 7.1.
This annotation is present in a JBOSS module:
<module xmlns="urn:jboss:module:1.1" name="org.jboss.ws.api">
The jar is located in JBOSS\modules\jboss\ws\api (jbossws-api-1.0.0.GA.jar)
I'm not using maven so how do I include this dependency? Can I use the jboss-deployment-structure or Dependencies in the MANIFEST?
My point is to have access to the jar in my Lib. Ideally the jar jbossws-api-1.0.0.GA.jar must be located in JBoss 7.1 Runtime Libs.
I have already try to have the dependency in the MANIFEST and jboss-deployment_structure bu of course with that JBoss 7.1 Runtime Libs isn't updated.
I think the file standalone.xml must be updated in order to add this module. Please explain to me how I do that?
Thanks.
You only need to add a dependency if its not automatically included.
If the org.jboss.ws.api not automatic( you will find out when you deploy to the server ), and I don't see why it wouldn't be, adding it via the jboss-deployment-structure.xml is the way to go.
That file should be included in your WEB-INF directory, along with your web.xml and jboss-web.xml files.
See AS7 Classloading Documentation on the jboss-deployment-structure.xml if need be.
In eclipse preference if you go under Server-->RuntimeEnv-->DefaultClaspathEntry. You can add additional modules. I had to add org.jobss.ws.api.

Reference library not deployed as a module

How do I reference a library deployment that is not in the modules folder from an ear deployment in jboss 7? I have a common library (jar) deployed ok, and an ear deployment fails because it can't not locate the classes deployed in the common jar from earlier
It should go into the lib/ folder in the EAR and <library-directory/> needs to be set in META-INF/applicaiton.xml.
If you deployed the common JAR you need to add a dependency in the MANIFEST.MF of your EAR or create a jboss-deployment-structure.xml. The class loading documentation has more details.
The module name of the deployment should be something like deployment.name_of_deployment.jar.

Shared libraries between wars

I use server glassfish and maven, I have many wars deploy and each one have their libraries. Many of them use same libraries and I want to extract this libraries out of the war. I try to put them in a folder /lib of the server and put provided scope on the dependency of the war, but this don't work fine because the server ask for more libraries and i have problem with other wars. Also I try with scope system but doesn´t work.
I was searching a solution in Internet and only find skinny wars.
¿There are a way to do it?
If I will create a ear with the commoms libraries could I referenced them from a war (or packaging the war in other ear)?
Thanks you very much.
Yes, if you create an EAR and but the WAR libraries into it, they could reference any library in the EAR's lib folder.
Why don't you package your .war files into an .ear and add shared libraries to the lib of the EAR project?

jar file in persistence.xml not loaded by glassfish

folks,
i understand this is a silly question... bt i am so new to glassfish...
i have got an ear to deploy to deploy in glassfish 3. the ear has a jar and war inside already. the jar is a JPA jar and it has persistence.xml file. i have added a jar-file entry to load inside the persistence.xml file, with a jar entry which is not in the ear to be deployed. Where should i put the jar for glassfish to load it
( i have tried putting it in all lib folders in the glassfish dir and even inside various places in the ear only. there is something with lazy deployment i guess... so please suggest me a way to somehow solve this.)
thank for your time,
rajan
okay, what i did was created a lib folder inside the ear, put the additional jar there and in the persistence.xml file inside the ejb jar, i had set the jar-file value as lib/jarname and it recognized...
thanks for yure time guys...
rajan...

Categories