I am trying since few hours to bring this simple application to work on wildfly 12, which was working fine on tomcat. Any how below is log and config
Webappinitializer
@Configuration
public class ListenerConfig implements WebApplicationInitializer{
@Override
public void onStartup(final ServletContext servletContext) throws ServletException {
final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
root.setServletContext(servletContext);
root.scan("com.app");
root.refresh();
final Dynamic servlet = servletContext.addServlet("spring", new DispatcherServlet(root));
servlet.setLoadOnStartup(1);
servlet.addMapping("/*");
servletContext.addListener(new ContextLoaderListener(root));
}
ApplicationConfig
@Configuration
@ComponentScan(basePackages = "com.app")
@PropertySource(value = { "classpath:jdbc.properties" })
@EnableTransactionManagement
public class ApplicationConfig {
MVCConfig
@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter{
@Override
public void configureMessageConverters( List<HttpMessageConverter<?>> converters ) {
converters.add(converter());
}
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setViewClass(JstlView.class);
viewResolver.setPrefix("/WEB-INF/views/");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
@Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/html/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="javax.api"/>
<module name="javax.jms.api"/>
<module name="javax.servlet.api"/>
<module name="org.apache.log4j"/>
<module name="pluto.lib" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Note I haven't provided complete code, if required will post it.
Finally what I get in log is below
22:36:39,374 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS] 22:36:40,290 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443 22:36:40,504 INFO [org.jboss.ws.common.management] (MSC service thread 1-3) JBWS022052: Starting JBossWS 5.2.0.Final (Apache CXF 3.2.2) 22:36:43,005 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-4) ISPN000128: Infinispan version: Infinispan 'Bastille' 9.1.6.Final 22:36:43,650 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 62) WFLYCLINF0002: Started client-mappings cache from ejb container 22:36:44,314 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 64) WFLYUT0021: Registered web context: '/Pluto' for server 'default-server' 22:36:44,412 INFO [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "Pluto.war" (runtime-name : "Pluto.war") 22:36:44,857 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server 22:36:44,863 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management 22:36:44,863 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
Pluto.war is application and I get 403 forbidden, I have tried multiple things, What I feel is Jboss is not able to pick dispatcher servlet at all, I have used spring with jboss as 7.1, but then it was xml config, I do not use maven so no pom.xml here, this same config is running fine in tomcat 8.
After removing custom lib and placed all the libs in web-inf/lib folder and deleted jboss-deployment-structure.xml from web-inf then its working fine. What wrong am I doing, in case of custom module? I created pluto.lib.main under modules folder and added this in standalone.xml
<subsystem xmlns="urn:jboss:domain:ee:4.0">
<global-modules>
<module name="pluto.lib" slot="main"/>
</global-modules>
Then I am facing 403 error