Deploy an Oracle JHeadstart/BC4J application to IBM WebSphere

3

If you’ve created a J2EE JHeadstart/BC4J application and you want to deploy it to the Oracle Application Server, it works easily. If you want to deploy it to IBM WebSphere, it will also work fine if you take care of the following:

1. Make sure you have all the necessary BC4J libraries available:
Visit http://www.oracle.com/technology/products/jdev/howtos/appservers/deploy_bc4j_to_websphere.html for a list of all the files you need. Add the jar-files to the WEB-INF\lib directory of your application.

2. Enable Log4J logging
IBM has implemented commons-logging for WebSphere 5.1, which is leading. JHeadstart works with log4j. You can enable the log4j logging by doing the following:

  • Add a directory ‘services’ to the META-INF directory of your application.
  • Add a new file with the name ‘org.apache.commons.logging.LogFactory’
  • Add the following text to the file, to indicate the log4j factory: org.apache.commons.logging.impl.Log4jFactory
  • 3. Change the default XML parser
    Oracle uses the Oracle XML parser as default, but IBM uses Xerces. Add the Oracle XML parser to the WEB-INF\lib directory of your application and if present, remove the xerces parser (also when you need the xerces parser in your application!). Now the Oracle XML parser will be used as default and since WebSphere also contains the xerces parser itself, it can still be used when necessary.

    This solutions was found with help of Meindert Deen from Xebia.

    Share.

    About Author

    3 Comments

    1. I try to deploy Jhs10.1.2 on WebSphere 5.1 server,
      I did all the above and add following that got from metalink instruction:

      1. Edit the web.xml file by EITHER deleting the following lines

      ADFBindingFilter
      jsp

      .
      OR Adding the following

      jsp
      com.ibm.ws.webcontainer.jsp.servlet.JspServlet

      to the web.xml and redeploy.
      2. Set the JVM argument for the websphere server.
      -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl

      Through the admin console for Websphere follow the chain
      Application servers > server1 > Process Definition > Java Virtual Machine
      and add the above for the Generic JVM arguments.

      But still got following Http 500 responsed and systemlog had following message:
      [9/20/06 20:03:20:438 CST] 56791026 WebGroup I SRVE0180I: [adm.war] [/adm] [Servlet.LOG]: /index.jsp: init
      20:03:22 DEBUG (JhsActionServlet) -Storing JhsAuthorizationProxy object on session to allow EL access to request.isUserInRole() and/or JhsUser.hasAccess()
      20:03:22 DEBUG (JhsActionServlet) -Request class: com.ibm.ws.webcontainer.srt.SRTServletRequest
      20:03:22 DEBUG (JhsActionServlet) -Request URI: /adm/StartAdm1070Base.do
      20:03:22 DEBUG (JhsActionServlet) -Request Character Encoding: UTF-8
      20:03:23 DEBUG (JhsActionServlet) -Parameter resetBreadcrumbs: true
      20:03:23 DEBUG (JhsActionServlet) -Parameter ArgUser: 891003
      20:03:23 DEBUG (JhsRequestProcessor) -No Tiles Plugin present. Fall back to generic RequestProcessor behaviour
      20:03:23 DEBUG (JhsActionServlet) -Request class: com.ibm.ws.webcontainer.srt.SRTServletRequest
      20:03:23 DEBUG (JhsActionServlet) -Request URI: /adm/Adm1070BaseTable.do
      20:03:23 DEBUG (JhsActionServlet) -Request Character Encoding: UTF-8
      20:03:23 DEBUG (JhsActionServlet) -Parameter resetBreadcrumbs: true
      20:03:23 DEBUG (JhsActionServlet) -Parameter ArgUser: 891003

      [9/20/06 20:03:24:375 CST] 56791026 WebGroup E SRVE0026E: [Servlet Error]-[sun/security/provider/Sun]: java.lang.NoClassDefFoundError: sun/security/provider/Sun
      at oracle.jbo.common.ampool.PoolMgr.createPool(PoolMgr.java:280)
      at oracle.jbo.common.ampool.PoolMgr.findPool(PoolMgr.java:482)
      at oracle.adf.model.bc4j.DataControlFactoryImpl.findOrCreateSessionCookie(DataControlFactoryImpl.java:136)
      at oracle.adf.model.bc4j.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:221)
      at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:63)
      at oracle.adf.model.BindingContext.get(BindingContext.java:411)
      at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:228)
      at oracle.adf.model.binding.DCUtil.findContextObject(DCUtil.java:308)
      at oracle.adf.model.binding.DCIteratorBinding.(DCIteratorBinding.java:127)
      at oracle.jbo.uicli.binding.JUIteratorBinding.(JUIteratorBinding.java:59)
      at oracle.jbo.uicli.binding.JUIteratorDef.createIterBinding(JUIteratorDef.java:58)
      at oracle.jbo.uicli.binding.JUIteratorDef.createIterBinding(JUIteratorDef.java:47)
      at oracle.adf.model.binding.DCBindingContainerDef.createIterBindings(DCBindingContainerDef.java:197)
      at oracle.adf.model.binding.DCBindingContainerDef.createBindingContainer(DCBindingContainerDef.java:273)
      at oracle.adf.model.binding.DCBindingContainerReference.getBindingContainer(DCBindingContainerReference.java:40)
      at oracle.adf.model.BindingContext.get(BindingContext.java:427)
      at oracle.adf.model.BindingContext.findBindingContainer(BindingContext.java:288)
      at oracle.jheadstart.view.strutsadf.JhsBindingContainerActionForm.reset(JhsBindingContainerActionForm.java:416)
      at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
      at oracle.jheadstart.controller.strutsadf.JhsRequestProcessor.process(JhsRequestProcessor.java:385)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
      at oracle.jheadstart.controller.strutsadf.JhsActionServlet.process(JhsActionServlet.java:130)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
      at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
      at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
      at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1033)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:603)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
      at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
      at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
      at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
      at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345)
      at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:582)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:260)
      at oracle.jheadstart.controller.strutsadf.JhsRequestProcessor.process(JhsRequestProcessor.java:385)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
      at oracle.jheadstart.controller.strutsadf.JhsActionServlet.process(JhsActionServlet.java:130)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
      at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
      at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
      at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
      at oracle.jheadstart.controller.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:176)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1029)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:603)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
      at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
      at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
      at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
      at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
      at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:449)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)

    2. Wiene Howeler on

      The application we created was also using Struts, so it is possible.
      But it was BC4J 9.0.3. Do you have a newer version? If this is the case, you probably need a different list with jar-files (step 1)

    3. I did all the above. It works fine for JSP files but when Struts framework is encountered (like .do files)
      it is not working. Please help me.

      Thanks
      Venkat