• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

new JSF web appliction on Tomcat

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I'm using Tomcat 5.5, I'm new in Tomcat and web application world and most of all I'm an inexpert
I'm trying to make a web application on Tomcat.
I downloaded source code of a Web Application using JSF, from the site http://www.manning.com/mann/
I put the webapp into Tomcat, tried to lanch the HelloWorld webapp but I encountered the following exception:


javax.servlet.ServletException: Wrapper cannot find servlet class javax.faces.webapp.FacesServlet or a class it depends on................
How may I see which jdk I associated to the Tomcat installation?
Am I to put the JSF Api under Tomcat? If it's so, where can I get them and in which subfolder am I to put them?
Thanks in advance and sorry for my bad english and my lack of experience
Menen
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Menen, welcome to the JavaRanch.

When you create a JSF webapp, you must include the JSF api jar as part of the webapp, and like all library JARs for a J2EE WAR, that means you put a copy of the jsf-api.jar in the webapp's WEB-INF/lib directory.

Tomcat is not JEE 5 compliant, so the actual JSF implementation classes aren't a standard part of Tomcat the way they are in full-fledged JEE servers. So you have to also include the jsf-impl.jar in WEB-INF/lib.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Hello Menen, welcome to the JavaRanch.

When you create a JSF webapp, you must include the JSF api jar as part of the webapp, and like all library JARs for a J2EE WAR, that means you put a copy of the jsf-api.jar in the webapp's WEB-INF/lib directory.

Tomcat is not JEE 5 compliant, so the actual JSF implementation classes aren't a standard part of Tomcat the way they are in full-fledged JEE servers. So you have to also include the jsf-impl.jar in WEB-INF/lib.



Tim,

Thanks for the info on this, I was running in to the same problem as well and got it working. I did also find you needed to run it on 6.0 because 5.5 will cause a separate error.

I'm not sure if this is the proper area, but when I go to the page I created as part of a JSF Example I'm working on, none of the edit boxes, radio buttons, drop downs or buttons I had created seem to be displaying. In Chrome if you highlight it, it seems like the grid layout is there but nothing is showing up. There is a fairly cryptic error at the top of the xhtml file I'm using. The code is:


And the error reads:

Multiple Annotations on this line:
The content of element type must match "(head, body)"
Attribute "xmlns:h" must be declared for element type html
Attribute "xmlns:f" must be declared for element type html



I'm not entirely sure what this means, because it seems those attributes are declared.

Thanks for any help anyone can offer.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The message you got from Tomcat 5.5 was probably because 5.5 JSF webapps also requires the EL jar that's part of Tomcat 6.

I'm not sure about the html error. The first message I think would require being able to see some more of the HTML than just the outermost element. The 2 namespace errors shouldn't be happening if the jsf-api jar is located in the apps classpath, since that's where those definitions are stored.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:The message you got from Tomcat 5.5 was probably because 5.5 JSF webapps also requires the EL jar that's part of Tomcat 6.

I'm not sure about the html error. The first message I think would require being able to see some more of the HTML than just the outermost element. The 2 namespace errors shouldn't be happening if the jsf-api jar is located in the apps classpath, since that's where those definitions are stored.



BTW, it's usually better to start a new thread. Otherwise we sometimes end up with conversations on 2 different subjects and that can not only be confusing, it can make it a little harder for people who use the forum search.
 
Vince Kennedy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

Tim Holloway wrote:The message you got from Tomcat 5.5 was probably because 5.5 JSF webapps also requires the EL jar that's part of Tomcat 6.

I'm not sure about the html error. The first message I think would require being able to see some more of the HTML than just the outermost element. The 2 namespace errors shouldn't be happening if the jsf-api jar is located in the apps classpath, since that's where those definitions are stored.



BTW, it's usually better to start a new thread. Otherwise we sometimes end up with conversations on 2 different subjects and that can not only be confusing, it can make it a little harder for people who use the forum search.


I wasn't totally sure if it was a related issue or not.
 
Menen Zwerky
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I put
I put mojarra-2.0.3 jsf-impl and isf-api libs under WEB-INF/lib of Tomcat 5.5
but with the url http://localhost:8888/hello-world/
So that the exception has changed like that:
javax.servlet.ServletException: Servlet.init() for servlet Faces Servlet threw exception
do you know what it can depend by?
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Menen Zwerky wrote:I put
I put mojarra-2.0.3 jsf-impl and isf-api libs under WEB-INF/lib of Tomcat 5.5
but with the url http://localhost:8888/hello-world/
So that the exception has changed like that:
javax.servlet.ServletException: Servlet.init() for servlet Faces Servlet threw exception
do you know what it can depend by?



I doubt that JSF2 will work on Tomcat 5.5. I think you need at least Tomcat6 for that. It isn't customary for the init() method of FacesServlet to throw exceptions, so there's probably some sort of compatibility problem. More than that I can't say without the stack trace information.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic