Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » JSF and Eclipse aren't the best of mates
JSF and Eclipse aren't the best of mates [message #214028] Mon, 19 May 2008 20:47 Go to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3131
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

I have created a Dynamic Web Project with JSF and have three files:

start.jsp (which forwards to)
login.jsp (which conducts a log-in using a form, and forwards to)
welcome.jsp

and I've got a bean in there too.

Since Eclipse won't bundle the Jakarta JARs for me, put them into my
project, etc., I created a library named JSF via right-clicking on my
project, choosing Preferences, then Java Build Path->Libraries. There
I've got

jsf-api.jar
jsf-impl.jar
jstl.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-logging.jar

Running by right-clicking on start.jsp and choosing Run As... I get and
HTTP status 500:

org.apache.jasper.JasperException: The absolute uri:
http://java.sun.com/jsf/core cannot be resolved in either web.xml or the
jar files deployed with this application

So, I copy all these JARs onto the path
<workspace><project-name>/WebContent/WEB-INF/lib and run again--same result.

Could someone explain why Eclipse doesn't help me put together a JSF
project (when NetBeans makes it PERFECTLY transparent and a no-brainer)
and, therefore, how a JSF project is built in Eclipse.

I have read and attempted a couple of on-line tutorials on JSF and
Eclipse. They don't work and break down part-way through the exercise.

Russ Bateman
Re: JSF and Eclipse aren't the best of mates [message #214079 is a reply to message #214028] Tue, 20 May 2008 16:15 Go to previous messageGo to next message
Cameron Bateman is currently offline Cameron Bateman
Messages: 480
Registered: July 2009
Senior Member
Hi Russ,


> project, choosing Preferences, then Java Build Path->Libraries. There

Please see the JSF tutorial at
http://www.eclipse.org/webtools/jsf/docs/tutorial/JSFTools_1 _0_tutorial.html.
It needs to be updated for some minor UI changes, but demonstrates how to
create a JSF library. If you add the library to an existing project, also
ensure that you right-click on the project properties, go to J2EE Module
Dependencies and ensure the libraries are checked for deployment. (Note
the property dialog is called Java EE Module Dependencies if you are
working with a newer version).

> Could someone explain why Eclipse doesn't help me put together a JSF
> project (when NetBeans makes it PERFECTLY transparent and a no-brainer)
> and, therefore, how a JSF project is built in Eclipse.

We do provide help in the New Dynamic Web Project if you select our facet.
Our facet install page lets you customize what runtime, additional jars
and some basic web.xml configurations will be used. This is also shown in
the tutorial.

> I have read and attempted a couple of on-line tutorials on JSF and
> Eclipse. They don't work and break down part-way through the exercise.

Can you point me to these tutorials so I can try and get them corrected?


Regards,

Cameron
Re: JSF and Eclipse aren't the best of mates [message #214169 is a reply to message #214079] Thu, 22 May 2008 01:00 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3131
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

Cameron Bateman wrote:
> Hi Russ,
>
>
>> project, choosing Preferences, then Java Build Path->Libraries. There
>
> Please see the JSF tutorial at
> http://www.eclipse.org/webtools/jsf/docs/tutorial/JSFTools_1 _0_tutorial.html.
> It needs to be updated for some minor UI changes, but demonstrates how
> to create a JSF library. If you add the library to an existing project,
> also ensure that you right-click on the project properties, go to J2EE
> Module Dependencies and ensure the libraries are checked for deployment.
> (Note the property dialog is called Java EE Module Dependencies if you
> are working with a newer version).
>
>> Could someone explain why Eclipse doesn't help me put together a JSF
>> project (when NetBeans makes it PERFECTLY transparent and a
>> no-brainer) and, therefore, how a JSF project is built in Eclipse.
>
> We do provide help in the New Dynamic Web Project if you select our
> facet. Our facet install page lets you customize what runtime,
> additional jars and some basic web.xml configurations will be used.
> This is also shown in the tutorial.
>
>> I have read and attempted a couple of on-line tutorials on JSF and
>> Eclipse. They don't work and break down part-way through the exercise.
>
> Can you point me to these tutorials so I can try and get them corrected?
>
>
> Regards,
>
> Cameron

Cameron,

