I have an .ear file that contains:
a jar file a.jar with some EJBs whose manifest file refers to jar b.jar in its class-path.
a jar file b.jar with other EJBs.
This deploys correctly in JBoss 5. However, when trying to deploy in JBoss 6, I get a:
DEPLOYMENTS IN ERROR:
Deployment "jboss.j2ee:ear=SMS-ear.ear,jar=SMS-ejb.jar,name=TimerServiceDispatcher,service=EJB3" is in error due to the following reason(s): org.jboss.ejb3.common.registrar.spi.DuplicateBindException: Cannot install org.jboss.ejb3.proxy.impl.factory.session.stateless.StatelessSessionLocalProxyFactory#248fd67f under name "ProxyFactory/my-ear/MyEJB/local" as there is already an existing object there:
Where MyEJB ejb belongs to b.jar jar file. If I remove the b.jar entry from the a.jar Manifest file, everything works fine. I am pretty sure the EJB is not duplicated and there are not other EJBs with the same name.
Why does JBoss try to bind EJBs that are referenced from a manifest file a second time?
Related
I have created a spring project with maven and it works fine. I am trying to add a jar file to the project, eclipse does not give any errors but when i start the server and try to access to the page which uses a class from that jar file i get a classNotFound exception.
My steps are..
1 - I put the jar file in src->main->resources
2 - I added it to build path by right clicking and saying add to build path.
3 - I add the project to tomcat and start the server
The thing is i looked at the tomcat deployment directory and the .jar file appears in classes directory. When i take copy the file from classes to lib (which has libraries downloaded by maven) project works fine.
I am using WildFly 8.2.1.
I need to add specific JAR files to the class path. How can I do that?
Do I need to get inside the module hell?
All I need is to add a couple of extra Oracle JAR files to enable using TLS on the data source connection...
When you build your .war file, add them to the /WEB-INF/lib directory. They will be accessible on the classpath from there. In eclipse the eclipse maven plugin, m2e, will do it by reading your POM file, or of course, maven run by hand will do it.
In the POM file, have it packaged as a war
<packaging>war</packaging>
and declare your jar as a dependency.
I am new to Maven and know the basic concepts of Maven. I got a requirment to work on mavenizing multiple projects which uses most of common/same jars.
I was asked to build a TAR/ZIP file that contains all the jars and build WAR file for each project with out jars. So that Project (WAR) can use jars present in TAR/ZIP file.
finally after build, TAR/ZIP file needs to be deployed on server forst and later WAR file. so that, in run time WAR can have refrence to jars.
Can anyone please help me in this ?
Actually this structure will reduce size of WAR files as we are keeping these jars in single TAR/ZIP file and deploying it in tomcat server.
When deploying an EJB project to JBoss using JBoss Maven Plugin, I get a NoClassDefFoundError on my JBoss' console about a class that is in one of the dependencies of this EJB project.
This dependency is declared with a Compile scope. Is there another scope that I should use so that my dependencies are also deployed to JBoss? Or how should I solve this?
The error looks like this:
DEPLOYMENTS IN ERROR:
Deployment "vfszip:/Users/hordine/projects/SoftBudget/soft-budget-ejb/target/soft-budget-ejb.jar/" is in error due to the following reason(s): java.lang.NoClassDefFoundError: br/com/pedra/j2eepatterns/facade/IEntityService
I understand that you have packaged the EJB as a jar file. This means there is no any provided dependency as same as a stand-alone jar.
AFAIU, there may be 3 possible ways as the following: -
Package them as an ear and put those dependencies inside the ear/lib. Please see Maven EAR Plugin for further information.
Package them as an war and put those dependencies inside the WEB-INF/lib. Please see Maven WAR Plugin for further information.
Package them as an jar and put those dependencies inside the classpath or application server lib. Please refer to your application server document.
EDITED:
If you are using the JavaEE 6, then it is possible to package the EJB as a war file. The The Java EE 6 Tutorial: Packaging Enterprise Beans in WAR Modules told us as
Enterprise beans often provide the business logic of a web application. In these cases, packaging the enterprise bean within the web application’s WAR module simplifies deployment and application organization. Enterprise beans may be packaged within a WAR module as Java programming language class files or within a JAR file that is bundled within the WAR module.
To include enterprise bean class files in a WAR module, the class files should be in the WEB-INF/classes directory.
To include a JAR file that contains enterprise beans in a WAR module, add the JAR to the WEB-INF/lib directory of the WAR module.
WAR modules that contain enterprise beans do not require an ejb-jar.xml deployment descriptor. If the application uses ejb-jar.xml, it must be located in the WAR module’s WEB-INF directory.
I hope this may help.
I am using Maven for creating my project structure. The following is the way I am doing
Generate Archetype
Have the following modules - Ear, War and WarSource (I am deleting the src, ejb and jar folders)
So my EAR will have 2 modules - War and WarSource which inturn have src/main/java and src/main/resource folders
Question is - where should my application context reside so that I avoid the File Not Found error during runtime.
Thanks
If you're using spring mvc it will be in the war src/main/webapp/WEB-INF/ directory. Also if you're using spring you may not even need an ear file, you should read up on that to be sure you're not adding unnecessary complexity.