Skip to main content

JSF 1.1 on GlassFish?

11 replies [Last post]
cmathrusse
Offline
Joined: 2008-04-15
Points: 0

I'm migrating an existing JSF 1.1 application from Tomcat 5.5 to GlassFish v2ru2. The trouble I'm having is that while I can get the application to deploy successfully, it appears that the JSF framework is not initializing or functional when I log into my application. For now, I need to stay on JSF 1.1.

The application web.xml was previously defined as web-app_2_3.dtd so I modified web.xml to comply with web-app_2_5.xsd. I have no erros in the web.xml so I'm reasonably certain that it is valid.

I have the following defined in the web.xml.

javax.faces.application.CONFIG_FILES
/WEB-INF/faces-config.xml

com.sun.faces.config.ConfigureListener

com.sun.faces.application.WebappLifecycleListener

Faces Servlet
javax.faces.webapp.FacesServlet

config
/WEB-INF/faces-config.xml

1

Faces Servlet
*.faces

Is there something else that I must do to get my application to run in the GlassFish container?

Thanks for the help...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
erkancagin
Offline
Joined: 2005-05-15
Points: 0

Does it mean that with JSF 1.2 one can not include subviews (jsp page fragments) programmatically within a custom component?

cmathrusse
Offline
Joined: 2008-04-15
Points: 0

Update:
I think I've narrowed down my issue to a small piece of code. Someone implemented this to perform an include of another page. This is being used when a determination is made pertaining to which tab is selected. Based upon that a specific page was being included with the code listed below and was executed from within the [i]encodeEnd [/i] method.

FacesContext ctx = FacesContext.getCurrentInstance();
VariableResolver vr = ctx.getApplication().getVariableResolver();
ExternalContext ec = fc.getExternalContext();
ServletContext sc = (ServletContext) ec.getContext();
UITabbedPane tabbedPane = (UITabbedPane) component;
String content = tabbedPane.getContent();

ServletRequest request = (ServletRequest) ec.getRequest();
ServletResponse response = (ServletResponse) ec.getResponse();

try {
sc.getRequestDispatcher(content).include(request, response);

} catch (ServletException ex) {
logError(ctx, vr, "Couldn't load page " + content + ": " + ex);

} catch (IOException ex) {
logError(ctx, vr, "Couldn't load page: " + content + ": " + ex);
}

It's my guess that this code should never have been implemented in this fashion but because it is I think that this is the failure in my application.

Any ideas and if so how can I resolve this?

Thanks for the help...

Message was edited by: cmathrusse

rlubke
Offline
Joined: 2003-08-21
Points: 0

One question - does the include target contain JSF components or is it plain jsp or static text?

If it includes JSF components, those components won't be present in the tree.
JSF 1.2 builds and renders the view in two steps to enable proper content interweaving without the need of f:verbatim or f:subview. The first step performs a request dispatch to the page identified in the request. This process builds the tree, but no render calls are made. After the tree is built, then we call renderAll() which will call the appropriate encodeXXX() methods.

In order to resolve this, the include would have to be performed from the view layer when the tree is being built (essentially a jsp:include nested within your tab).

sekhar
Offline
Joined: 2003-06-25
Points: 0

What changed from JSF 1.1 to JSF 1.2 that would cause this change in code behavior ?

driscoll
Offline
Joined: 2003-06-06
Points: 0

Sekhar -

As Ryan mentioned, it's the change to allow interleaving, thus getting rid of the need for the verbatim tag. Or maybe you mean something different?

cmathrusse
Offline
Joined: 2008-04-15
Points: 0

The version that I was bundling was the 1.1_01 RI implementation. Since your last post I removed the jsf-api.jar and the jsf-impl.jar from the applications lib directory so there is no longer any reference to the 1.1 libraries at all. I also removed some entries from the web.xml that were required for the 1.1 implementation. (Based upon documentation I found posted on the internet) So now the application should be relying completely on the GlassFish libraries.

[b][u]web.xml entry:[/u][/b]

Faces Servlet
javax.faces.webapp.FacesServlet
1

I also updated the faces-config.xml file to be compliant with the 1.2 version.
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"
version="1.2">

The end result was the same. The application starts, the tld's are being resolved and my listeners are being invoked but not all of them appear to be rendering. I don't see any exceptions being thrown or logged so I decided to adjust the logging level for the WebContainer to FINEST. While this produces a large amount of output I was hopeful to see something. The only thing I found was a [i]ClassNotFoundException [/i] being logged, but I'm uncertain if it is related.