Thanks for your reply. (Okay, not a genealogy forum, so I won't ask ;-)

Yes, this tutorial was in fact the best one and the one on which I had
founded my hopes. I did this some three or four weeks ago already, and
all went fine until I started to type in the login and welcome JSPs. I
started getting red flags at that point. There were a couple of
important typos which I corrected. At the time, it was my first foray
into JSF and I was completely in the fog. Now, however, I have done
this a bit (albeit in NetBeans) and would probably have a lot more clues,
so I need to try this again. Probably in a day or two with my present
schedule. I'll keep perfect notes on what happens so that I can
communicate anything useful to you.

Yeah, I would have thought that if my bean compiled cleanly, the 3 JSPs
correct (as demonstrated using NetBeans and later deployed to my
production server) and the web.xml done right, this should work. However,
only today I discovered that the sample app I wrote and ported from
NetBeans back to Eclipse (I insist on conquering Eclipse over this
matter) suffers from a practice I got out of G&H: Core JavaServer Faces
and isn't much used anymore (url-pattern*.faces in place of /faces/*).
So, that might be a problem too.

Now, are you telling me a JSF app practically cannot be done by hand in
Eclipse and that I must use a Dynamic Web Project? That's what I used,
but at the point at which (in the tutorial) I was supposed to create
the library, I didn't have the files, so I finished creating the
project and went back to create them via Preferences->Java Build
Path->Libraries.

Second, don't the JARs need to find their way down under
WebContent/WEB-INF/lib? Eclipse didn't put them there, so I tried
it, but this didn't help.

I'll try this tutorial again now that I'm not so clueless and let
you know.

Thanks,

Russ Bateman
Re: JSF and Eclipse aren't the best of mates [message #214235 is a reply to message #214079] Fri, 23 May 2008 18:20 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3131
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

Cameron Bateman wrote:
> Hi Russ,
>
>
>> project, choosing Preferences, then Java Build Path->Libraries. There
>
> Please see the JSF tutorial at
> http://www.eclipse.org/webtools/jsf/docs/tutorial/JSFTools_1 _0_tutorial.html.
> It needs to be updated for some minor UI changes, but demonstrates how
> to create a JSF library. If you add the library to an existing project,
> also ensure that you right-click on the project properties, go to J2EE
> Module Dependencies and ensure the libraries are checked for deployment.
> (Note the property dialog is called Java EE Module Dependencies if you
> are working with a newer version).
>
>> Could someone explain why Eclipse doesn't help me put together a JSF
>> project (when NetBeans makes it PERFECTLY transparent and a
>> no-brainer) and, therefore, how a JSF project is built in Eclipse.
>
> We do provide help in the New Dynamic Web Project if you select our
> facet. Our facet install page lets you customize what runtime,
> additional jars and some basic web.xml configurations will be used.
> This is also shown in the tutorial.
>
>> I have read and attempted a couple of on-line tutorials on JSF and
>> Eclipse. They don't work and break down part-way through the exercise.
>
> Can you point me to these tutorials so I can try and get them corrected?
>
>
> Regards,
>
> Cameron

Cameron,

I've gotten back to this tutorial.

Here's what I've got with bright, red errors:

http://www.windofkeltia.com/j2ee/tut-images/jsf-tutorial-bur n1.jpg



The libraries I suspect have something to do with all of this:
http://www.windofkeltia.com/j2ee/tut-images/jsf-tutorial-bur n-sun-ri.jpg



Now, mind you, I see "missing" written all over this last image, but I
swear to you that I just now redid SUN-RI and JSTL with JARs that very
much do exist in a subfolder I created in my workspace (and, the old
places I had gotten them from existed and still exist too, yet I rebuilt
them precisely because Eclipse said, "missing"). Clearly, Eclipse is
doing something after I create the libraries to render them invalid. If
I'm supposed to put them somewhere special, let the tutorial or Eclipse
(or both of them) plainly state that.

Does this show you what's going on? What I've done wrong?

Russ
Re: JSF and Eclipse aren't the best of mates [message #214403 is a reply to message #214235] Tue, 27 May 2008 19:10 Go to previous message
Cameron Bateman is currently offline Cameron Bateman
Messages: 480
Registered: July 2009
Senior Member
The "missing library" message indicates that the container for the library
is still known, but the jar(s) that it points to no longer do. Best thing
to do would probably be to delete the containers marked "missing" and
create new ones.

Rather than using User Libraries for your JSF libraries, try using the JSF
Library feature (this is shown in the Register JSF Libraries portion of
the tutorial). Once you have created the JSF library containers, also
open Project->Properties...->J2EE Module Dependencies (it is called Java
EE Module Dependencies in a new builds) and ensure that they are checked
for deployment. Checking them in the Module Dependences will
automatically cause the jars to be copied to your WEB-INF/lib when you
launch the server.

The compile time (user libraries or JSF Libraries) has been intentionally
made separate from runtime (i.e. using J2EE Module Dependencies or
manually copying to WEB-INF/lib), since larger applications sometimes have
system libraries that are always present, so not every application needs
them at in the deployed war/ear but they are still needed at compile time
to get a build.


--Cam
Previous Topic:reusable common web project
Next Topic:Re: WTP Project construction question
Goto Forum:
  


Current Time: Mon Jul 28 18:39:24 EDT 2014

Powered by FUDForum. Page generated in 0.02515 seconds