• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ListenerStart Error

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe a typo, or actually a wrong location, or server isn't restarted.

Point is: class cannot be found in the classpath. Triplecheck everything.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!
 
Kai Karius
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sigh. Yes. That was it.

Thank you!
 
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic