-
1. Re: spring mvc dispatcher servlet mapping
nickarls Nov 29, 2012 6:43 AM (in response to tramwai)And you have disabled the standard / context app and your app deployes fine?
-
2. Re: spring mvc dispatcher servlet mapping
tramwai Nov 29, 2012 6:48 AM (in response to nickarls)you mean this
<virtual-server name="default-host" enable-welcome-root="false">
?
Seams fine, i don't see any exceptions
-
3. Re: spring mvc dispatcher servlet mapping
nickarls Nov 29, 2012 6:54 AM (in response to tramwai)And you see WebApplicationInitializer being called?
(just guessing here, I'm not really a Spring-user)...
-
4. Re: spring mvc dispatcher servlet mapping
tramwai Nov 29, 2012 7:06 AM (in response to nickarls)when deploying i see :
(MSC service thread 1-1) Spring WebApplicationInitializers detected on classpath: [me.myself.resttest.config.WebConfig@195d568]
but i dont see calls to dispatcher servlet when accessing my app through browser
-
5. Re: spring mvc dispatcher servlet mapping
tramwai Nov 30, 2012 4:21 AM (in response to tramwai)Does jboss 7 support web.xml-less web-applications? Because i tried web.xml equal to my WebConfig and everything worked. Isnt this standart servlet 3.0 stuff?
I also downloaded nightly build and i'm having same problem there. Help me out please.
-
6. Re: spring mvc dispatcher servlet mapping
nickarls Nov 30, 2012 4:34 AM (in response to tramwai)Yes, I think it should work since Servlet 3.0 made web.xml optional
-
7. Re: spring mvc dispatcher servlet mapping
tramwai Nov 30, 2012 4:49 AM (in response to nickarls)Nicklas, is there any public source code that doesn't use web.xml (utilizes spring mvc preferably) and works on jboss 7?
-
8. Re: spring mvc dispatcher servlet mapping
nickarls Nov 30, 2012 5:09 AM (in response to tramwai)not sure about the spring-thing but if you make a foo.war with a META-INF/classes and a
@WebServlet(urlPatterns="/test")
public class Test extends HttpServlet
{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
resp.getWriter().println("1-2-3 testing");
}
}
you should be able to access it
-
9. Re: spring mvc dispatcher servlet mapping
xdury Oct 11, 2013 10:30 AM (in response to tramwai)I've got the same problem, I'm using Spring's AbstractAnnotationConfigDispatcherServletInitializer which should take care of registering the DispatcherServlet dynamically (not in web.xml).
I can see that DispatcherServlet is registered but anything that should be rendered via this servlet results in 404. Only static resources are available.
16:21:53,634 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/project]] (ServerService Thread Pool -- 68) Spring WebApplicationInitializers detected on classpath: [my.company.project.MyInitializer@61bc4984]
16:21:53,783 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/project]] (ServerService Thread Pool -- 68) Initializing Spring FrameworkServlet 'dispatcher'
... spring blah blah blah ...
16:21:54,896 INFO [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 68) FrameworkServlet 'dispatcher': initialization completed in 1111 ms
16:21:55,059 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018565: Replaced deployment "project.war" with deployment "project.war"
This is really strange because the same application runs fine in Tomcat 7 and Jetty 8,9...
Xavier
-
10. Re: spring mvc dispatcher servlet mapping
ctomc Oct 12, 2013 5:20 PM (in response to xdury)what is spring version?
-
11. Re: spring mvc dispatcher servlet mapping
vidmantas.banaitis Feb 17, 2015 3:28 AM (in response to tramwai)1 of 1 people found this helpfulHi, all.
Had the same problem minutes ago. What resolved was changing dispathcer mapping from "/" to "/*"
public class WebConfig implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.register(ApplicationContext.class);
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(rootContext));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/*");
servletContext.addListener(new ContextLoaderListener(rootContext));
}
}
}
Hope this helps;
Vidmantas
-
12. Re: spring mvc dispatcher servlet mapping
jewel14878210.eed02 Jan 28, 2019 10:42 PM (in response to vidmantas.banaitis)The problem puzzled me for few days and this solution totally resolve it. Thank you!