Weblogic and Birt Problem

5 October 2006 at 8:28 am | Posted in Java | 2 Comments

Hampir setengah harian mencari solusi untuk menyelesaikan problematika ini L. Birt merupakan salah satu tools untuk membuat report atau dikenal dengan Report Engine. Bisa dilihat dengan klik link ini

http://www.eclipse.org/birt/phoenix/tutorial/basic/index.php. Klo weblogic server itu fungsinya mirip dengan apache web server (blum begitu paham juga sih). Nah ada masalah ketika menggunakan keduanya dalam aplikasi web. Error yang bakal terjadi seperti ini :

java.lang.LinkageError: loader constraints violated when linking org/mozilla/javascript/Scriptable classat org.eclipse.birt.report.engine.api.impl.ReportEngine.registerBeans(ReportEngine.java:174)at org.eclipse.birt.report.engine.api.impl.ReportEngine.setupScriptScope(ReportEngine.java:121)at org.eclipse.birt.report.engine.api.impl.ReportEngine.(ReportEngine.java:87)at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory.createReportEngine(ReportEngineFactory.java:13)at org.eclipse.birt.report.service.ReportEngineService.setEngineContext(Unknown Source)at org.eclipse.birt.report.service.BirtViewerReportService.setContext(Unknown Source)at org.eclipse.birt.report.servlet.BirtEngineServlet.__getContext(Unknown Source)at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(Unknown Source)at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6718)at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178).  

Ketika menggunakan BIRT sbg report engine, jangan lupa untuk melakukan perubahan pada file web.xml, seperti panduan dalam installasi BIRT. Di bawah ini contoh isi web.xml yang sudah digabung untuk pemakaian framework struts :

<?xml version=”1.0″ encoding=”UTF-8″?> 

<!DOCTYPE web-app    PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”    http://java.sun.com/dtd/web-app_2_3.dtd”&gt;<web-app> 

  <display-name>Cardio Re-Engineering</display-name>  <description>Cardio Re-Engineering Application Demo</description> 

  <context-param>    <param-name>BIRT_VIEWER_LOCALE</param-name>    <param-value>en-US</param-value>  </context-param> 

  <context-param>    <param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>    <param-value></param-value>  </context-param> 

  <!– If usr can only access the reprot under working folder. Default is true –>  <context-param>    <param-name>WORKING_FOLDER_ACCESS_ONLY</param-name>    <param-value>false</param-value>  </context-param> 

  <!– Absolute downloaded image/chart directory. Default to ${birt home}/report/images –>  <context-param>    <param-name>BIRT_VIEWER_IMAGE_DIR</param-name>    <param-value></param-value>  </context-param> 

  <!– Absolute engine log directory. Default to ${birt home}/logs –>  <context-param>    <param-name>BIRT_VIEWER_LOG_DIR</param-name>    <param-value></param-value>  </context-param> 

  <!– Report engine log level –>  <context-param>    <param-name>BIRT_VIEWER_LOG_LEVEL</param-name>    <param-value>OFF</param-value>  </context-param> 

  <!– Absolute directory to store all birt report script libraries (JARs). Default to ${birt home}/scriptlib –>  <context-param>    <param-name>BIRT_VIEWER_SCRIPTLIB_DIR</param-name>    <param-value></param-value>  </context-param>    <!– Absolute resource location directory. –>  <context-param>    <param-name>BIRT_RESOURCE_PATH</param-name>    <param-value></param-value>  </context-param> 

  <!– Preview report max rows limited. –>  <context-param>    <param-name>BIRT_VIEWER_MAX_ROWS</param-name>    <param-value></param-value>  </context-param> 

  <!– Viewer Servlet Context Listener –>  <listener>    <listener-class>org.eclipse.birt.report.listener.ViewerServletContextListener</listener-class>  </listener> 

