weblogic服务器上类或者方法找不到的解决办法

2020-12-13 02:10

阅读:526

标签:des   style   blog   class   code   java   

下面以eclipse-birt(报表)为例,介绍这种问题出现的原因以及解决之道:

 分析比较好的见http://developer.actuate.com/community/forum/index.php?/topic/9315-exception-javalangnosuchmethoderror/

  1>现象:

soscw.com,搜素材

I could run report as stand alone, but while I am trying to use report engine in weblogicI am getting following error.
java.lang.NoSuchMethodError: org.mozilla.javascript.ImporterTopLevel.initStandardObjects(Lorg/mozilla/javascript/Context;Z)V

root cause:

java.lang.NoSuchMethodError: org.mozilla.javascript.ImporterTopLevel.initStandardObjects(Lorg/mozilla/javascript/Context;Z)V
org.eclipse.birt.core.script.ScriptContext.(ScriptContext.java:80)
org.eclipse.birt.core.script.ScriptContext.(ScriptContext.java:67)
org.eclipse.birt.report.engine.executor.ExecutionContext.(ExecutionContext.java:295)
org.eclipse.birt.report.engine.api.impl.EngineTask.(EngineTask.java:137)
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.(RunAndRenderTask.java:62)
org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.createRunAndRenderTask(ReportEngineHelper.java:292)
org.eclipse.birt.report.engine.api.impl.ReportEngine.createRunAndRenderTask(ReportEngine.java:299)
com.teamcenter.project.birt.servlet.WebReport.doGet(WebReport.java:90)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.teamcenter.project.servlet.LoginTimerFilter.doFilter(LoginTimerFilter.java:74)
com.teamcenter.project.servlet.UTF8EncodingFilter.doFilter(UTF8EncodingFilter.java:50)
soscw.com,搜素材

  2>原因:

soscw.com,搜素材
The problem is because the application server contains a older version of
Rhino‘s js.jar, while BIRT uses the latest version (1.6RC1). Because the js.jar
in the application server is loaded before the one in BIRT, the older version
of class org.mozilla.javascript.Context is loaded. Since the older version of
class org.mozilla.javascript.Context doesn‘t contain function
initStandardObjects, a runtime java.lang.NoSuchMethodError happened.

To solve this kind of problem, the application server usually provides a
configuration to allow loading application‘s java classes before the app
server‘s. 
soscw.com,搜素材

  3>解决:

  

soscw.com,搜素材
the conflict was between Weblogic Application Server and BIRT library, in weblogic-application.xml we have added the following configuration which has resolved the issue.

Configuration:
prefer-application-packages>
package-name>org.mozilla.*package-name>    
prefer-application-packages>
soscw.com,搜素材

   另外一篇比较好的文章: http://blog.csdn.net/hhb200766/article/details/7818142

    在WEB-INF目录下新建weblogic-application.xml文件

    1. xml version="1.0" ?>  
    2. weblogic-application>  
    3.     prefer-application-packages>  
    4.         package-name>antlr.*package-name>  
    5.     prefer-application-packages>  
    6. weblogic-application> 

    在weblogic.xml文件中插入一段配置:

    1. container-descriptor> 
    2.     prefer-web-inf-classes>trueprefer-web-inf-classes> 
    3. container-descriptor>

 

针对我自己的这个应用,也是参照上面的解决办法的,具体如下:

    config是我自己的一个web应用

soscw.com,搜素材

  在WEB-INF目录下新建一个 application.xml 和 weblogic-application.xml文件,这两个文件的内容是一模一样的,估计只需要一个,至于哪一个可以再尝试我这里就把两个文件都保留着,这两个文件的内容如下:

soscw.com,搜素材
xml version="1.0"?> 
weblogic-application> 
    prefer-application-packages>
        package-name>org.mozilla.*package-name>    
    prefer-application-packages>
weblogic-application> 
soscw.com,搜素材

紧接着在 weblogic.xml文件中修改一个配置,设置为true

soscw.com,搜素材
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.4/weblogic-web-app.xsd">
    wls:context-root>/configwls:context-root>
    wls:charset-params>
        wls:input-charset>
            wls:resource-path>/*wls:resource-path>
            wls:java-charset-name>UTF-8wls:java-charset-name>
        wls:input-charset>
    wls:charset-params>
 
    wls:container-descriptor>
            
        wls:prefer-web-inf-classes>truewls:prefer-web-inf-classes>
    
    wls:container-descriptor>

    
wls:weblogic-web-app>
soscw.com,搜素材

最后重启应用即可.

 

weblogic服务器上类或者方法找不到的解决办法,搜素材,soscw.com

weblogic服务器上类或者方法找不到的解决办法

标签:des   style   blog   class   code   java   

原文地址:http://www.cnblogs.com/yangw/p/3715762.html


评论


亲,登录后才可以留言!