Due to the company's needs, several bank interface write simulators (mock servers) need to be written, and this interface needs to be published as a Web Service.
At first, I thought that as long as the business layer responsible for writing interfaces, the specific framework or environment can be built without the control. After communication with the development, because I do not understand the Web Service release, completely belong to the kind of no concept, development is willing to help build one.
During this time, I began to write business layer, the 3 interface business layer spent a day to write, add some database query methods and database new fields to meet the business needs.
Development has also done a little demo of Web service, using AXIS2 to publish Web service. I looked like I was developing, and we had one in our mock server, but it didn't come up.
1. Error One: caused By:java.lang.ClassCastException:org.springframework.web.SpringServletContainerInitializer cannot be Cast to Javax.servlet.ServletContainerInitializer
The online collection of some information, basically confirmed that this is due to the jar packet conflict, after a long time investigation, found this is due to the Tomcat plugin and spring boot inside a jar package conflict, and later in the development of the help of the current web The service project contains spring boot to exclude. Start Web Service, anyway, project is not up, online search for half a day can not find its reason. Finally, only the most stupid way to look at the problem.
- First in the Pom file to remove all the Axis2 dependencies, start, no problem.
- Put the axis2 inside of the dependency package, one by one plus, start until the problem is found in the package.
- After finding it, try adding <scope>provided</scope> in this package. startup, no problem, but the Web service is not published properly.
2. Error two: ClassNotFoundException:org.apache.axis2.transport.http.AxisServlet
caused By:java.lang.LinkageError:loader constraint Violation:loader (instance of org/apache/catalina/loader/ WebappClassLoader) previously initiated loading for a different type with name "Javax/servlet/servletcontext"
This is even more no idea, add the Provided,web service can not be released, no add, simply can not start, how to do?
And with the development of confirmed, this package is very important package, it will be used in the run time, so can not add provided, added will not find the corresponding class.
Check all the configuration, there is no problem, finally with a psychological, development also suggest we use Tomcat server instead of Tomcat plugin, because very few people will use this, so with a dead horse when live horse medical mentality, and then tried a, the result was successful. The reason for this is that axis would be problematic if it was executed with Tomcat plugin inside the IntelliJ, but with native tomcat there would be no problem.
It took 4 days from the beginning to the end.
Summarize:
1. The environment should be built first, ensure that the environment is not a problem, and then start writing business layer code.
2. In the face of environmental problems, or the elimination of the law to see the problem, to find out the problem.
3. Environment is better, although thanks to the development of help to get a small demo, but the problem is a lot, I will be more familiar with the point.
4. Learn a lot about configuring Web project, how to do debugging. Previously purely automated testing, there is no experience in this area.
Novice AXIS2 Publishing the Web service route