I am trying to package SpringBoot Application with SmartGWT as a JAR archive, I have it working with SpringBoot as WAR Archive no issue with the following
WAR ARTIFACT Working:
1. Maven Project Structure
Project
- src
- main
- java
- resources
- server.properties
- application.properties
- webapp
- <Smart GWT Compiled code>
- index.html
- WEB-INF
- classes
- web.xml (web.xml is empty just contains welcome file list)
2. Spring Initializer
@SpringBootApplication(scanBasePackages = "com.ricoh.mdm",exclude = {ErrorMvcAutoConfiguration.class})
public class AdmintoolApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(AdmintoolApplication.class);
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
servletContext.addListener(new InitListener()); //Add com.isomorphic.base.InitListener ServletContextListener
}
//Registers all other servlets
@Bean
ServletRegistrationBean<DataSourceLoader> dataSourceServlet () {
return new ServletRegistrationBean<DataSourceLoader>(new DataSourceLoader(),DATASOURCE_LOADER_SERVLET_URL_MAPPING);
}
...etc.
}
3. I package the project with springboot to generate a WAR archive - I can then run java -jar myserver.war and everything works... SMartGWT works and all is well.
JAR ARTIFACT NOT Working:
1. Maven Project Structure
Project
- src
- main
- java
- resources
- server.properties
- application.properties
- public
- <Smart GWT Compiled code>
- index.html
2. Spring Initializer Same as before, I also tried implenmenting WebApplicationInitializer and without WebApplicationInitializer or SpringBootServletInitializer
@SpringBootApplication(scanBasePackages = "com.ricoh.mdm",exclude = {ErrorMvcAutoConfiguration.class})
public class AdmintoolApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(AdmintoolApplication.class);
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
servletContext.addListener(new InitListener()); //Add com.isomorphic.base.InitListener ServletContextListener
}
//Registers all other servlets
@Bean
ServletRegistrationBean<DataSourceLoader> dataSourceServlet () {
return new ServletRegistrationBean<DataSourceLoader>(new DataSourceLoader(),DATASOURCE_LOADER_SERVLET_URL_MAPPING);
}
...etc.
}
3. I package the project with springboot to generate a JAR archive, I start the application with java -jar myserver.jar but SmartGWT does not really kick in
Problem loading builtinTypes.xml
Exception when loading from __USE_CONTAINER__/common/sc/system/schema/builtinTypes.xml:
java.net.MalformedURLException
at java.base/java.net.URL.<init>(URL.java:679)
at java.base/java.net.URL.<init>(URL.java:541)
at java.base/java.net.URL.<init>(URL.java:488)
I looked at https://www.smartclient.com/smartgwt...tListener.html and have the listener configured.
I think SmartGWT InitListener is not getting invoked on somehow its not finding server.properties file
Any suggestions or advice
Comment