0

我有两个应用程序,都是用 Spring MVC 开发的。一,即 VDM 正在本地和实时 weblogic 12c 服务器中进行部署和启动。但另一个,即 VPORTAL 正在部署,但未在实时服务器中启动。启动服务时,出现以下错误:

java.lang.NoSuchMethodError: org/slf4j/spi/LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V

有趣的是,它在本地服务器上运行良好。

我在两个应用程序中都制作了一些一致的罐子,但没有帮助。需要注意的一点是,在 VDM 的类目录中有一个名为log4j.xml的文件,但在 VPORTAL 中没有。进行更改后,我将其放入 VPORTAL 中,但也无济于事。请帮忙!

4

3 回答 3

3

这绝对是一个 jar 版本不匹配的问题。您没有提及您放置在 WEB-INF\lib 文件夹下的 slf4j-api jar 版本。我怀疑它与 WLS 12c 中的版本不同。WLS 12.1.1在其模块目录中附带org.slf4j.api_1.6.1.0.jar 。因此,您需要在weblogic.xml中添加以下部分,指示 weblogic 从WEB-INF/lib 中的slf4j-api _x.xxjar加载类,而不是从org.slf4j.api_1.6.1 加载类。来自 WLS 安装的0.jar 。默认情况下,使用org.slf4j.api_1.6.1.0.jar,因为它位于服务器类路径中。

<container-descriptor>
    <prefer-web-inf-classes>false</prefer-web-inf-classes>
    <prefer-application-packages>
        <package-name>org.slf4j.*</package-name>
        <package-name>org.apache.commons.logging.*</package-name>
    </prefer-application-packages>
</container-descriptor>
于 2013-03-01T05:05:16.473 回答
0

我们的应用程序也面临类似的问题。应用程序 - Spring MVC & 我们正在迁移到 Weblogic12c。我们尝试了不同的方式,比如修改 pom.xml & all。但最后 weblogic.xml 中的这种变化帮助了我们。

<?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/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">
<wls:context-root>/</wls:context-root>
<wls:session-descriptor>
    <wls:cookie-secure>false</wls:cookie-secure>
    <wls:url-rewriting-enabled>true</wls:url-rewriting-enabled>
</wls:session-descriptor>
<wls:container-descriptor>
        <wls:prefer-application-packages>
            <wls:package-name>org.slf4j</wls:package-name>
            <wls:package-name>org.apache.xerces</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>
</wls:weblogic-web-app>

