Several problems in migrating tomcat to weblogic

Question 1:

 

异常描述:VALIDATION PROBLEMS WERE FOUND problem: cvc-enumeration-valid: string value '3.0' is not a valid enumeration value for web-app-versionType in namespace http://java.sun.com/xml/ns/javaee:<null>

 

 

 

Because JAVAEE6 is used when creating the project, the web.xml file is generated like this:

 

 

 

[java] view plaincopy   View code snippets on CODE Derive to my code slice
  1. <web-app version="3.0"   
  2.     xmlns="http://java.sun.com/xml/ns/javaee"   
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   
  5.     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:

 

Annotation-specified bean name 'containerTransactionType.Factory' for bean class [com.sun.java.xml.ns.javaee.ContainerTransactionType$Factory] conflicts with existing, non-compatible bean definition of same name and class [com.sun.java.xml.ns.j2Ee.ContainerTransactionType$Factory]

 

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326392993&siteId=291194637