File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF 2.0 with Tomcat migration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF 2.0 with Tomcat migration" Watch "JSF 2.0 with Tomcat migration" New topic

JSF 2.0 with Tomcat migration

Enrique Villamizar
Ranch Hand

Joined: Jul 30, 2005
Posts: 93
Hello to everybody:

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: ...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.
Bart Kummel
Ranch Hand

Joined: Nov 30, 2007
Posts: 81

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.

Best regards,

SCJP 1.4 | SCJD 1.6 | Visit my website | Author of the book Apache MyFaces 1.2 Web Application Development
Enrique Villamizar
Ranch Hand

Joined: Jul 30, 2005
Posts: 93
Thank you Bart for your kind reply.

That´s mean I have a big problem.

I'll keep on trying.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

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.
Enrique Villamizar
Ranch Hand

Joined: Jul 30, 2005
Posts: 93
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.

Once again, thank you.

I agree. Here's the link:
subject: JSF 2.0 with Tomcat migration
It's not a secret anymore!