Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat/Hibernate Problem "SEVERE: Error listenerStart"

I downloaded working example of hibernate (with maven) and installed it on my tomcat, it worked. Then I created a new web project in MyEclipse, added hibernate support and moved all source files (no jar) to this new project and fixed package/paths wherever was necessary. My servlets are responding correctly but when I add "Listener" in web.xml, tomcat returns error "Error ListenerStart" on startup and my application doesn't start.
I've carefully checked all packages, paths and classes, they look good. Error message is also not telling anything more except these two words Here is complete tomcat startup log:

17-Jun-2010 12:13:37 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8810
17-Jun-2010 12:13:37 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 293 ms
17-Jun-2010 12:13:37 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
17-Jun-2010 12:13:37 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
17-Jun-2010 12:13:37 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
17-Jun-2010 12:13:37 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/addressbook] startup failed due to previous errors
17-Jun-2010 12:13:37 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8810
17-Jun-2010 12:13:37 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
17-Jun-2010 12:13:37 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/22  config=null
17-Jun-2010 12:13:37 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 446 ms

My web.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <listener>
        <listener-class>addressbook.util.SessionFactoryInitializer</listener-class>
    </listener>

    <filter>
        <filter-name>Session Interceptor</filter-name>
        <filter-class>addressbook.util.SessionInterceptor</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>Session Interceptor</filter-name>
        <servlet-name>Country Manager</servlet-name>
    </filter-mapping>

    <servlet>
        <servlet-name>Country Manager</servlet-name>
        <servlet-class>addressbook.managers.CountryManagerServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>Country Manager</servlet-name>
        <url-pattern>/countrymanager</url-pattern>
    </servlet-mapping>

</web-app>

Can somebody either help me figure out what I am doing wrong? or point to some resource where I may get some precise solution of my problem?

like image 895
WSK Avatar asked Jun 17 '10 16:06

WSK


1 Answers

Sequence of filter and servlet in web.xml was wrong. I moved servlet before filter and the problem is fixed

like image 143
WSK Avatar answered Nov 15 '22 11:11

WSK