EAR with EJB and WAR modules fails to deploy WAR dependencies - eclipse

I have an EAR that has many EJB modules and one WAR. The WAR dependencies are not picked up. There are only 3 of the WAR dependencies that are not already included in the EAR. These are ones that break the deployment. The target web logic server starts in Eclipse but the app fails to publish. As a test, when I add the missing WAR dependencies to any of the EJB modules they are picked up.

The problem was with certain versions of the m2eclipse plugin from Sonatype.
Some versions of the plugin do not correctly propogate the dependencies for the web project (WAR).
The plugin that works is the one that is installed in version 3.6.2 of eclipse. The one in 3.6.0 doesn't work.
Once I woved to version 3.6.2 of eclipse the problem went away.
Granted the issue may also have been tied to the plugin verions PLUS the version of eclipse.
Here are the maven plugin and eclipse details:
Works:
m2eclipse - 0.12.1.20110112-1712 running in Eclipse Java EE IDE for Web Developers Helios Service Release 2 Build id: 20110218-0911
Doesn't work:
m2eclipse - 0.12.0.20101115-1102 running in Eclipse Java EE Version: 3.6.0 Build id: I20100608-0911

Related

Issue deploying EAR project from eclipse to EAP 6.2.0 using JBoss Tools Plugin

I have a maven EAR project, which contains a couple of WAR and JAR files. I'm using Spring STS IDE with JBoss Tools 1.6.0 (latest).
When I try to deploy my EAR to JBoss EAP 6.2.0 with JBoss Tools from STS i'm facing the following issues.
My Jars (external jars and project jar) are getting copied into WEB-INF/lib and EAR/lib, where i expected it to be only in EAR/lib.
EAR application.xml is not getting copied into EAR/META-INF/ folder
But when i use terminal to build my project and deploy EAR, i'm not experiencing these issue and JBoss starts without any problem
Here's its solved JBIDE-19047 The main issues are,
jars are getting copied into WEB-INF/lib due to skinnywar not supported by eclipse m2e-wtp plugin and this can be solved by adding <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> in war plugin configuration.
application.xml not getting copied into ear/META-INF/ folder, if you have any unresolved dependency in any of the pom then this would occur, so make sure all jar dependencies are available.

maven and eclipse builds differently the same project

I have a java ear maven project.
When I publish the ear to jboss7 via eclipse it generates an ear and deploys it to jboss.
But when I manually run a maven build of the same project I get a different ear in size and also the name is different.
When eclise builds the project when executing "publish to server", doesnt it use the same build as maven?
I use eclipse juno and maven3. I'm new to maven.
Eclipse uses the .classpath to package the ear that gets deployed to jboss. When you do a manual maven build it is using the pom.xml file to package the ear. If those aren't in sync you could get differences in your ears.

Maven WebApp deployed inside WTP (Eclipse) Tomcat: META-INF/context.xml is not copied over (is ignored)

Disclaimer: this is not a duplicate of the "why isn't my JDBC resource declared in META-INF/context.xml taken into account" genre questions.
I have two Java EE web applications:
one is created inside Eclipde IDE using Eclipse's "Web Application Project" template
the other one is created using Maven, and then imported into Eclipse
Inside Eclipse I also have a Tomcat configured using the WTP Plugin, such that I can easily (or so I hoped) deploy my Eclipse Web Apps in there in a "one button push" way.
For each of the above described applications, I have a context.xml file placed in their META-INF directory, in which I declare some JDBC datasources as JNDI resources.
The Eclipse created application works fine when deployed in the WTP Tomcat inside Eclipse. I right-click the Tomcat server in Eclipse, add the project, start it and it all works fine, the JNDI datasources are found etc.
For the other project, the one created with Maven and imported inside Eclipse, if I add it to the WTP Tomcat, and manually specify where the war file was built by Maven (in the "target" dir) it seems to work, but the JNDI datasources are not found, more specifically, my Spring declared datasource:
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/whatever" />
throws an exception saying no JNDI name is bound for "whatever".
If I deploy the very same war file in a "regular" Tomcat (just un unzipped Tomcat, no Eclipse involved) it works fine and the JNDI datasource declared in the war's META-INF/context.xml is found.
I've looked inside Eclipse's Tomcat working dir, and sure enough while for the Eclipse created project the context.xml file is copied inside "{catalina home}\wtpwebapps\eclipeProjectName\META-INF\context.xml", there's no such file (and folder structure) for the Maven project.
My question is then: does anyone know how you can have a Maven-created web app imported inside Eclipse and deployed in WTP Tomcat such that the META-INF/context.xml file is taken into account?
As you've mentioned that you are using the Eclipse Helios. There is a alternative one provided by JBoss as the Eclipse Update Site. The document told us as the following: -
The following folders should never be removed as they are part of composite
requirement sites used for current/previous JBoss Tools releases:
Helios SR2: 0.13.1
Indigo SR2: 0.15.3
Juno (SOA Tooling Integration Stack ONLY - may not be needed much longer?): 0.14.0
Juno SR1 (can be removed when we have a Juno SR2 target platform instead, if anything newer exists): 0.16.0
Please note, before the Eclipse Juno, I used Helios and Indigo with this plugin. It also gives me a good result.
I hope this may help.

missing jars when publishing a web app to glassfish with eclipse juno and maven integration

I use eclipse juno with GlassFish Server Open Source Edition 3(java EE6), m2e and maven 3.0.4.
When I create a war file by 'mvn package' command and deploy it to a glassfish,
the war file works just fine.
However, when I publish a web app to a glassfish from the server view of eclipse,
the web app fails.
I guess the reason of this failure is that publishing from eclipse is not configured correctly
to get jars from my maven repository and then jar files in eclipseApps//WEB-INF/lib directory are missing.
Can I configure eclipse to use a maven configuration when publishing a web app to a glassfish?
Thanks.
I found the answer
"anyway I solved the issue by adding following row Properties > Deployment Assembly: /target/myapp/WEB-INF/lib -> WEB-INF/lib"
in
Glassfish Deployment out of Eclipse Helios SR2 fails
Thanks.

Can not run maven project in eclipse

We have existing maven project. I have imported it with m2eclipse plugin.But
I can not run the project. Tomcat can not see resources(WAR files under target folder).
What am I missing? BTW we have multi-module project(2 WAR files).
Thanks in advance!
You need to add the tomcat server in your eclipse.
The maven project should be a web based project
You need to add the web project to the tomcat server.
You need to add J2EE Module Dependencies - Eclipse 3.3 ( To enable all library dependencies to be available at runtime to tomcat). Paths that point to your m2 repo & the lib files.
It may be Java EE Dependencies in earlier versions.
Both your projects needed to be added similarly.