Announcement Announcement Module
Collapse
No announcement yet.
Problem with ContextLoaderListener in web.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with ContextLoaderListener in web.xml

    /edit

    problem solved by loading the context manually in my code
    ----------------------------------------------------------------------------------------------------

    Hi guys and girls,

    i am new to spring and my 'project' is to program an webapplication using Wicket->Spring->Hibernate.
    It runs on JBoss Application Server.

    Besides i use a SpringComponentInjector from Wicket to inject the Beans with annotations.

    My problem is about the ContextLoaderListener in my web.xml.

    Code:
    <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value> 
    		     /applicationContext.xml
    		</param-value>
    	</context-param>
    
    <listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    <servlet>
    
    		<servlet-name>wicketApplication</servlet-name>
    		<servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class>
    		<init-param>
    
    			<param-name>applicationClassName</param-name>
    			<param-value>com.mdv.application.WicketWebApplication</param-value>
    
    		</init-param>
    
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>wicketApplication</servlet-name>
    		<url-pattern>/*</url-pattern>
    	</servlet-mapping>


    The thing is, that when i'm using the listener i get an 404 error from jboss and without i get an exception:



    Code:
    exception 
    
    javax.servlet.ServletException: Servlet.init() for servlet wicketApplication threw exception
    	org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
    	org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
    	org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
    	org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
    	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	java.lang.Thread.run(Thread.java:619)
    
    
    root cause 
    
    java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
    	org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:84)
    	org.apache.wicket.spring.injection.annot.SpringComponentInjector.<init>(SpringComponentInjector.java:72)
    	com.mdv.application.WicketWebApplication.init(WicketWebApplication.java:22)
    	org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:724)
    	org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:219)
    	javax.servlet.GenericServlet.init(GenericServlet.java:212)
    	org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
    	org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
    	org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
    	org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
    	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	java.lang.Thread.run(Thread.java:619)

    my simple Webapplication Code (if necessary) is:

    Code:
    public class WicketWebApplication extends WebApplication
    {
    
    
    	public void init(){
    		super.init();
    		addComponentInstantiationListener(new SpringComponentInjector(this));
    		
    	}
    
    	@Override
    	public Class<? extends Page> getHomePage()
    	{
    		
    		return WelcomePage.class;
    	}
    
    }


    Thank you for all hints and advises

    Khrimm
    Last edited by khrimm; Nov 18th, 2010, 04:02 AM.
Working...
X