File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes ListenerStart Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ListenerStart Error" Watch "ListenerStart Error" New topic
Author

ListenerStart Error

Kai Karius
Greenhorn

Joined: Feb 03, 2009
Posts: 7
Hi Guys,

ok, i wrote a listener, here it is:



Its from the HF Servlet and JSP as some of you will guess. Its deployed in [tomcat]/webapps/Listener/WEB-INF/com/example. The DD is such:



Its deployed in tomcat]/webapps/Listener/WEB-INF

Now upon startup Tomcat 5 tells me very inconclusive stuff:

08.02.2009 17:52:48 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
08.02.2009 17:52:48 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
08.02.2009 17:52:49 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
08.02.2009 17:52:49 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
08.02.2009 17:52:50 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
08.02.2009 17:52:50 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
08.02.2009 17:53:37 org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
08.02.2009 17:53:39 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
08.02.2009 17:53:39 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
08.02.2009 17:53:42 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
08.02.2009 17:53:42 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
08.02.2009 17:53:42 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Error configuring application listener of class com.example.MyServletContextListener
java.lang.ClassNotFoundException: com.example.MyServletContextListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3786)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
08.02.2009 17:53:42 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Skipped installing application listeners due to previous error(s)
08.02.2009 17:53:44 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
08.02.2009 17:53:44 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()

Where seems to be the error?

TWERP
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Kai Karius wrote:
java.lang.ClassNotFoundException: com.example.MyServletContextListener

The mentioned class is missing in the classpath of the runtime environment. Add it to the classpath of the runtime environment.
Kai Karius
Greenhorn

Joined: Feb 03, 2009
Posts: 7
The mentioned class is missing in the classpath of the runtime environment. Add it to the classpath of the runtime environment.


True. But it IS there, i will give you an overview of my deployment structure:

[tomcat]/webapps/Listener/WEB-INF/web.xml
[tomcat]/webapps/Listener/WEB-INF/com/example/Dog.class
tomcat]/webapps/Listener/WEB-INF/com/example/MyServletContextListener.class
tomcat]/webapps/Listener/WEB-INF/com/example/ListenerTester.class

So, whats the matter?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Maybe a typo, or actually a wrong location, or server isn't restarted.

Point is: class cannot be found in the classpath. Triplecheck everything.
Mike Kaufman
Greenhorn

Joined: Mar 17, 2008
Posts: 9
Shouldn't the class files be in WEB-INF/classes, rather than directly in root of WEB-INF?

i.e. I think it should be [tomcat]/webapps/Listener/WEB-INF/classes/com/example/MyServletContextListener.class

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61747
    
  67

Mike Kaufman wrote:Shouldn't the class files be in WEB-INF/classes

Ding ding ding. The man gets a cigar.

If you don't put the class files in the right place, no worky!


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kai Karius
Greenhorn

Joined: Feb 03, 2009
Posts: 7
Sigh. Yes. That was it.

Thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ListenerStart Error