Generate Websphere 6.1 compatible EAR file using Maven - java

I've been looking around for some time and couldn't find a clear explanation for this.
We're using a Websphere server to run a Web application developed using Rational Software Architect 7. This application is composed of a war project and 4 jar projects. To make the final ear file there is a sixth project which contains the additional files needed by IBM to deploy it.
Currently we have to use RSA to genereate the ear file. I would like to use Maven to do that.
Apparently previous tries to use maven-ear plugin generated corrupted ears. It would appear thet they are missing the extra xml files needed by IBM.
I found a maven was-6 plugin, but it doesn't seem able to generate the file, only to install it on websphere. I couldn't find a clear description of what it does.
Does someone have any advice ? A link to some article ?
Thank you very much !

Use the maven-ear-plugin to generate your ear, but include the extra ibm specific config files as part of the earSourceDirectory property of that plugin.
The plugin will generate the generic application.xml file and the ibm specific file ibm-application-bnd.xmi and the contents of the ibmconfig directory can be rolled in by the plugin as well, just not generated.

Related

What libraries does eclipse need in build path for Hibernate?

I'm learning Hibernate and am following an online tutorial on integrating it with Eclipse. I have installed the JBoss plugin with Hibernate into Eclipse Luna 4.4. and verified I have Hibernate available. The next step is to configure the build path for my new Java project and include the "necessary" Hibernate libraries...no information given on how to do that. How does one go about identifying the required jar files? I see several folders under my eclipse plugins directory that contain jboss or hibernate in the folder name, and underneath these folders do exist jar files, but I would think that there must be an easier way than plodding through all these directories and adding any jar file that looks like it's related to Hibernate or JBoss. Thanks.

Is there a way to deploy a Maven project with "jar" packaging into Tomcat7?

My project generates a Jar as the output package and uses an external War file, available on our Artifactory, as the Web Application to be deployed on Tomcat (currently using version 7). This War file contains all libs and modules required for the application to run.
I have already packaged and ran those projects outside eclipse on a "vanilla" Tomcat installation. In this scenario, the Jar my project generates is loaded on the context.xml file this way:
<Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="/home/igor/workspace/myapp/myapp-2.4.3.jar"/>
Is there a way I can deploy this project on Tomcat using Eclipse and still be able to debug it? Can I use the Jar generated for this purpose or do I have to deploy the workspace project?
As for the War file, do (or can) I have to add it as an dependency?
Thanks in advance!
EDIT
We actually provide an Web Framework, which is packaged as a war. Other applications that use that framework are exported as jars and loaded into the framework through the context file as cited above.
Your question is confusing probably because of your custom plugin/classloader and deployment which is sort of orthogonal to debugging.
What I recommend is you keep whatever system you have to build/package/deploy and use JVM remote debugging. That is do not use the Eclipse WTP since you seem to have custom steps for deployment but rather build your code deploy & run a separate Tomcat instance and then run the remote debugger in Eclipse.
You will get some hotcode swapping with this method but not as much as something like JRebel.. (which you could use also) it will certainly be better than constantly redeploying.

Maven Build Views & XML Files Missing

I've been having trouble with Maven. Searched around but couldn't find anyone with similar problem or explanation. I am packaging a webapp with maven's generate archetype using openjdk7 for jre and jdk. Using Lubuntu Os. I am not using Eclipse or Netbeans since my computer is too slow to support it (runs too slow, I can't take it). Plus I'll have to create the war for the live webapp soon (outside of eclipse).
What happens:
I run mvn package and it create's the .war file.
There's only warnings about UTF-8 encoding. I fixed all other warnings which were about plugin version in the pom.
When I open the war, my views are gone and my spring-context file is gone.
Any ideas?
You need to place the files under src/main/resources to be packaged with the war. See the maven directory structure shown here: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
With a typical web-app with xml file, the xml file and views go under src/main/resources/webapp/WEB-INF folder. See this discussion: What is WEB-INF used for in a Java EE web application?

How to filter webapp src/main/resources and see replaced values with JBossTools

I have a maven web application which has the file src/main/resources/appContext-ejb.xml file which has the ${version} placeholder in it.
I want that placeholder to be replaced by the version of the maven project, so I 've configured the maven resources plugin to enable filtering of the file.
After compiling with eclipse I can see the file under the target/classes directory with the correct (replaced value).
Also when packaging the war archive the file is being replaced without problems.
My problem is that I want to use the JBoss Tools eclipse plugin to start my web application, so I create a jboss server, and add my web application to it. When I start jboss (from within eclipse using jboss tools) and try to use my application the piece of code which needs that file with the replaced value fails telling that ${version} was not replaced.
Does JBoss Tools plugin use src/main/resources instead of the contents of target/classes?
How could I configure or make Jboss Tools use the already replaced file in target/classes?
I 've searched the web for this and I 've found a lot of information on how to enable filtering to web resources so that jboss tools takes changes on the fly, but I believe that that's not helpful for me because this file should not be used as a web resource because it shouldn't be served as web content.

Java classpath for dynamic web project

Hi all i have very rare problem which needs to be solved.
Problem/issue:
I have a dynamic web project which is already built and i have war file of that project.
I need to apply some customizations on top of the war file given to me.
Using maven or ant am able to compile the custom code written by me and able to add produced class files to the war file.
But the this is happening for final war file build.
when i want to test my code in eclipse. the war file build and deployed in jboss plugin contains only the class files produced out of java files written by me..........
Please help me how can i modify the .classpath file of my project so that a jboss publish can build a war file using the dependent war file which can run on eclipse-jboss to test my custom code....
Advance Thanks.....
Not a rare problem.
What you need to combine two web applications (wars) together. You have your customization war on which you need to overlay the existing web application.
It looks like you have already solved it from build perspective and looking for Eclipse support. To my knowledge, Eclipse lacks support for this. You probably need to manually do the necessary configuration to make this happen.
It looks strange to me to have two WAR files.
Perhaps you have to consider to package your customizations in a JAR and inserting that jar in the original WAR file.
Otherwise, another solution, and what I do often with open-source project to customize is to have three projects in your workspace.
PRJ-src (with your original sources/JAR/WAR)
PRJ-custom (which depends of the previous one); This project contains only the new classes or custom spring xml files (with injection of my own classes)
PRJ (the merge of the two previous projects)
I create an Ant task in the 3rd project which takes the 1st project (PRJ-src) and merge with the 2nd project (PRJ-custom). This is possible to do so with Maven as well.
Then this is the only project I deploy in my app server (tomcat / jboss).

Categories

Resources