Question 1:
异常描述:
Because JAVAEE6 is used when creating the project, the web.xml file is generated like this:
- <web-app version="3.0"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
weblogic10.3.6 does not support the definition of web-app_3_0.xsd. So it is wrong.
It is ok to change to the following:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Or deploy to weblogic 12.
2nd question:
Exception description:
Caused by: weblogic.management.DeploymentException: [HTTP:101170]The servlet default is referenced in servlet-mapping *.js, but not defined in web.xml.
Reason: Handle static resources with default servlet.
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
Each web container has a default servlet, the name of the default servlet in tomcat is: defalut. And in weblogic is: FileServlet. The default servlet names for each container are listed below
Tomcat, Jetty, JBoss, and GlassFish default servlet name "default" WebLogic default servlet name "FileServlet", WebSphere default servlet name "Simpledefault".
Just change the default above to FileServlet.
3rd question:
Exception description:
reason:
There is such a configuration in mvc-dispatcher-servlet.xml,
<!-- @Controller-marked classes to be scanned-->
<context:component-scan base-package="com">
<context:include-filter type="regex"
expression=".*.action.* " />
<!-- Service is excluded here to prevent transaction failure-->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>
</context:component-scan>
My package name is com.companyname.modulename. Since the weblogic package also has packages starting with com and ending with action, spring also scans its packages and injects them into the container. A bean with the same name appears. So report an error.
The solution is to add a layer to the package name in <context:component-scan base-package="com"> and change it to: <context:component-scan base-package="com.company name">.
4th question:
Exception description:
Caused by: java.lang.Throwable: Substituted for missing class org.springframework.beans.factory.BeanCreationException - Error creating bean with name 'ditemAction': Injection of autowired depende
ncies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.jfpal.riskmanage.item.service.IDitemService
This is an error while creating the controller 'ditemAction'. The reason is that the property com.jfpal.riskmanage.item.service.IDitemService cannot be injected. The code is definitely fine, and it runs normally on tomcat.
After analysis, it is concluded that spring does not scan the package where com.jfpal.riskmanage.item.service.IDitemService is located.
Then check web.xml and find the following configuration
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext*.xml</param-value>
</context-param>
change it to
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml,classpath:applicationContext-myBatis.xml</param-value>
</context-param>
The configuration of the latter data source. After the change, the deployment was successful. The reason is that weblogic and tomcat parse <param-value> a little differently.
5th question:
An error occurred when accessing the project, and a 404 was reported, saying that **/**/dwz.frag.xml could not be found. View web.xml, the access to xml static resources is not configured, plus the following configuration
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>*.xml</url-pattern>
</servlet-mapping>
So far the migration is successful.