<servlet>    <servlet-name>action</servlet-name>    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>    <init-param>      <param-name>config</param-name>      <param-value>/WEB-INF/struts-config.xml</param-value>    </init-param>    <init-param>      <param-name>debug</param-name>      <param-value>2</param-value>    </init-param>    <init-param>      <param-name>detail</param-name>      <param-value>2</param-value>    </init-param>    <load-on-startup>2</load-on-startup>  </servlet>      <servlet>      <servlet-name>ViewerServlet</servlet-name>      <servlet-class>org.eclipse.birt.report.servlet.ViewerServlet</servlet-class>    </servlet>      <servlet>      <servlet-name>EngineServlet</servlet-name>      <servlet-class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>    </servlet>      <servlet-mapping>      <servlet-name>ViewerServlet</servlet-name>      <url-pattern>/frameset</url-pattern>    </servlet-mapping>        <servlet-mapping>      <servlet-name>EngineServlet</servlet-name>      <url-pattern>/run</url-pattern>    </servlet-mapping>      <servlet-mapping>      <servlet-name>EngineServlet</servlet-name>      <url-pattern>/download</url-pattern>    </servlet-mapping>      <servlet-mapping>      <servlet-name>EngineServlet</servlet-name>      <url-pattern>/parameter</url-pattern>  </servlet-mapping>   

  <servlet-mapping>    <servlet-name>action</servlet-name>    <url-pattern>*.do</url-pattern>  </servlet-mapping> 

  <session-config>    <session-timeout>30</session-timeout>  </session-config> 

  <welcome-file-list>    <welcome-file>index.jsp</welcome-file>  </welcome-file-list> 

  <taglib>    <taglib-uri>struts-bean</taglib-uri>    <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>  </taglib> 

  <taglib>    <taglib-uri>struts-html</taglib-uri>    <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>  </taglib> 

  <taglib>    <taglib-uri>struts-logic</taglib-uri>    <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>  </taglib>    <!–   <security-constraint>    <web-resource-collection>      <web-resource-name>        Restrict access to JSP pages      </web-resource-name>      <url-pattern>*.jsp</url-pattern>    </web-resource-collection>    <auth-constraint>      <description>        With no roles defined, no access granted      </description>    </auth-constraint>  </security-constraint>   –>  </web-app> 

 

Problem di atas disebabkan karena class loading, masalahnya … gmn cara merubah Class loader mode dalam WL(weblogic) Server, sehingga Application class diload pertama kali, dalam hal ini adalah BIRT. Meski solusi yang akan dijelaskan di bawah ini bukan solusi yang bagus, karena harus di set manual, bukan pada file konfigurasinya. Moga ada yg mo kasih solusi yang lebih baik dari ini.

Salah satu solusi yaitu dengan melakukan perubahan pada weblogic.xml

Set tag <prefer-web-inf-classes> menjadi false. Di bawah ini contoh isi file weblogic.xml

<?xml version=”1.0″ encoding=”UTF-8″?>   <!DOCTYPE weblogic-web-app     PUBLIC “-//BEA Systems, Inc.//DTD Web Application 7.0//EN”     http://www.bea.com/servers/wls700/dtd/weblogic700-web-jar.dtd&#8221; ><weblogic-web-app> 

  <container-descriptor>    <prefer-web-inf-classes>false</prefer-web-inf-classes>  </container-descriptor>    <context-root></context-root>

</weblogic-web-app>

Setelah melakukan perubahan itu, masih muncul error :

java.lang.NoSuchMethodError: org.mozilla.javascript.ImporterTopLevel.initStandardObjects(Lorg/mozilla/javascript/Context;Z)Vat org.eclipse.birt.core.script.ScriptContext.(ScriptContext.java:81) at org.eclipse.birt.core.script.ScriptContext.(ScriptContext.java:68) at org.eclipse.birt.report.engine.executor.ExecutionContext.(ExecutionContext.java:297)at org.eclipse.birt.report.engine.api.impl.EngineTask.(EngineTask.java:132) at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.(GetParameterDefinitionTask.java:85) at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.createGetParameterDefinitionTask(ReportEngineHelper.java:254) at org.eclipse.birt.report.engine.api.impl.ReportEngine.createGetParameterDefinitionTask(Re … 

Solusinya dengan menambah js.jar ke dalam classpath sebelum starting weblogic. Klo di myeclipse, tinggal tambah jar di menu window>preference trus di pilih MyEclipse>Application Server>WebLogic 8>Paths Klik button Add JAR/ZIP di prepend to classpath. Dengan catatan Anda telah merubah konfigurasi WebLogic 8. Atau bisa juga ditambahkan pada startWebLogic.sh

2 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Oh wait. Yes, I have. I’m sorry, but I just don’t have it in me right now to type it all out again. Besides, it was just ramblings anyway. You didn’t want to hear me go on and on about this, right?

  2. حديث…

    Search Tags Family and Community Development (4) Maternal and Infant Health (2) Nutrition (2) Extension Learning Farm (2) Sheep Program (1) 4- H Youth Development (2) Uncategorized (1) Archives June 2009 December 2007 October 2007 December 1969 Pages 4…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: