番石榴和Weblogic:ClassNotFoundException [英] Guava and Weblogic:ClassNotFoundException

查看:174
本文介绍了番石榴和Weblogic:ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在部署到Weblogic 10.3.5的Web应用程序上工作. Maven依赖项之一是番石榴.

I'm trying to work on a web application that deploys to Weblogic 10.3.5. One of the maven dependencies is Guava.

不幸的是,在尝试发布项目时,weblogic抛出此异常:

Unfortunately, upon attempting to publish the project, weblogic throws this exception:

java.lang.ClassNotFoundException: com.google.common.eventbus.EventBus
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)

我其余的maven依赖项SEEM都可以正常工作,但是我不确定问题出在哪里.

The rest of my maven dependencies SEEM to be working, but I'm unsure what the problem is.

任何人都可以协助进行故障排除吗?环境是带有M2E插件的Eclipse,Weblogic Server已集成到Eclipse中.

Can anyone assist in troubleshooting? Environment is Eclipse with M2E plugin, Weblogic Server is integrated into Eclipse.

更新:pom.xml中的番石榴条目:

Update: Guava entry in pom.xml:

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>11.0.2</version>
    </dependency>

我包括了另一个库(commons-lang),并且运行良好.

I included another library (commons-lang) and it worked fine.

更新2 :这可能是类加载器问题.我从此博客中得到了一个线索: http://blog .eisele.net/2011/12/running-richfaces-410final-on-weblogic.html .看来WLS使用了一些google-commons库.

Update 2: This may be a classloader issue. I got a clue from this blog: http://blog.eisele.net/2011/12/running-richfaces-410final-on-weblogic.html. It seems WLS uses some google-commons library.

我试图通过在weblogic.xml文件中进行更改来强迫它使用我的版本,但是它似乎无法正常工作.

I'm trying to force it to use my version by making changes in the weblogic.xml file, but it doesn't seem to be working.

推荐答案

  • 是的,这是类加载器问题(应用程序与WebLogic类加载)
  • guava库和com.google.common包含相同的类
  • WebLogic在模块目录的类路径中具有com.google.common_1.0.0.0_0-6.jarcom.google.common_1.1.0.0_0-6.jar. (取决于WebLogic版本,但jar内容相同,只有META-INF \ MANIFEST.MF不同)
  • 您无法在WebLogic Classloader分析工具中找到该库(猫).我不确定为什么会这样....
  • 为什么不借助FilteringClassLoaders使用内置的WebLogic功能-首选应用程序-包装?
    • Yes it's classloader issue (application vs. WebLogic classloading)
    • guava libraries and com.google.common contains same classes
    • WebLogic has com.google.common_1.0.0.0_0-6.jar or com.google.common_1.1.0.0_0-6.jar in it's classpath, in modules directory. (depending on WebLogic version, but the jar content is same, only META-INF\MANIFEST.MF is different)
    • You cannot find this library in WebLogic Classloader Analysis Tool (CAT). I'm not sure why is that....
    • Why not using WebLogic built in feature with help of FilteringClassLoaders - prefer-application-packages ?
    • 如果您在EAR应用程序中,则需要在 weblogic.xml weblogic-application.xml中添加类似的内容

      you need to add something like this to your weblogic.xml or weblogic-application.xml if you are in EAR application

      <wls:container-descriptor>
          <wls:prefer-application-packages>
                  <wls:package-name>com.google.common.*</wls:package-name>
          </wls:prefer-application-packages>
      </wls:container-descriptor>
      

      然后重新部署应用程序.

      Then redeploy the application.

      它对我们有用.

      • 优点:无需更换&使用com.google.common * .jar文件重命名魔术 ...这是自杀的一种方式...
      • pros: no need to replace & rename magic with com.google.common*.jar files... that's a way to suicide...

      希望有帮助.

      有关更多信息,请参见链接:
      http://www.lucubratory.eu/guava-and-weblogic12c/

      For more info, see the link:
      http://www.lucubratory.eu/guava-and-weblogic12c/

      这篇关于番石榴和Weblogic:ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