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.
Related
I have an EAR file with 3 WARs and some common dependencies within lib/ folder. One of those dependencies has an EJB with a scheduled method, but it seems that the server is not recognizing it. No evidence in log, no code executed.
But when I deploy a simple war with the same jar within WEB-INF/lib, it works. I've already tried to package the jar as an ejb-jar with the maven plugin, but no success at all.
Any ideas on what must be going on?
Jars in the lib directory of an EAR are not considered to be EJB jars and their content is not considered at deployment time in that respect. The lib directory only exists to make it easier to provide library jars whose classes are automatically made visible to all the modules in an EAR file.
Your EAR file contains a META-INF/application.xml file that lists out the various modules that it contains. Prior to Java EE 6, only ejb-modules were considered for potential EJBs. Java EE 6 and newer added web-modules to that list. All jars within a web-module's WEB-INF/lib directory are considered to be part of the web-module, even if they contain ejb-jars. Any ejb-jar.xml files found within a web-module are merged together. This applies even if the web-module is deployed as a standalone WAR file.
I have a question about JBoss modules dependencies vs war dependencies.
I have an app.war; its webinf/lib directory contains a myLib.jar only. In this configuration everything works fine.
Now I have to move mylib.jar outside the war, so I put it into a JBoss module and added it to module.xml; I also added it to the deployment-structure.xml file in the war.
In this new configuration my app.war finds succesfully the external myLib.jar but now myLib.jar cannot find its dependencies anymore.
Specifically it doesn't find rowset.jar as I get this exception:
java.lang.NoClassDefFoundError: com/sun/rowset/CachedRowSetImpl
Why can’t myLib.jar see all the libs it used to see when it was deployed inside the war? Do I have to create a JBoss module with myLib dependencies?
Thanks
modules must have their own dependencies explicitly declared in the modules.xml. A Module cannot access jars that are part of a deployment.
We are in the process of converting our appengine project that uses backends to one that uses modules instead. See https://developers.google.com/appengine/docs/java/modules/converting
This implies going from a WAR project to an EAR project.
However the appengine eclipse plugins only has support for pointing out a WAR directory.
Does anybody know how this work. I.e. should we point this to our EAR directory?
We faced the same problem when migrating from backend to modules.
it seems that currently the GPE doesn't support modules, how ever we did solve this with this hack:
We renamed our WAR directory to "default" (you can point the web application there (under Project Properties -> Google -> Web Application -> WAR Directory).
We also included a dispatch.xml file in that module's WEB-INF dir that tells appengine which module to serve according to urls.
the last thing we had to do is to have a custom script that compiles gwt/class to those directories and deploys to appengine.
here is the overview of the project's layout change:
OLD LAYOUT
project_main_dir
war
NEW LAYOUT
project_main_dir
default
WEB-INF
dispatch.xml
module1
WEB-INF
module2
WEB-INF
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>
I build a java enteprise application in netbeans 7.1 which consists of two EJB modules. One of the EJB modules has a reference to another class library project, lets call it MyUtilities. When i deploy the application, its ear file does not contain MyUtilities.jar file. When i add to the other EJB module libraries MyUtilites project, although its not necessary, the ear file is built correctly and under its lib folder, MyUtilities.jar exists.
Anyone with the same issue?
Thanks
Did you check the setting of the checkbox "Package required JARs in EJB jar" in the Build | Packaing dialog?
This is a new option which I found after upgrading a NetBeans 6.5.1 EJBModule project which had also no longer the references JARs bundled in the EJB jar.