Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deploying a jsf application to tomcat

 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I deploy a jsf application to tomcat?

Thanks,

Sonia
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same way as any other webapp. Build a WAR and deploy it.

The biggest difference is that as of Tomcat 6, you don't have JEE compliance, only J2EE. So you have to explicitly include a jsf-impl library in the WAR along with the jsf-api library. A JEE-compliant server would only require the jsf-api library, since the jsf-impl is part of the server itself.
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I took this code out of O'Reilly's book posted online at:

http://onjava.com/pub/a/onjava/2005/07/13/jsfupload.html?page=1;

I created a war file and I put it in the WebApps directory. (Is that correct?)
I still get a 404.

Thanks in advance,

Sonia
 
Smitha H Rao
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refer this tutorial. It explains you how you can do it with the screenshots

http://www.skill-guru.com/blog/2009/08/10/319/
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://onjava.com/pub/a/onjava/2005/07/13/jsfupload.html?page=1

Is similar to your posting of Upload Files with JSF and MyFaces.
http://www.skill-guru.com/blog/2009/09/10/upload-files-with-jsf-and-myfaces/
And I am getting the following
Oct 1, 2009 1:24:51 PM org.apache.jasper.runtime.JspFactoryImpl internalGetPageContext
SEVERE: Exception initializing page context
java.lang.StackOverflowError and this:

Oct 1, 2009 12:53:09 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: Could not initialize class org.apache.myfaces.shared_tomahawk.config.MyfacesConfig

Thanks,

Sonia
 
Smitha H Rao
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you are not having tomahawk.jar in your WebApp/WEB-INF/lib directory.

Please check it.
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have in in the lib directory.
 
Smitha H Rao
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please send full exception stack trace to smitha.h.rao@gmail.com
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Smitha,

http://www.skill-guru.com/blog/2009/08/10/319/
Do you have the sample code I can import into eclipse? Can you send it to me at

v.kris21@gmail.com?

Thanks,

Sonia
 
Smitha H Rao
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at your code which you had sent me.. I found that the major mistake in your project is the web.xml file.

The step you should follow is when following skill-guru tutorial for fileupload are:
1. First deply the sample jsf application from the jsf beginner's tutorial
http://www.skill-guru.com/blog/2009/08/10/319/

2. Then you have to integrate the myfaces into it. (combining the web.xml entiores and jars also)
http://www.skill-guru.com/blog/2009/09/10/upload-files-with-jsf-and-myfaces/

In your application you didn't had jsf configuration itself.
Also you also missed commons-io jar, which is clearly mentioned in the tutorial.

Also you had the whole myfaces downloaded directory inside your lib, which also includes unnecessary jars twice..

Hope this helps
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your help. That is working for me

Can you elaborate on what was wrong with the web.xml? and how do you make an application jsf enabled.

Thanks,

Sonia
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Smitha,

I am trying to follow the tutorial at the link you provided:

http://www.skill-guru.com/blog/2009/08/10/319/

But even though Tomcat has been added as a server to eclipse,
when I right click on the project it does not give me the option
to run on Tomcat. How can I fix that?

Thanks,

Sonia
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic