This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a JSF 2.0 application (Java EE 6 - GlassFish v3 - Netbeans 6.8) running well on my computer but now I must move it to a Linux server with Tomcat 6.0.20.
To do so I added jsf-api.jar and jsf-impl.jar to the lib project folder but the *.war generated by Netbeans doesn´t work with Tomcat. The initial error showed is: java.io.FileNotFoundException ...tomcat6\..\..\META-INF\MANIFEST.MF
The question is: ¿what is the correct way to "migrate" a JavaEE 6 application to make it run on Tomcat 6? or ¿What does Tomcat 6 need in order to run a javaEE 6? ... what should I do?
Thanks in advanced for any help you could give me.
I think there's no easy answer to this. Tomcat is not a full blown Java EE server. That means it depends on which parts of Java EE you are using in your web application. For each Java EE library you are using, you should investigate what is needed to run it on Tomcat.
Tomcat provides the Servlet and JSP functions of JSF along with some JNDI support, including the ability to use JNDI to present datasources. That's about all the J2EE you're going to get from it. Anything else has to be added in separately.
One way around that is to use a system such as JBoss or JOnAS (which is more popular in Europe). Both of those products embed Tomcat in their own frameworks to provide a full-service J2EE stack. Failing that, you have to manually add support jars as needed.
JSF and JPA support are fairly easy to obtain in unadorned Tomcat. However, if you want to be able to deploy on both Tomcat and full-stack J2EE servers, you need to be able to customize the build process. One way to do that is to use Maven and define profiles. I have, for example, one or 2 projects whose test profile is for Tomcat and whose production profile is for the IBM WebSphere server.
Maven is supported by most of the major IDEs. Additionally, Maven can do builds without IDEs or even a GUI environment. I learned a bitter lesson years ago that it's not wise to depend on an IDE to do your production builds.
An IDE is no substitute for an Intelligent Developer.
Joined: Jul 30, 2005
I could not agree with you more...experience is the best teacher. Thank you, Tim, for sharing some of your own experience.
I don't need my project to be deployed on two or more servers. My problem is that in my localhost I used Glassfish v3 and the server where the application finally is going to be used Tomcat ( the *.war doesn't work). I'm going to try maven (yes... I depend on Netbeans for now).
When I made the choice to use Netbeans - JSF 2.0 and GlassFish I thought that changing to Tomcat could be easier. Now some people are telling me to rewrite the project from the beginning with Tomcat... I think there is a better solution but I don't know it yet.
I'm wonder if you know some maven tutorial that could help me in find a solution to this. I've never used maven before.