Skip to content

Commit 3cab684

Browse files
springbootdemo-tomcat11: fix deploy directory name — axis2-json-api not axis2-json-api.war
When Tomcat deploys a directory named 'foo.war', it strips '.war' from WAR FILES but NOT from directories — context path is '/axis2-json-api.war', not '/axis2-json-api'. This caused all /axis2-json-api/* requests to be handled by the ROOT context (which ran old code without the OpenAPI bypass), not by the new app with OpenApiServlet. Rename target/deploy/axis2-json-api.war to target/deploy/axis2-json-api in all pom.xml antrun and maven-war-plugin webappDirectory references so the deployed directory creates context path /axis2-json-api as intended. Tested on Tomcat 11.0.20 + OpenJDK 21: /openapi.json, /openapi.yaml, /swagger-ui all return 200; login returns Bearer token; testws protected service returns OK with XSS-escaped output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8fac90e commit 3cab684

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • modules/samples/userguide/src/userguide/springbootdemo-tomcat11

modules/samples/userguide/src/userguide/springbootdemo-tomcat11/pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@
334334
<version>0.0.1-SNAPSHOT</version>
335335
<type>war</type>
336336
<overWrite>false</overWrite>
337-
<outputDirectory>${project.build.directory}/deploy/axis2-json-api.war</outputDirectory>
337+
<outputDirectory>${project.build.directory}/deploy/axis2-json-api</outputDirectory>
338338
<includes>**/*.class,**/*.xml</includes>
339339
<excludes>**/*test.class</excludes>
340340
</artifactItem>
@@ -357,23 +357,23 @@
357357
<phase>prepare-package</phase>
358358
<configuration>
359359
<target>
360-
<jar jarfile="${project.build.directory}/deploy/axis2-json-api.war/WEB-INF/services/Login.aar">
360+
<jar jarfile="${project.build.directory}/deploy/axis2-json-api/WEB-INF/services/Login.aar">
361361
<metainf file="resources-axis2/login_resources/services.xml"/>
362362
</jar>
363-
<jar jarfile="${project.build.directory}/deploy/axis2-json-api.war/WEB-INF/services/testws.aar">
363+
<jar jarfile="${project.build.directory}/deploy/axis2-json-api/WEB-INF/services/testws.aar">
364364
<metainf file="resources-axis2/test_service_resources/services.xml"/>
365365
</jar>
366-
<jar jarfile="${project.build.directory}/deploy/axis2-json-api.war/WEB-INF/services/BigDataH2Service.aar">
366+
<jar jarfile="${project.build.directory}/deploy/axis2-json-api/WEB-INF/services/BigDataH2Service.aar">
367367
<metainf file="resources-axis2/bigdata_h2_resources/services.xml"/>
368368
</jar>
369-
<copy todir="${project.build.directory}/deploy/axis2-json-api.war/WEB-INF/conf">
369+
<copy todir="${project.build.directory}/deploy/axis2-json-api/WEB-INF/conf">
370370
<fileset dir="resources-axis2/conf">
371371
<include name="axis2.xml"/>
372372
</fileset>
373373
</copy>
374-
<mkdir dir="${project.build.directory}/deploy/axis2-json-api.war/WEB-INF/modules"/>
374+
<mkdir dir="${project.build.directory}/deploy/axis2-json-api/WEB-INF/modules"/>
375375
<copy file="${settings.localRepository}/org/apache/axis2/axis2-openapi/${axis2.version}/axis2-openapi-${axis2.version}.jar"
376-
tofile="${project.build.directory}/deploy/axis2-json-api.war/WEB-INF/modules/openapi-${axis2.version}.mar"
376+
tofile="${project.build.directory}/deploy/axis2-json-api/WEB-INF/modules/openapi-${axis2.version}.mar"
377377
overwrite="true"/>
378378
<unzip src="${project.build.directory}/axis2-json-api-0.0.1-SNAPSHOT.war" dest="${project.build.directory}/exploded"/>
379379
<jar jarfile="${project.build.directory}/exploded/WEB-INF/services/Login.aar">
@@ -418,7 +418,7 @@
418418
<filtering>true</filtering>
419419
</resource>
420420
</webResources>
421-
<webappDirectory>${project.build.directory}/deploy/axis2-json-api.war</webappDirectory>
421+
<webappDirectory>${project.build.directory}/deploy/axis2-json-api</webappDirectory>
422422
</configuration>
423423
<executions>
424424
<execution>

0 commit comments

Comments
 (0)