Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF 2.0 with Tomcat migration

 
Enrique Villamizar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: 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.
 
Bart Kummel
author
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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,
Bart
 
Enrique Villamizar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bart for your kind reply.

That´s mean I have a big problem.

I'll keep on trying.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18014
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Enrique Villamizar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic