Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.7.4
-
None
Description
Hi,
I'm trying to deploy an axis 2 webservice on an embedded jetty server using spring boot (1.5.1), but axis can't deploy any of the modules when I start the application.
I bootstrap the axis servlet with spring boot as follows:
@Bean public ServletRegistrationBean axisServletRegistration() { // in order for the axis servlet to work as expected we need to tweak the default axis settings (axis.xml) // axis assumes that the axis servlet is mapped to "/*" in the "axis2" context of the container // but in this case the axis servlet is mapped to "/axis2/*" in the root context of the container // contextRoot -> / (instead of axis2) // servicePath -> axis2/services (instead of services) ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new AxisServlet(), "/axis2/*"); servletRegistrationBean.setName("AxisServlet"); servletRegistrationBean.setOrder(1); servletRegistrationBean.setLoadOnStartup(1); servletRegistrationBean.getInitParameters().put(PARAM_AXIS2_XML_URL, Resources.getResource("axis2/conf/axis2.xml").toString()); servletRegistrationBean.getInitParameters().put(PARAM_AXIS2_REPOSITORY_URL, Resources.getResource("axis2/").toString()); return servletRegistrationBean; }
The axis2 folder on my classpath looks like this:
- axis2
- conf
- axis2.xml
- modules
- addressing-1.7.4.mar
- axis2-jaxws-mar-1.7.4.mar
- mex-1.7.4.mar
- modules.list
- mtompolicy-1.7.4.mar
- ping-1.7.4.mar
- scripting-1.7.4.mar
- soapmonitor-1.7.4.mar*services
- services.list
- version-1.7.4.aar
- conf
When I start the application I get the following exception:
ERROR 2017-03-09 16:32:40,259 [main] o.a.axis2.deployment.ModuleDeployer: The mtompolicy-1.7.4.mar module, which is not valid, caused For input string: "mar" java.lang.NumberFormatException: For input string: "mar" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at org.apache.axis2.description.Version.<init>(Version.java:78) at org.apache.axis2.description.AxisModule.setArchiveName(AxisModule.java:171) at org.apache.axis2.deployment.ModuleDeployer.deoloyFromUrl(ModuleDeployer.java:207) at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:120) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:149) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585) at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:164) at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377) at org.apache.axis2.deployment.DeploymentEngine.loadRepositoryFromURL(DeploymentEngine.java:303) at org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfiguration(WarBasedAxisConfigurator.java:212) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471) at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:637) at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:421) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:744) at org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler.deferredInitialize(JettyEmbeddedWebAppContext.java:46) at org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext.deferredInitialize(JettyEmbeddedWebAppContext.java:36) at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer.handleDeferredInitialize(JettyEmbeddedServletContainer.java:194) at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer.start(JettyEmbeddedServletContainer.java:127) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
The problem only occurs when I try to load the axis repository from a url; when I initialise the axis2 servlet using axis2.repository.path instead of axis2.repository.url everything works as expected. Unfortunately this doesn't meet my requirements as I need to package the application as a fat jar, so I need to load the repository from a URL.
I've inspected the code a bit and I think the issue is easy to fix:
IN
org.apache.axis2.deployment.ModuleDeployer.deoloyFromUrl(DeploymentFileData deploymentFileData)
CHANGE
module.setArchiveName(deploymentFileData.getName());
TO
module.setArchiveName(DescriptionBuilder.getShortFileName(deploymentFileData.getName()));
Can someone confirm that this is a bug or am I missing something?