This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 101689 - Cannot deploy Web application using JSF or VW JSF framework on Tomcat 6 with Java EE5
Summary: Cannot deploy Web application using JSF or VW JSF framework on Tomcat 6 with ...
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Sherold Dev
URL:
Keywords:
: 102400 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-04-19 06:27 UTC by Yousuf Haider
Modified: 2007-06-13 18:20 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Server log (2.65 KB, text/plain)
2007-04-19 06:27 UTC, Yousuf Haider
Details
tomcat console output (35.25 KB, text/plain)
2007-04-19 06:28 UTC, Yousuf Haider
Details
Faces-config.xml Validation errors in simple JSF app (2.03 KB, text/plain)
2007-04-20 18:13 UTC, Yousuf Haider
Details
Faces Config for jsf app (403 bytes, text/plain)
2007-04-20 19:30 UTC, Yousuf Haider
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Haider 2007-04-19 06:27:23 UTC
NBI Build: 200704180000
Tomcat 6.0.10

I am unable to successfully deploy a web application which uses the visual web
server faces framework on Tomcat 6. This problem only occurs when I am using
Java EE5. 

Upon deployment I get an HTTP 500 status error with the following exception:

java.lang.UnsupportedOperationException
	javax.faces.context.FacesContext.getELContext(FacesContext.java:137)
	javax.faces.component.UIViewRoot.setLocale(UIViewRoot.java:888)
com.sun.faces.application.ViewHandlerImpl.createView(ViewHandlerImpl.java:316)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.createView(ViewHandlerImpl.java:203)
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:184)
	com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
	com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)



Steps to recreate:

1. Add a user with manager role in the
"tomcat6_install_directory/conf/tomcat-users.xml" file 
Your file should look something like this:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager"/>
  <role rolename="standard"/>
  <user username="admin" password="adminadmin" roles="standard,manager"/>
</tomcat-users>


2. Add Tomcat 6 in the server nodes by selecting the tomcat home directory and
providing the username and password that was created in step 1.

3. Add the following jars from your "$netbeans/visulaweb1/modules/ext/"
directory to the following  
"$tomcat6/lib/"  :

 -commons-beanutils
 -commons-collections
 -commons-digester
 -commons-fileupload
 -commons-logging
 -javaee
 -jsf-api
 -jsf-impl
 -jstl

Also copy standard.jar from "$netbeans/enterprise4/modules/ext/" and place it in
the the same tomcat lib folder.

4. Due to this bug in tomcat : 

http://www.netbeans.org/issues/show_bug.cgi?id=95700

manually create the 'Catalina/localhost' directory within "$tomcat6/conf/" folder


5. Now create a new Web application in NB and choose Tomcat 6 as the target
server and j2ee version JavaEE5. 

6. Choose the Visual Web Server Faces framework.

7. Now drag a button on the page and try deploying the application.



I've attached the server log and console output.
Comment 1 Yousuf Haider 2007-04-19 06:27:57 UTC
Created attachment 41217 [details]
Server log
Comment 2 Yousuf Haider 2007-04-19 06:28:31 UTC
Created attachment 41218 [details]
tomcat console output
Comment 3 Yousuf Haider 2007-04-20 00:09:03 UTC
Update:
Just tested a web application which uses JavaServer Faces framework with Java
EE5 and the same exception comes up. 
Seems like this is not restricted to Visual Web pack.

Just follow the same steps given above but select JavaServer Faces in step 6 to
recreate the issue.

Once again this problem does not appear when using J2ee 1.4 in both cases.

NB build: Build070419_1
Comment 4 Petr Blaha 2007-04-20 09:12:16 UTC
From Tomcat server log:

SEVERE: Parse Error at line 9 column 116: Document root element "faces-config",
must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "faces-config", must match
DOCTYPE root "null".

Can you try to validate you faces-config.xml?
I try the following scenario in the latest NB 6.0 build:
1) register external Tomcat and use base dir due issue #95700
2) create new JavaEE5 Web project with JSF framework and Tomcat target server
3) due issue #101902 add JSF 1.1 and JSTL on project classpath
4) run application and get welcome screen
Comment 5 Yousuf Haider 2007-04-20 18:13:31 UTC
Created attachment 41359 [details]
Faces-config.xml Validation errors in simple JSF app
Comment 6 Yousuf Haider 2007-04-20 18:19:38 UTC
Same validation error for a visual web JSF app.
Comment 7 Petr Blaha 2007-04-20 19:21:33 UTC
Can you attach the faces-config.xml file? Are you able to reproduce this also
with new Web project with Visual web only? Without any additional steps? We
should find which action broke the faces-config.xml. Thanks
Comment 8 Yousuf Haider 2007-04-20 19:30:22 UTC
Created attachment 41368 [details]
Faces Config for jsf app
Comment 9 Yousuf Haider 2007-04-20 19:52:35 UTC
Yes, if i create a project with Visual Web only the same thing happens.
Validation of the faces-config.xml in that project throws the same error as
attached above.


FYI:
If you do not copy the jar files in the Tomcat/lib folder before creating a
visual web project you might encounter this problem:
http://www.netbeans.org/issues/show_bug.cgi?id=101671



Also I tried the steps you mentioned above for a simple JSF web project and I am
still getting the same problem.

Comment 10 _ potingwu 2007-04-20 21:34:58 UTC
I try to remove and add back the params part of <faces-config> tag:
    version="1.2" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   
        http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">

and seeing the following in the console:
[DTM] removing DE (28968689)["<" (error) <300-300> '']
[DMT] removed element DE (28968689)["<" (error) <300-300> ''] ;parent = DE
(6542348)["faces-config" (tag) <41-1248> '<faces-con...']
[DTM] removing DE (4196701)["..." (content) <301-322> 'managed-be...']
[DMT] removed element DE (4196701)["..." (content) <301-322> 'managed-be...']
;parent = DE (6542348)["faces-config" (tag) <41-1248> '<faces-con...']

Is that possible the cause?
Comment 11 Petr Pisl 2007-04-23 17:13:03 UTC
The problem is how jsf 1.2 is added to the Tomcat, which is the reason why the
parser is not able to find needed dtds and schemas.
When you look at the binary distribution of JSF 1.2_04 (which you can download
from https://javaserverfaces.dev.java.net/) you can see that in the lib folder
there are two jars (jsf api and implementation), 4 dtds and 2 tlds. All these
files has to be on the web application classpath to get the web application
work. jstl.jar is needed as well.

The easiest way is to copy all the files from lib folder from JSF 1.2
distribution into the "$tomcat6/lib/" folder. You have to copy the jstl.jar
there as well. Now you can create new web application with jsf framework ( I
haven't tried the visual jsf framework) and the application should work.

The second way, how to do it, is to put the needed jars and files (dtds, tlds)
directly into the web application. You can add the jsf api, jsf implementation
and jstl.jar as a libraries (context menu over Libraries node - Add Jar/Folder
... ). Copy the dtds and tlds into a folder and add this folder as new library
as well. It means that these files will be putted in the default package. Then
try to run the application.

I'm changing the priority to P2. The right solution for this issue can be done
through bundling jsf 1.2 with NetBeans or convince people from Tomcat to include
an implementation of jsf 1.2.
Comment 12 Yousuf Haider 2007-04-23 17:56:06 UTC
I just tried a visual web app using the instructions above and it works fine. 
NBI Build :200704230000

Comment 13 Pavel Buzek 2007-04-28 05:38:02 UTC
Tomcat is not certified Java EE server because it is only a web container and
thus it does not have to include all the components of Java EE (including JSF)
and IMO intentionally wants to leave the decision which JSF implementation to
use on the user. But users will want to use 2.5 web apps on tomcat 6.

Bundling JSF 1.2 would work, but if we do not bundle tomcat then I think we
should just add a note in UI, for example when adding tomcat 6 to IDE, that will
direct the user to get and install JSF.
Comment 14 Pavel Buzek 2007-04-28 05:43:19 UTC
*** Issue 102400 has been marked as a duplicate of this issue. ***
Comment 15 Lukas Jungmann 2007-04-28 11:15:47 UTC
What about pointing users to http://developers.sun.com/web/swdp/ which contains
also JSF 1.2_03 in its latest versoin (R2)? Once this pack is installed into
Tomcat 6 everything works out of box. And this pack is already required for
users who wants to try REST stuff (but this might change in the future).
Comment 16 Petr Jiricka 2007-04-30 15:45:41 UTC
We already bundle JSF 1.2 anyway.
Comment 17 _ potingwu 2007-06-13 17:57:11 UTC
Since both JSF and Visual Web JSF frameworks bundle JSF 1.2 RI libraries if the target servers don't support JSF, I no
longer seeing this issue. Please change it as fixed after verifying.
Comment 18 Yousuf Haider 2007-06-13 18:07:49 UTC
Issue fixed. Verified on build: 200706110000
Comment 19 Yousuf Haider 2007-06-13 18:20:32 UTC
Fix Verified on build: 200706110000