|[m2e-users] Desperate - need help getting Ear project to deploy|
I’ve been battling m2e and RAD for a long time now in an attempt to convert an existing, working project to a multi-module Maven project. I’ve managed to convert the app and successfully deploy and run the app within a workspace. A major problem was discovered when checking the project out into a second workspace. I wanted to see what another developer would have to go through upon checking the project out. Everything compiled just fine. The problem was deploying the compiled .ear app to WebSphere via wtp (Publish) from within the second workspace. I get stack traces all over the place complaining about ClassNotFoundException’s. The deployed .war can’t even find classes defined within its own web.xml (the bootstrap class, listeners, servlets, etc.).
Looking back to the work I did in the 1st workspace, I know that I was messing with wtp-related settings (Deployment Assembly, Build Path, etc.)…essentially all “no-no’s”. So, I have no clue how the heck that app is working and running within the 1st workspace. I had jumped into the conversion before I had stumbled upon this:
https://www.ibm.com/developerworks/wikis/download/attachments/113607155/RAD_m2e-Nov.pdf?version=1 (*note this is June 2012. I had stumbled upon the Nov. 2011 version. I’ve been attempting this Maven conversion since May). I just discovered this new version while typing this, but I’m not seeing anything that will resolve this problem.
I can build the project via mvn install in the command line or through RAD (Run As… -> Maven install) and manually deploying either the .ear or .war via Admin Console to WebSphere works (the app starts with no errors and I can actually navigate to and use the app). So, I know that the issue lies with the .ear generated by m2e within /target in my workspace. I’m thinking that the problem has to be the way I’ve configured the maven-ear-plugin and the maven-war-plugin.
Then again, while typing this, I was able to get the app bootstrapping without ClassNotFoundException’s for classes within the .war (everything listed in web.xml). It only griped about not finding a Dao object in my .jar project dependency that app bootstrap class uses to initialize Hibernate. After I added the .jar as a dependency to the .ear project, as an experiment which failed to solve the ClassNotFoundException’s, removed the .jar dependency from the .ear project, removed the app from WAS, cleaned WAS, and then added the app back, I get ClassNotFoundException’s for everything again. Wth?
Can someone please help me sort this out and get this to successfully deploy from within RAD to the test WAS 6.1? With the situation described in the last paragraph occurring, I am extremely confused as to what the heck is going on here.
I have to be able to do deploy from within RAD to the built-in test WAS 6.1 via wtp (Publish). I’m not the only developer, but I’m the only true Java/web guy here…so this stuff has to be as simple as possible. This is also holding up me implementing a Maven Repo and CI setup. I’ve been pampered by using Maven in combination with NetBeans + Tomcat 7, so this m2e experience has been beyond frustrating. I’ve been using RAD + WAS 6.0/6.1 for the past 3 years, and it’s been a dream of mine to get my apps at work converted to Maven projects.
RAD – v184.108.40.206
WebSphere – v6.1.43
M2e – 1.1.0
M2e-wtp – 0.15.2
I don’t use the embedded Maven that comes with m2e. Via RAD’s preferences, I use my external Maven 3.0.4 installation.
I’ve taken advantage of some of the features introduced in m2e-wtp 0.14 and 0.15:
1.) RAD -> preferences… ->Maven -> WTP integration: unchecking “Maven Archiver generates files under the build directory” specifically for my .war project and then all projects as directed. This allows me to republish to WAS via wtp via “Run server with resources within the workspace”, which allows me to avoid having to manually remove the app from WAS every time I wish to republish. MANIFEST.MF and pom.properties are then put within src/main/webapp/META-INF, which I exclude from SCM.
2.) The defaultRootSource tag for the src/main/webapp wb-resource entry within org.eclipse.wst.common.component.
3.) My .ear project requires a <finalName>, under the <build> section of the pom, that matches the Ear project’s name within the workspace. This allows me to right-click on the ear project and open the WebSphere Application Server Deployment.
I need to switch the CLASSLOADER policy to PARENT_LAST due to us being stuck with JSF 1.2, specifically MyFaces. IBM packages JSF 1.1, specifically Sun-RI (pre-Mojarra) into WAS 6.1 (argh). I’m looking forward to WAS 8. I deleted the wtp-generated application.xml. pom.xml is generating the application.xml by default.
I am not using skinny wars…for now. I tried a skinny war setup and had the same ClassNotFoundException problem. I want to get something simpler working first.
Here’s the build portion of my .war’s pom:
<!-- Changes the Context Root -->
<!-- skinny war file
The build portion of my .ear’s pom:
<!-- The finalName must equal the ear project's name to open the App Deployment Descriptor -->
<!-- Necessary to map to m2e-produced war from target directory -->
<!-- no-version causes issues in NetBeans/GlassFish -->
<!-- Need this to map to ibmconfig files -->
Here’s the .war dependency as listed within the .ear’s pom:
Sorry for the novel…just trying to describe everything necessary to understand the situation.
The information transmitted is intended only for the person(s)or entity to which it is addressed and may contain confidential and/or legally privileged material. Delivery of this message to any person other than the intended recipient(s) is not intended in any way to waive privilege or confidentiality. Any review, retransmission, dissemination or other use of , or taking of any action in reliance upon, this information by entities other than the intended recipient is prohibited. If you receive this in error, please contact the sender and delete the material from any computer.