File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes need help configuring tomcat with eclipse (and icefaces or richfaces) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "need help configuring tomcat with eclipse (and icefaces or richfaces)" Watch "need help configuring tomcat with eclipse (and icefaces or richfaces)" New topic

need help configuring tomcat with eclipse (and icefaces or richfaces)

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 484

I am having stange issues. Most dynamic web projects I create I can open at localhost. But when I try to use the richfaces or icefaces libraries I get a 404 error, telling me the requested resource() is unavailable. I gave up on richfaces after two solid days of trying to fix this. So I went on to IceFaces, which I actually like more anyhow, but I still have the same problem - It is infuriating!

I seem to have a lot of problems looking at my projects on localhost when using tomcat. I followed the instructions here to setup tomcat:

When trying to remove projects from the server I always get errors telling me that some file in the .metadata folder is in use and can't be deleted, but I have no idea if this is part of the problem at all.

So I guess I'm wanting to know if I should configure tomcat differently, or if anyone else has similar issues or tips that might help me here? I don't even know what other info to post here that might help, so if more is needed let me know please.

edit: I don't believe the problem lies with richfaces or icefaces either. I get no errors or warnings when I compile. Plus IceFaces came with a nice plug in that helps you set up that libarary in eclipse, so I am sure that it has all been done correctly.

I can create a simple icefaces project that does not even use any of the icefaces components, just a page that says hello or something and it still will not open at localhost. I just don't know what else to post, I'm at a loss. I have tried multiple forums and threads worded in many different ways but no one seems to have any ideas on this.

True wisdom is in knowing you know nothing - Socrates
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

My suspicion is that when you say "dynamic web project", you may be saying you just copy stuff into the Tomcat webapps directory tree.

IceFaces and RichFaces are built on JSF and JSF doesn't set up that easy. A 404 error means you haven't defined the proper web application context needed to access the page you want at the URL you're supplying.

An IDE is no substitute for an Intelligent Developer.
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 484

No, what I mean by that is I go to file->new->dynamic web project, and then follow the three screens that I get to setup a project. ANd when I say I add the apps to tomcat I mean I right click on the tomcat server from the project explorer, and select add/remove projects.

Here is what I do when creating a new project:

On the first screen:
For Target Runtime I use Apache 6
Dynamic web module version 2.5
Configuration - IceFaces Facelet Project (This option appeared when I downloaded the IceFaces for Eclipse plug in)

The second screen I leave as is

The third screen:
JSF libraries - Sun JSF RI v1.2_12 (implementation)(deployed)
component libraries - apache commons library and ICEFACEs library v1.8.0 (both deployed)(sometimes I will not use the apache commons library)

Then I hit finish. The project is created just fine, I can create a page with icefaces components and I get no errors at all, but then when I try to open it at local host or just compile it in eclipse I get a few SEVERE exceptions in the log.

I searched for ways to fix the exceptions, and one solution said to just copy and paste all the necessary JARs (which I found a list of) into tomcat/lib folder. Still no luck, the exact same problem over and over.

edit: the log:

SEVERE: Error configuring application listener of class com.icesoft.faces.util.event.servlet.ContextEventRepeater
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.icesoft.faces.util.event.servlet.ContextEventRepeater.<clinit>(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at java.lang.Class.newInstance0(
at java.lang.Class.newInstance(
at org.apache.catalina.core.StandardContext.listenerStart(
at org.apache.catalina.core.StandardContext.start(
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(
at org.apache.catalina.startup.HostConfig.deployDescriptor(
at org.apache.catalina.startup.HostConfig.deployDescriptors(
at org.apache.catalina.startup.HostConfig.deployApps(
at org.apache.catalina.startup.HostConfig.start(
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardHost.start(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardEngine.start(
at org.apache.catalina.core.StandardService.start(
at org.apache.catalina.core.StandardServer.start(
at org.apache.catalina.startup.Catalina.start(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.catalina.startup.Bootstrap.start(
at org.apache.catalina.startup.Bootstrap.main(
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
... 31 more
May 1, 2009 12:48:10 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
May 1, 2009 12:48:10 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 1, 2009 12:48:10 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/iftest] startup failed due to previous errors
May 1, 2009 12:48:10 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
May 1, 2009 12:48:10 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
May 1, 2009 12:48:10 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-80
May 1, 2009 12:48:10 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /
May 1, 2009 12:48:10 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/16 config=null
May 1, 2009 12:48:10 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 950 ms
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Oh. An Eclipse dunamic web project.

In some ways, that's even worse than just dumping stuff into CATALINA_HOME/webapps. It allows you to be totally ignorant of what all goes into an enterprise-grade webapp and sooner or later they all break. I'm particlulary miffed at the Eclipse Maven plugin right now, but I've never gotten any of the ORM wizards to give me satisfaction despite having worked with ORM since before those wizards were created.

I just did a quick run-through on my own system, minus the IceFaces plug-in. Nothing obviously wrong there, but I didn't actually go all the way through to deploy/run.

You say sometimes you don't include the "apache commons" library, but in point of fact there are several apache-commons libraries, and the NoClassDefFoundError is referring to a class that's in the apache commons-logging JAR. If that jar wasn't deployed in the WEB-INF/lib directory of the generated WAR, you'd have that problem.

There's an additional point of concern in that you're getting a NoClassDefFound and not ClassNotFound. I [b]think[/i] that's because of dynamic classloading, but I can't be sure. NoClassDefFound is a little harder for me to debug. Although that's probably just me.

IceFaces, like most good Java frameworks and support packages using a logging subsystem to allow reporting to a routable destination (unlike System.out.println, which can be unpredictable). Other benefits of logging include timestamps and class-of-origin indicators attached to the messages. Plus you can enable debugging without recompiling just by changing the logging configuration.

Actually, since there are several different logging systems available, there's also a set of meta-logging packages that allow modules using different logging systems to all play well together. Apache commons logging is one such meta-logging package.
I agree. Here's the link:
subject: need help configuring tomcat with eclipse (and icefaces or richfaces)
It's not a secret anymore!