java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectWriter.forType

前端 未结 2 1729
天涯浪人
天涯浪人 2021-01-17 01:34

when accessing the deployed spring boot application in weblogic , I am getting the below exception

java.lang.NoSuchMethodError: com.fasterxml.jackson.databin         


        
相关标签:
2条回答
  • 2021-01-17 02:13

    You got this problem because you compile your application with a com.fasterxml version different from the one used by weblogic. So you must tell weblogic to use your version and not the native one.

    If you deploy your application as a war, you must add a weblogic.xml file specifying the packages which should have precedence (make sure to add it in the src/main/webapp/WEB-INF folder). In your case you must add the com.fasterxml package:

    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-web-app
        xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
        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/ejb-jar_3_0.xsd
            http://xmlns.oracle.com/weblogic/weblogic-web-app
            http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
        <wls:container-descriptor>
            <wls:prefer-application-packages>
                <wls:package-name>com.fasterxml</wls:package-name>
            </wls:prefer-application-packages>
        </wls:container-descriptor>
    </wls:weblogic-web-app>
    

    And it should work.

    0 讨论(0)
  • 2021-01-17 02:28

    It should work with this weblogic.xml entry

    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-web-app
            xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
            http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
        <wls:context-root>/v7</wls:context-root>
        <wls:container-descriptor>
            <wls:prefer-application-packages>
                <wls:package-name>org.slf4j.*</wls:package-name>
                <wls:package-name>org.springframework.*</wls:package-name>
                <wls:package-name>com.fasterxml</wls:package-name>
            </wls:prefer-application-packages>
        </wls:container-descriptor>
    </wls:weblogic-web-app>
    
    0 讨论(0)
提交回复
热议问题