[#|2008-05-15T10:42:15.109-0700|FINEST|sun-appserver9.1|org.apache.catalina.loader.WebappClassLoader|_ThreadID=24;_ThreadName=httpWorkerThread-4848-0;ClassName=org.apache.catalina.loader.WebappClassLoader;MethodName=findClass;_RequestID=c70ea9cf-500f-4c32-85ba-0be5deed5d1f;| findClassInternal(java.lang.reflect.ProxyBeanInfo)|#]

[#|2008-05-15T10:42:15.109-0700|FINEST|sun-appserver9.1|org.apache.catalina.loader.WebappClassLoader|_ThreadID=24;_ThreadName=httpWorkerThread-4848-0;ClassName=org.apache.catalina.loader.WebappClassLoader;MethodName=loadClass;_RequestID=c70ea9cf-500f-4c32-85ba-0be5deed5d1f;| Delegating to parent classloader1 EJBClassLoader :
urlSet = []
doneCalled = false
Parent -> java.net.URLClassLoader@1429cb2
|#]

[#|2008-05-15T10:42:15.109-0700|FINEST|sun-appserver9.1|org.apache.catalina.loader.WebappClassLoader|_ThreadID=24;_ThreadName=httpWorkerThread-4848-0;ClassName=org.apache.catalina.loader.WebappClassLoader;MethodName=loadClass;_RequestID=c70ea9cf-500f-4c32-85ba-0be5deed5d1f;| Delegating to system classloader at end: EJBClassLoader :
urlSet = []
doneCalled = false
Parent -> java.net.URLClassLoader@1429cb2
|#]

[#|2008-05-15T10:42:15.109-0700|FINEST|sun-appserver9.1|org.apache.catalina.loader.WebappClassLoader|_ThreadID=24;_ThreadName=httpWorkerThread-4848-0;ClassName=org.apache.catalina.loader.WebappClassLoader;MethodName=findClass;_RequestID=c70ea9cf-500f-4c32-85ba-0be5deed5d1f;| --> Passing on ClassNotFoundException|#]

No other exceptiosn appear in the log at all.

cmathrusse
Offline
Joined: 2008-04-15
Points: 0

Yes, I am bundling JSF 1.1_01 within the applications WEB-INF/lib directory. As I stated, the application is dependent upon JSF 1.1 and seeing as GlassFish contains only JSF 1.2 I really have no choice. I can always attempt to remove the 1.1 libraries but I would need to know exactly what to modify in my faces-config.xml and web.xml to utilize the 1.2 libraries.

driscoll
Offline
Joined: 2003-06-06
Points: 0

Sorry to be dense, but in what way is your application tied to JSF 1.1? The list of incompatibilities is pretty small...

What's happening, as I suspect you can guess, is that by bundling JSF 1.1 with your app, you're getting conflicts between the classes already in Glassfish and the one's you're bundling. Also, is the version you are bundling the JSF 1.1 RI, or the MyFaces implementation?

cmathrusse
Offline
Joined: 2008-04-15
Points: 0

Update: Upon further investigation it appears that the tld discovery is functioning correctly. The main page of the application renders some elements that are tld based so I know that the tld's are being located and are executing. I'm a little baffled by all this as I have the application deployed and functional on Tomcat 5.5 without any issues. All the pages render and function correctly so I'm puzzled as to why there is an issue only with GlassFish.

Has anyone else seen this type of behavior previously?

Thanks...

edburns
Offline
Joined: 2004-02-11
Points: 0

Let me first get one thing straight. Are you doing anything to modify the JSF impl in the Glassfish installation? This includes trying to bundle a JSF impl inside your WEB-INF/lib, manually installing a JSF 1.1 installation into your container's lib directory, or other similar measures.

[ ] Yes
[ ] No

Ed

cmathrusse
Offline
Joined: 2008-04-15
Points: 0

As a follow up, I've managed to the the application running a bit. I've been able to verify that some of my Listeners are executing. (Debugging with Eclipse) The problem I seem to be faced with now is that not all of my tlds are being honored. I've looked over all of their definitions and they appear to be correct. (I've verified the namespace on the jsp with that in the tdl)

Originally, these were defined in the web.xml file, which of course I had to remove as this is no longer supported. However, they are defined in my faces-config.xml file and the files reside within the WEB-INF directory. For some reason though, they don't seem to be resolved as they are not being invoked when my page is rendered.

Thanks for the help...