Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JavaServer Faces » UnsupportedOperationException(Running my first JSF project: A blank jsp page in eclipse platform throwing exception :()
UnsupportedOperationException [message #754989] Sun, 06 November 2011 13:29 Go to next message
butny  is currently offline butny Friend
Messages: 28
Registered: November 2011
Junior Member
Hi,

After creating a demo dynamic web project in jsf, when i tried to run the project i am getting this exception. I am not able to understand its root cause.
After clicking finish, when the project is created i run my blank web page and got this exception.

4 Nov, 2011 7:20:15 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.UnsupportedOperationException
at javax.faces.application.Application.getResourceHandler(Application.java:286)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:307)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
4 Nov, 2011 7:21:01 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.UnsupportedOperationException
at javax.faces.application.Application.getResourceHandler(Application.java:286)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:307)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

But its a blank page. I just created a new dynamic web page and tried to run that page, hence i dont think there is some object which is throwing this exception. There might be some jars missing or something related to apache but i am not able to figure it out

Please help


Thanks,
Bunta
Re: UnsupportedOperationException [message #755004 is a reply to message #754989] Sun, 06 November 2011 16:00 Go to previous messageGo to next message
butny  is currently offline butny Friend
Messages: 28
Registered: November 2011
Junior Member
Hi,

I solved the problem by removing the jsf-impl and jsf-api jars from my workspace. With this another problem arises:

When i run this code:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:outputText value="Hello" />
</f:view>
</body>
</html>


Nothing is displayed in the webpage. No exception is thrown at the console.

When i run this code:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<f:view>
Hello
<h:outputText value="Hello" />
</f:view>
</body>
</html>


Then only one hello is displayed.

Right click the webpage---> view source displays this:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:outputText value="Hello" />
</f:view>
</body>
</html>


This means the jsf tags are not rendered properly at runtime.

Please help me out of this.

Thanks,
Butny
Re: UnsupportedOperationException [message #755006 is a reply to message #755004] Sun, 06 November 2011 16:37 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2011.11.06 9:00, butny wrote:
> Hi,
>
> I solved the problem by removing the jsf-impl and jsf-api jars from my
> workspace. With this another problem arises:
>
> When i run this code:
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:h="http://java.sun.com/jsf/html">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> <title>Insert title here</title>
> </head>
> <body>
> <f:view>
> <h:outputText value="Hello" />
> </f:view>
> </body>
> </html>
>
> Nothing is displayed in the webpage. No exception is thrown at the console.
>
> When i run this code:
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:h="http://java.sun.com/jsf/html">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> <title>Insert title here</title>
> </head>
> <body>
> <f:view>
> Hello
> <h:outputText value="Hello" />
> </f:view>
> </body>
> </html>
>
> Then only one hello is displayed.
> Right click the webpage---> view source displays this:
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:h="http://java.sun.com/jsf/html">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> <title>Insert title here</title>
> </head>
> <body>
> <f:view>
> <h:outputText value="Hello" />
> </f:view>
> </body>
> </html>
>
> This means the jsf tags are not rendered properly at runtime.
>
> Please help me out of this.
>
> Thanks,
> Butny

Have you tried following the JSF tutorial at vogella.de? Lars' tutorials
are the best.

At the risk of confusing you, I did some research on JSF and Facelets
you're welcome to. I'm a back-end guy and don't use JSF, but I've tried
mastering it. If interested, look at http://www.javahotchocolate.com/.
Look under the "Other tutorials" menu.
Re: UnsupportedOperationException [message #755046 is a reply to message #755006] Mon, 07 November 2011 07:56 Go to previous messageGo to next message
butny  is currently offline butny Friend
Messages: 28
Registered: November 2011
Junior Member
Hi,

Thanks for the reply. I removed the jstl-api and jstl-impl since i had the myfaces-api.jar and myfaces-impl.jar. But this link:

http://www.javahotchocolate.com/tutorials/jsf-notes.html

reveals that if i use all the jstl-api,jstl-impl,myfaces-api and myfaces-impl jars together then it should not cause any problem, hence i need not to remove the jstl-api and jstl-impl jars.

Then how to solve the problem i am facing? Adding the jstl-api and jstl-impl jars will throw an UnsupportedOperationException exception.

Please help me out of it.

Thanks,
Butny
Re: UnsupportedOperationException [message #755122 is a reply to message #755046] Mon, 07 November 2011 13:20 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2011.11.07 0:57, butny wrote:
> Hi,
>
> Thanks for the reply. I removed the jstl-api and jstl-impl since i had
> the myfaces-api.jar and myfaces-impl.jar. But this link:
>
> http://www.javahotchocolate.com/tutorials/jsf-notes.html
>
> reveals that if i use all the jstl-api,jstl-impl,myfaces-api and
> myfaces-impl jars together then it should not cause any problem, hence i
> need not to remove the jstl-api and jstl-impl jars.
>
> Then how to solve the problem i am facing? Adding the jstl-api and
> jstl-impl jars will throw an UnsupportedOperationException exception.
>
> Please help me out of it.
>
> Thanks,
> Butny

The greatest challenge for me in doing JSF was to get the libraries just
right. This is why I wrote so many articles studying it. The article you
reference isn't an article, but a list of totally random notes I was
collecting early on, some of which may be completely wrong.

Better articles were the ones on RichFaces.

This website is a place where I keep my notes which I try to sanitize so
that they're useful, again, mostly for myself, but also for others if
they care.

Someone else more knowledgeable may come along and help you.
Re: UnsupportedOperationException [message #755171 is a reply to message #755122] Mon, 07 November 2011 15:35 Go to previous messageGo to next message
butny  is currently offline butny Friend
Messages: 28
Registered: November 2011
Junior Member
Hi,

I believe that you can help me out sir, nobody even replied to my thread at least which you did Smile

Please have a look at the attachments displaying the jars i am using. i am sure there is some version problem with the jars which i am unable to sort out.

index.php/fa/6045/0/

index.php/fa/6046/0/

index.php/fa/6047/0/

Please provide some useful suggestions, i am breaking my head since last few days for this. When i run the page, the jsf tags are not getting rendered, but i am not getting any exception in my console as well.

Thanks,
butny
  • Attachment: 3.png
    (Size: 4.89KB, Downloaded 5543 times)
Re: UnsupportedOperationException [message #755173 is a reply to message #755171] Mon, 07 November 2011 15:36 Go to previous messageGo to next message
butny  is currently offline butny Friend
Messages: 28
Registered: November 2011
Junior Member
index.php/fa/6048/0/
  • Attachment: 1.png
    (Size: 25.48KB, Downloaded 5573 times)
Re: UnsupportedOperationException [message #755175 is a reply to message #755173] Mon, 07 November 2011 15:38 Go to previous messageGo to next message
butny  is currently offline butny Friend
Messages: 28
Registered: November 2011
Junior Member
index.php/fa/6049/0/

Please provide your suggestion by having a look at the three attachments.
  • Attachment: 2.png
    (Size: 13.42KB, Downloaded 5562 times)
Re: UnsupportedOperationException [message #755211 is a reply to message #755171] Mon, 07 November 2011 16:39 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 07-Nov-11 08:35, butny wrote:
> Hi,
>
> I believe that you can help me out sir, nobody even replied to my
thread at least which you did
>
> Please have a look at the attachments displaying the jars i am using.
i am sure there is some version problem with the jars which i am unable
to sort out.
>
> Please provide some useful suggestions, i am breaking my head since
last few days for this. When i run the page, the jsf tags are not
getting rendered, but i am not getting any exception in my console as well.
>
> Thanks,
> butny

My suggestion is to abandon MyFaces in favor of RichFaces. Use the
following articles to guide your work and pay especially close attention
to the libraries used:

http://www.javahotchocolate.com/tutorials/wtp-jsf.html (makes use of
another author's tutorial)

http://www.javahotchocolate.com/tutorials/richfaces.html

At the end of the article, there's a list of JAR downloads. What's
gotten more difficult is that Oracle's purchase of Sun has made getting
some JARs more difficult. That appendix should help with this.

There are also two tarballs at the end of the "Usefule links" appendix
you could download that are projects from my own workspaces. Setting
them up and playing with them will help you figure some things out
(you'll have to add the indicated JARs in by hand since they're not in
the projects).

This undertaking is not painless; I know first-hand. Unfortunately, I
don't have time to do quite the job Lars did with his tutorial. I did
enough to get a lot of stuff working and I know I can go back if I ever
need to and get it all working again. But, I think my information will
help you cut the months I spent off and on figuring this stuff out down
to a few hours or days.

Sorry it's not easier. Based on what you've written so far, I don't
think, however, that you've invested much time in working tutorials,
especially the one I suggested from vogella.de, or in reading my
articles closely or you wouldn't ask this question. I specifically
discuss the problem it is to find JARs that inter-cooperate and display
throughout the articles on JSF and Facelets several working sets that
accomplish this.
Re: UnsupportedOperationException [message #755383 is a reply to message #755171] Tue, 08 November 2011 10:28 Go to previous messageGo to next message
Wolfgang Knauf is currently offline Wolfgang KnaufFriend
Messages: 63
Registered: July 2009
Member
Hi Butny,

which server do you use? I assume it is a Tomcat? For the list of
included JARs: it is always a problem to bundle JARs which are already
part of your server.
I suggest to remove e.g. "servlet-api.jar" from your "lib" directory.
Don't bundle things which can be found e.g. in "common\lib" of your
tomcat installation. They can cause conflicts.
I am not sure whether tomcat already bundles a JSF implemention, but I
assume you have to deploy a jsf implementation as part of your app.

Do you have a "faces-config.xml" in your project?

Do you include the FacesServlet in "web.xml"?
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>

Your jsp pages have to contain a "taglib" for the JSF libraries - e.g.
like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>


And finally? How do you call your JSF? Don't make a call to
"mypage.jsp", but use the extension you decalred in web.xml, e.g.
"mypage.faces" => this will be redirected to your JSP.

Hope this helps

Wolfgang


Am 07.11.2011 16:35, schrieb butny:
> Hi,
>
> I believe that you can help me out sir, nobody even replied to my thread at least which you did :)
>
> Please have a look at the attachments displaying the jars i am using. i am sure there is some version problem with the jars which i am unable to sort out.
>
>
>
>
>
>
>
> Please provide some useful suggestions, i am breaking my head since last few days for this. When i run the page, the jsf tags are not getting rendered, but i am not getting any exception in my console as well.
>
> Thanks,
> butny
Re: UnsupportedOperationException [message #755461 is a reply to message #755383] Tue, 08 November 2011 15:21 Go to previous messageGo to next message
butny  is currently offline butny Friend
Messages: 28
Registered: November 2011
Junior Member
Hi,

I removed the servlet-api.jar, had to add the jstl-api and jstl-impl jars in a new user library named "JSTL" and it works fine for me, hence i can say that it was a jar collision. But thats only one part of the story, may be the begining of a new one. I was using two eclipse versions parallely for checking if there is some problem with my eclipse or not. Now the setup is working fine in Indigo but the same thing is not working Helios. Still in Helios, the jsf tags are not getting rendered. I am surprised about this.

The only difference i can see between the helios and indigo one is that in indigo, there is the use of @taglib as Wolfgang showed whereas in helios, this is used:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html">


May be i am missing something in helios which is causing me not to render the jsf tags when the page is run Sad

Please provide your suggestions on how to run the helios "hello world" jsf project.

@Russell

Thanks for your guidance and the links you shared, i am really very interested in reading all the links you shared and will surely get back to you for solving some other problems that i face in learning this JSF.

@Wolfgang

Your ideas really worked like you said about the jar collision (i.e, servlet-api.jar). But i need to ask you a question which i cant understand in your reply.

Q. My url-pattern in web.xml is like this: /faces/*

If i change it to the one you mentioned then what are th advantagges/disadvantages i am going to face? again, if i change it to the one you mentioned, then how to create a file with an extension of .faces? I cant see any option in my ide to create a file with extension of .faces Sad Please inform how to do it.

Thanks,
Butny
Re: UnsupportedOperationException [message #755489 is a reply to message #755461] Tue, 08 November 2011 16:15 Go to previous message
Wolfgang Knauf is currently offline Wolfgang KnaufFriend
Messages: 63
Registered: July 2009
Member
Hi,

> Q. My url-pattern in web.xml is like this: /faces/*
>
> If i change it to the one you mentioned then what are th
> advantagges/disadvantages i am going to face? again, if i change it to
> the one you mentioned, then how to create a file with an extension of
> .faces? I cant see any option in my ide to create a file with extension
> of .faces :( Please inform how to do it.
>
my URL pattern was just one sample, you have a different sample. That's
all fine ;-).
I think whenever you call an URL which matches the URL pattern, the JSF
servlet will handle the URL first and will try to find a matching JSP file.
So, for my sample: calling "mypage.faces" will trigger the JSF
framework, which will then search a file "mypage.jsp" (replace the URL
extension ".faces" with ".jsp") and render it's content.
Your URL pattern should work in a similar way I think:
"http://myhost/mywebapp/faces/somepage.jsp" will trigger the JSF
framework and will then render "somepage.jsp".

So, in both cases, you will create JSP files in the Eclipse project.

I am not sure about it, but I think the URL stuff might get different if
you use advanced JSF techniques like Facelets...

Best regards

Wolfgang
Previous Topic:newbie
Next Topic:problem with a <h:selectOneRadio
Goto Forum:
  


Current Time: Thu Mar 28 19:15:34 GMT 2024

Powered by FUDForum. Page generated in 0.03162 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top