Pom.xml 文件:-

  <dependencies>
    <dependency>
        <groupId>org.apache.ws.commons.schema</groupId>
        <artifactId>XmlSchema</artifactId>
        <version>1.4.2</version>
    </dependency>
    <dependency>
        <groupId>antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>2.7.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.directory.studio</groupId>
        <artifactId>org.apache.commons.collections</artifactId>
        <version>3.2.1</version>
    </dependency>
    <dependency>
        <groupId>aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.5.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.ws.commons.axiom</groupId>
        <artifactId>axiom-api</artifactId>
        <version>1.2.7</version>
    </dependency>
    <dependency>
        <groupId>org.apache.ws.commons.axiom</groupId>
        <artifactId>axiom-dom</artifactId>
        <version>1.2.7</version>
    </dependency>
    <dependency>
        <groupId>org.apache.ws.commons.axiom</groupId>
        <artifactId>axiom-impl</artifactId>
        <version>1.2.7</version>
    </dependency>
    <dependency>
        <groupId>axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
     <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20090211</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>1.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-kernel</artifactId>
        <version>1.4.1</version>
    </dependency>
    <dependency>
        <groupId>axis</groupId>
        <artifactId>axis-jaxrpc</artifactId>
        <version>1.2-RC1</version>
    </dependency>
    <dependency>
        <groupId>backport-util-concurrent</groupId>
        <artifactId>backport-util-concurrent</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cactus</groupId>
        <artifactId>
            cactus.core.framework.uberjar.javaEE.14
        </artifactId>
        <version>1.8.1</version>
        <type>pom</type>
        <scope>provided</scope>
        <exclusions>
            <exclusion>
                <artifactId>org.mortbay.jetty</artifactId>
                <groupId>org.mortbay.jetty</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.cactus</groupId>
        <artifactId>cactus.integration.ant</artifactId>
        <version>1.8.1</version>
        <scope>provided</scope>
        <exclusions>
            <exclusion>
                <artifactId>cactus.integration.shared.api</artifactId>
                <groupId>org.apache.cactus</groupId>
            </exclusion>
            <exclusion>
                <artifactId>org.mortbay.jetty</artifactId>
                <groupId>org.mortbay.jetty</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.7.0</version>
    </dependency>
    <dependency>
        <groupId>onlinesupport-Mysp</groupId>
        <artifactId>coherence</artifactId>
        <version>3.5</version>
    </dependency>
    <dependency>
        <groupId>commons-chain</groupId>
        <artifactId>commons-chain</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>commons-digester</groupId>
        <artifactId>commons-digester</artifactId>
        <version>1.8</version>
    </dependency>
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.0.4</version>
    </dependency>
    <dependency>
        <groupId>commons-validator</groupId>
        <artifactId>commons-validator</artifactId>
        <version>1.3.1</version>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-stax-api_1.0_spec</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.icu</groupId>
        <artifactId>icu4j</artifactId>
        <version>4.6</version>
    </dependency>
    <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        <version>1.1-beta-6</version>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>com.cedarsoft.serialization</groupId>
        <artifactId>jdom</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>jsptags</groupId>
      <artifactId>pager-taglib</artifactId>
      <version>2.0</version>
    </dependency>
    <!-- Remove this for Weblogic -->


    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.2</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.8</version>
    </dependency>
    <dependency>
        <groupId>org.apache.neethi</groupId>
        <artifactId>neethi</artifactId>
        <version>2.0.4</version>
    </dependency>
    <dependency>
        <groupId>oro</groupId>
        <artifactId>oro</artifactId>
        <version>2.0.8</version>
    </dependency>
    <dependency>
        <groupId>xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
        <version>1.6.2</version>
    </dependency>


    <dependency>
        <groupId>servletapi</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.4</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.apple.corp</groupId>
        <artifactId>BlackWord</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.apple.corp</groupId>
        <artifactId>AESCryptoAlgorithm</artifactId>
        <version>0.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-oxm-tiger</artifactId>
        <version>1.5.4</version>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.5</version>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.8</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-bundle</artifactId>
        <version>1.2</version>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>

    <!-- Quartz framework -->
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>1.8.6</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.module</groupId>
        <artifactId>jackson-module-jaxb-annotations</artifactId>
        <version>2.1.4</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.6</version>
    </dependency>
    <dependency>
        <groupId>org.owasp.esapi</groupId>
        <artifactId>esapi</artifactId>
        <version>2.0_rc9</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
            <groupId>groovy</groupId>
            <artifactId>groovy-all-1.0-jsr</artifactId>
            <version>05</version>
    </dependency>
    <dependency>
          <groupId>com.apple.ist.gcrm.infra.log</groupId>
          <artifactId>cslogger</artifactId>
          <version>1.0-SNAPSHOT</version>
          <exclusions>
            <exclusion>
                <artifactId>log4j</artifactId>
                <groupId>apache-log4j</groupId>
            </exclusion>
            <exclusion>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
            </exclusion>
          </exclusions>
    </dependency>
      <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>org.eclipse.persistence.moxy</artifactId>
        <version>2.4.0</version>
       </dependency>

      <dependency>
        <groupId>com.apple.ist.ets</groupId>
        <artifactId>geneva-api</artifactId>
        <version>1.0</version>
      </dependency>
      <dependency>
        <groupId>org.owasp</groupId>
        <artifactId>antisamy</artifactId>
        <version>1.4</version>
      </dependency>
      <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
      </dependency>
      <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.0.2.GA</version>
      </dependency>
   </dependencies>

  <packaging>war</packaging>
</project>
于 2014-04-03T23:38:47.090 回答
-1

您必须将 Lan 提到的配置拆分为两个文件:

第一个是 META-INF/weblogic-application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">

  <prefer-application-packages>
      <package-name>org.slf4j.*</package-name>
      <package-name>org.apache.commons.logging.*</package-name>
  </prefer-application-packages>

</weblogic-application>

第二个是WEB-INF/weblogic.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="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/web-app_2_5.xsd
                                      http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd">

  <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
  </container-descriptor>

</weblogic-web-app>

这样,您可以强制 WebLogic(在我的情况下为 12c)首先加载 SLF4J 的 webapp 捆绑版本(必须放在 WEB-INF/lib 中)。但似乎,这两个绑定仍然可用。德语来源:http ://www.torsten-horn.de/techdocs/jee-oracleweblogic.htm#Kompatibilitätsprobleme

于 2013-04-18T07:07:17.363 回答