Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Trouble with JavaServer Faces
Trouble with JavaServer Faces [message #537521] Wed, 02 June 2010 18:19 Go to next message
Brian is currently offline BrianFriend
Messages: 6
Registered: June 2010
Junior Member
Hi,

I'm working through a tutorial located at http://www.vogella.de/articles/JavaServerFaces/article.html without much success. I have Apache 6, Eclipse 3.5, and have download the JSF 1.2 library. That library in included in this project. The jstl-api-.2.jar and the jstl-impl-1.2.jar files (obtained from https://jstl.dev.java.net/download.html) have been added to the directory containing the JSF 1.2 library. They've also been added to the WEB-INF\lib folder for the project. I still get a..

SEVERE: An exception occurred
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config

...error message. Any ideas?

Thanks,
Brian
Re: Trouble with JavaServer Faces [message #537536 is a reply to message #537521] Wed, 02 June 2010 19:12 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 6/2/2010 12:19 PM, Brian wrote:
> Hi,
>
> I'm working through a tutorial located at
> http://www.vogella.de/articles/JavaServerFaces/article.html without much
> success. I have Apache 6, Eclipse 3.5, and have download the JSF 1.2
> library. That library in included in this project. The jstl-api-.2.jar
> and the jstl-impl-1.2.jar files (obtained from
> https://jstl.dev.java.net/download.html) have been added to the
> directory containing the JSF 1.2 library. They've also been added to the
> WEB-INF\lib folder for the project. I still get a..
>
> SEVERE: An exception occurred
> java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
>
> ..error message. Any ideas?
>
> Thanks,
> Brian

It may be helpful for you to read my own notes on Lars' tutorial in
parallel. See

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

Also, if you're having some trouble with just the set-up part, I think

http://www.javahotchocolate.com/tutorials/setup-for-web.html

may give you a leg up and you can skip up to where he creates a new
Dynamic Web Project (getting into the real fun).

Russ Bateman
Re: Trouble with JavaServer Faces [message #537551 is a reply to message #537536] Wed, 02 June 2010 20:49 Go to previous messageGo to next message
Brian is currently offline BrianFriend
Messages: 6
Registered: June 2010
Junior Member
Thanks for the help, Russ. These look like good resources. I'll take a look.
Re: Trouble with JavaServer Faces [message #537811 is a reply to message #537551] Thu, 03 June 2010 17:33 Go to previous messageGo to next message
Brian is currently offline BrianFriend
Messages: 6
Registered: June 2010
Junior Member
Hi Russ,

The companion notes look really good. I've completed the second web app and still have a question. I ran into the HTTP Status 404 error that you warned us about on 5.8 but, unfortunately, trying again did not help. I'm consistently getting the following error...

SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener

I noticed that the red line appears under the

<f:loadBundle basename="de.vogella.jsf.starter.messages" var="msg" />

line in the LoginView.jsp and the Trainer.jsp files (althought Eclispse still lets me try and run the application). The tootip says the the resource bundle cannot be found on classpath. I used the navigator view to place this in the the Java Resources: src folder under de.vogella.usf.starter. So, the Java Resources: src folder contains the following...

de.vogella.jsf.starter.model
de.vogella.jsf.starter.validator
messages.properties
Libraries

Is that correct? Could this be causing the classnotfound error above?

Thanks,
Brian
Re: Trouble with JavaServer Faces [message #537819 is a reply to message #537551] Thu, 03 June 2010 18:02 Go to previous messageGo to next message
Brian is currently offline BrianFriend
Messages: 6
Registered: June 2010
Junior Member
Hi Russ,

The companion notes look really good. I've completed the second web app and still have a question. I ran into the HTTP Status 404 error that you warned us about on 5.8 but, unfortunately, trying again did not help. I'm consistently getting the following error...

SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener

What's weird to me is that when I run the Convertor.jsp, it runs fine...but the exact same red text appears (including the error above) in the console. Does that make sense?

Also, I noticed that the red line appears under the

<f:loadBundle basename="de.vogella.jsf.starter.messages" var="msg" />

line in the LoginView.jsp and the Trainer.jsp files (althought Eclispse still lets me try and run the application). The tooltip says the the resource bundle cannot be found on classpath. I used the navigator view to place this in the the Java Resources: src folder under de.vogella.usf.starter. So, the Java Resources: src folder contains the following...

de.vogella.jsf.starter.model
de.vogella.jsf.starter.validator
messages.properties
Libraries

Is that correct?

Thanks,
Brian
Re: Trouble with JavaServer Faces [message #537827 is a reply to message #537819] Thu, 03 June 2010 19:00 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 6/3/2010 12:02 PM, Brian wrote:
> Hi Russ,
>
> The companion notes look really good. I've completed the second web app
> and still have a question. I ran into the HTTP Status 404 error that you
> warned us about on 5.8 but, unfortunately, trying again did not help.
> I'm consistently getting the following error...
>
> SEVERE: Error configuring application listener of class
> org.apache.myfaces.webapp.StartupServletContextListener
> java.lang.ClassNotFoundException:
> org.apache.myfaces.webapp.StartupServletContextListener
>
> What's weird to me is that when I run the Convertor.jsp, it runs
> fine...but the exact same red text appears (including the error above)
> in the console. Does that make sense?
>
> Also, I noticed that the red line appears under the
>
> <f:loadBundle basename="de.vogella.jsf.starter.messages" var="msg" />
>
> line in the LoginView.jsp and the Trainer.jsp files (althought Eclispse
> still lets me try and run the application). The tooltip says the the
> resource bundle cannot be found on classpath. I used the navigator view
> to place this in the the Java Resources: src folder under
> de.vogella.usf.starter. So, the Java Resources: src folder contains the
> following...
>
> de.vogella.jsf.starter.model
> de.vogella.jsf.starter.validator
> messages.properties
> Libraries
>
> Is that correct?
> Thanks,
> Brian

We should take this off-line if you're just asking me, however, this is
a good question for everyone.

First, the error you show is a problem, perhaps with how Eclipse deploys
to Tomcat, I don't know. I fought it for weeks without success. The only
solution I know of is:


http://www.javahotchocolate.com/tutorials/jsf-notes.html#mis sing-listener

....and it works every time.

Second, don't put too much stock in Eclipse's JSP validation. I often
see errors and warnings where there are none. Often the tagging will no
longer be there after closing and opening and/or, especially, after
bouncing Eclipse.

Hope this helps,

Russ
Re: Trouble with JavaServer Faces [message #538369 is a reply to message #537827] Mon, 07 June 2010 13:33 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
On 6/3/2010 3:00 PM, Russ Bateman wrote:
> On 6/3/2010 12:02 PM, Brian wrote:
>> Hi Russ,
>>
>> The companion notes look really good. I've completed the second web app
>> and still have a question. I ran into the HTTP Status 404 error that you
>> warned us about on 5.8 but, unfortunately, trying again did not help.
>> I'm consistently getting the following error...
>>
>> SEVERE: Error configuring application listener of class
>> org.apache.myfaces.webapp.StartupServletContextListener
>> java.lang.ClassNotFoundException:
>> org.apache.myfaces.webapp.StartupServletContextListener
>>
>> What's weird to me is that when I run the Convertor.jsp, it runs
>> fine...but the exact same red text appears (including the error above)
>> in the console. Does that make sense?
>>
>> Also, I noticed that the red line appears under the
>>
>> <f:loadBundle basename="de.vogella.jsf.starter.messages" var="msg" />
>>
>> line in the LoginView.jsp and the Trainer.jsp files (althought Eclispse
>> still lets me try and run the application). The tooltip says the the
>> resource bundle cannot be found on classpath. I used the navigator view
>> to place this in the the Java Resources: src folder under
>> de.vogella.usf.starter. So, the Java Resources: src folder contains the
>> following...
>>
>> de.vogella.jsf.starter.model
>> de.vogella.jsf.starter.validator
>> messages.properties
>> Libraries
>>
>> Is that correct?
>> Thanks,
>> Brian
>
> We should take this off-line if you're just asking me, however, this is
> a good question for everyone.
>
> First, the error you show is a problem, perhaps with how Eclipse deploys
> to Tomcat, I don't know. I fought it for weeks without success. The only
> solution I know of is:
>
>
> http://www.javahotchocolate.com/tutorials/jsf-notes.html#mis sing-listener
>
> ...and it works every time.
>
> Second, don't put too much stock in Eclipse's JSP validation. I often
> see errors and warnings where there are none. Often the tagging will no
> longer be there after closing and opening and/or, especially, after
> bouncing Eclipse.
>
> Hope this helps,
>
> Russ

Russ,

Are you using the User Library approach to adding the JSF and JSTL jars.
If so, the mysterious "missing listener" could be a new form of Bug
270287[1] where the "contents" of the User Library somehow get cached in
a bad state. I saw this once with Eclipse 3.5.2/WTP 3.1.2 while working
through the tutorial where the jars all went missing from the first
example in the tutorial when I tried to run the second example. I
couldn't make it happen again though. You could try copying the jars to
WEB-INF/lib or referencing the jars directly rather than through a User
Library and see if you still occasionally get the "missing listener"
behavior.

Cheers,
Larry

P.S. For those that try working though the tutorial, I highly recommend
when adding example projects to a Tomcat server that you first stop the
server, add or remove projects as desired, then start the server back
up. It is not unusual to have issues when trying add or remove a
project from the server while it remains running.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=270287
Re: Trouble with JavaServer Faces [message #538385 is a reply to message #538369] Mon, 07 June 2010 14:09 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 6/7/2010 7:33 AM, Larry Isaacs wrote:
> [snip]
>
> Russ,
>
> Are you using the User Library approach to adding the JSF and JSTL jars.
> If so, the mysterious "missing listener" could be a new form of Bug
> 270287[1] where the "contents" of the User Library somehow get cached in
> a bad state. I saw this once with Eclipse 3.5.2/WTP 3.1.2 while working
> through the tutorial where the jars all went missing from the first
> example in the tutorial when I tried to run the second example. I
> couldn't make it happen again though. You could try copying the jars to
> WEB-INF/lib or referencing the jars directly rather than through a User
> Library and see if you still occasionally get the "missing listener"
> behavior.
>
> Cheers,
> Larry
>
> P.S. For those that try working though the tutorial, I highly recommend
> when adding example projects to a Tomcat server that you first stop the
> server, add or remove projects as desired, then start the server back
> up. It is not unusual to have issues when trying add or remove a project
> from the server while it remains running.
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=270287

Yes, Larry, this is exactly what's happening and what I'm doing. I did
try to add the libraries instead under WEB-INF/lib early on and, as I
recall, this did not fix the problem (but there may have been so many
other problems back then). I should now experiment with this solution.

I also find that it's not a bad idea to close projects in the workspace
one is not actively working on if one has many, unrelated ones.

I also do a lot of pre-emptive stopping and cleaning of the server.

I find also that whenever I exit Eclipse or change workspaces, I'm in
for removing, then re-creating the server from scratch before it will
work (both from the Servers view and from the Project Explorer view).

This is annoying, but after weeks of fighting it, just being able to
create and use a Tomcat reliably has been bliss. Two years ago, I gave
up trying to learn JSF for this reason (you answered a number of my
questions back then, but I never reached the point at which I got
anything to work). I was still pretty new at Eclipse and totally new at
WTP. Today, I merrily add pages, debug and run them. JSF life is sweet.

Best,

Russ
Re: Trouble with JavaServer Faces [message #538403 is a reply to message #538369] Mon, 07 June 2010 14:48 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 6/7/2010 7:33 AM, Larry Isaacs wrote:
> [snip]
> You could try copying the jars to
> WEB-INF/lib or referencing the jars directly rather than through a User
> Library and see if you still occasionally get the "missing listener"
> behavior.
>[snip]

I tried this and it didn't work. I was missing all sorts of symbols out
of Java files and JSPs. And, assuming stopping, cleaning and starting
the server doesn't care about red source file decoration, the missing
listener problem was still there. I also tried it with JSF and JSTL JARs
both in Build Path and on the path WEB-INF/lib.

Russ
Re: Trouble with JavaServer Faces [message #538473 is a reply to message #538403] Mon, 07 June 2010 16:51 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
On 6/7/2010 10:48 AM, Russ Bateman wrote:
> On 6/7/2010 7:33 AM, Larry Isaacs wrote:
>> [snip]
>> You could try copying the jars to
>> WEB-INF/lib or referencing the jars directly rather than through a User
>> Library and see if you still occasionally get the "missing listener"
>> behavior.
>> [snip]
>
> I tried this and it didn't work. I was missing all sorts of symbols out
> of Java files and JSPs. And, assuming stopping, cleaning and starting
> the server doesn't care about red source file decoration, the missing
> listener problem was still there. I also tried it with JSF and JSTL JARs
> both in Build Path and on the path WEB-INF/lib.
>
> Russ

Were the jars published as expected for all projects on the server? The
red source file decoration may have been a sign that something was
missing or a project hadn't quite adopted its new configuration and
didn't publish correctly. The only way that makes sense to get a
ClassNotFoundException for the listener is if the jar is missing. This
was the case for me, but it wasn't the project I was working on but for
the one that had worked previously, but was still on the server. There
should be not be any differences with the project with respect to the
Problems view. The effective classpath and what gets published should
be the same. The only difference is the code paths Eclipse takes to
resolve the classpath.

Cheers,
Larry
Re: Trouble with JavaServer Faces [message #538520 is a reply to message #538473] Mon, 07 June 2010 20:03 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 6/7/2010 10:51 AM, Larry Isaacs wrote:
> [snip]
>
> Were the jars published as expected for all projects on the server? The
> red source file decoration may have been a sign that something was
> missing or a project hadn't quite adopted its new configuration and
> didn't publish correctly. The only way that makes sense to get a
> ClassNotFoundException for the listener is if the jar is missing. This
> was the case for me, but it wasn't the project I was working on but for
> the one that had worked previously, but was still on the server. There
> should be not be any differences with the project with respect to the
> Problems view. The effective classpath and what gets published should be
> the same. The only difference is the code paths Eclipse takes to resolve
> the classpath.
>
> Cheers,
> Larry

Only one project in my workspace; only one project known to the server.

I'm not certain why this is only a bug for me when a) clearly, the JAR
and listener inside are NOT missing, and b) it doesn't happen when I
wipe all traces of a server, then create one from scratch which will
work perfectly until the next time I leave the workspace.
Re: Trouble with JavaServer Faces [message #538704 is a reply to message #538520] Tue, 08 June 2010 12:58 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
On 6/7/2010 4:03 PM, Russ Bateman wrote:
> On 6/7/2010 10:51 AM, Larry Isaacs wrote:
>> [snip]
>
> Only one project in my workspace; only one project known to the server.
>
> I'm not certain why this is only a bug for me when a) clearly, the JAR
> and listener inside are NOT missing, and b) it doesn't happen when I
> wipe all traces of a server, then create one from scratch which will
> work perfectly until the next time I leave the workspace.

For it to stop working, something would have to be wrong under the
".metadata\.plugins\org.eclipse.wst.server.core\tmp?" directory. Maybe
you could save a copy of the "tmp?" directory when it next stops working
and compare that to the new working "tmp?" to see if there are any
differences. For a jar to be present but a class it contains can't be
found would imply the jar is corrupted, possibly the work of those gremlins.

Cheers,
Larry
Re: Trouble with JavaServer Faces [message #538748 is a reply to message #538704] Tue, 08 June 2010 14:23 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 6/8/2010 6:58 AM, Larry Isaacs wrote:
> On 6/7/2010 4:03 PM, Russ Bateman wrote:
>> On 6/7/2010 10:51 AM, Larry Isaacs wrote:
>>> [snip]
>>
>> Only one project in my workspace; only one project known to the server.
>>
>> I'm not certain why this is only a bug for me when a) clearly, the JAR
>> and listener inside are NOT missing, and b) it doesn't happen when I
>> wipe all traces of a server, then create one from scratch which will
>> work perfectly until the next time I leave the workspace.
>
> For it to stop working, something would have to be wrong under the
> ".metadata\.plugins\org.eclipse.wst.server.core\tmp?" directory. Maybe
> you could save a copy of the "tmp?" directory when it next stops working
> and compare that to the new working "tmp?" to see if there are any
> differences. For a jar to be present but a class it contains can't be
> found would imply the jar is corrupted, possibly the work of those
> gremlins.
>
> Cheers,
> Larry

Ah! You know about the gremlins in my office! I was trying to keep them
a secret!
Re: Trouble with JavaServer Faces [message #631837 is a reply to message #537521] Sat, 09 October 2010 01:40 Go to previous messageGo to next message
Ajay Chowdary Kandula is currently offline Ajay Chowdary KandulaFriend
Messages: 2
Registered: July 2009
Junior Member
Is there an answer???

Me too Facing the Similar Problem but just keep on Searching

Can some expert show me direction as to what can be done

My Error is

Multiple annotations found at this line:
- Resource bundle de.vogella.jsf.starter.messages
cannot be found on classpath
- Resource bundle de.vogella.jsf.starter.messages
cannot be found on classpath

or

No Solution yet?
Re: Trouble with JavaServer Faces [message #631848 is a reply to message #631837] Sat, 09 October 2010 04:17 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 2010.10.08 19:40, Ajay Chowdary Kandula wrote:
> Is there an answer???
>
> Me too Facing the Similar Problem but just keep on Searching
>
> Can some expert show me direction as to what can be done
>
> My Error is
>
> Multiple annotations found at this line:
> - Resource bundle de.vogella.jsf.starter.messages cannot be found on
> classpath - Resource bundle de.vogella.jsf.starter.messages cannot be
> found on classpath
>
> or
> No Solution yet?

You're having trouble with Lars' tutorial. This has nothing to do with
Eclipse or webtools.

I have done this tutorial myself and carefully reviewed it. You might
benefit from walking through it again, perhaps also referring to my
article at http://www.javahotchocolate.com/tutorials/wtp-jsf.html
Unless something has changed since I did this, the tutorial should still
work and, if there's anything the slightest bit unclear, it will be
covered in my article (unless I did find it unclear).
Re: Trouble with JavaServer Faces [message #631849 is a reply to message #631848] Sat, 09 October 2010 04:27 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2010.10.08 22:17, Russell Bateman wrote:
> [snip]
>
> You're having trouble with Lars' tutorial. This has nothing to do with
> Eclipse or webtools.
>
> I have done this tutorial myself and carefully reviewed it. You might
> benefit from walking through it again, perhaps also referring to my
> article at http://www.javahotchocolate.com/tutorials/wtp-jsf.html
> Unless something has changed since I did this, the tutorial should still
> work and, if there's anything the slightest bit unclear, it will be
> covered in my article (unless I did find it unclear).

I glanced at my review and found two notes on this exact problem. Search
the URL I gave you looking for "5.6. Resource Bundle for Messages".
There is another instance of this too at "6.5. Resource Bundle for
Messages".

The problem is getting messages.properties created in the correct
place--directly under the package de.vogella.jsf.starter. If, when you
created them, they somehow didn't fall there, then you'll get the error
you quote.

Best of luck,

Russ Bateman
Previous Topic:need explanation of org.eclipse.wst.common.component file
Next Topic:Linked resources
Goto Forum:
  


Current Time: Sat Apr 20 09:57:46 GMT 2024

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

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

Back to the top