Deploy/container/WebLogic

From Omar Wiki

Jump to: navigation, search

This page describes how to use BEA WebLogic web container for deploying freebXML Registry server code.

Contents

Overview and Concepts

BEA WebLogic is a commercial product that provides a web container.

Known Versions Supported

OMAR codes (specifically the thin browser web application) is developed to Servlet 2.4 specification. Weblogic 8.x supports Servlet 2.3 only and hence will not work without major reworks. Weblogic 9.x supports Servlet 2.4 and hence should work. Specifically, i have tried Weblogic Server 9.2 and with some tweaking it works pretty well.

Deploying OMAR

Here are the step-by-step guide to get OMAR to work on Weblogic Server 9.2:

1. Download/check out the latest source from OMAR CVS. 2. Edit the build.properties accordingly (eg. set the jwsdp-1.6 home directory and database configuration settings) 3. Before you start building omar, you need to modify one of the JSP file that causes error during runtime. Get hold of the Footer.jsp file, locate the following lines :


       <c:if test="${registryBrowser.aboutEbxmlDisplayed}">
<f:verbatim>
</f:verbatim>
       <h:outputText escape="false" id="footerCopyrightOut" value="#{registryBrowser.companyCopyright}"/>
       <h:outputLink id="aboutebXMLLink"
          value="#{registryBrowser.aboutEbxml}" target="_new">
          <h:outputText id="aboutebXMLOut" value="#{bundle.aboutebXML}"/>
       </h:outputLink>
       </c:if>
       <c:if test="${registryBrowser.aboutRegistryDisplayed}">
       <h:outputText escape="false" id="footerCopyrightOut" value="#{registryBrowser.companyCopyright}"/> 

4. Change the second id="footerCopyrightOut" to someother id such as id="footerCopyrightOut2" etc, as Weblogic will complain about the duplicate id during runtime and causes the webapp to fail.

5. Do a build compile. 6. Do a build jars 7. Do a build war

Ok.. now you are ready to deploy to Weblogic... you can either do manual install using the admin console provided by Weblogic Server 9.2 or use the ant scripts. Before that you need to configure the JNDI for the omar datasource.

Modify the startWeblogic script:

1. First add your JDBC driver to the classpath of the server locate the setDomainEnv.cmd (or setDomainEnv.sh) in the bin\ directory of the server instance (in the specified domain). add the following line to the line after set CLASSPATH .....

  set CLASSPATH=C:\apps\postgresql\jdbc\postgresql-8.1-405.jdbc2ee.jar;%CLASSPATH%

2. Secondly, you need to force the SAAJ MessageFactory and SOAPFactory to use the JWSDP implementation class. By default, the SOAPFactory will instantiate the one provided by Weblogic (in the webservices.jar), and it does not seem to be able to handle the SOAP message (complaining about SAAJ 1.1 not supported ..) This is what I do, I set the following properties in the JAVA_OPTIONS:

-Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl -Djavax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl

eg:

 set JAVA_OPTIONS=%JAVA_OPTIONS% %JAVA_PROPERTIES% -Dwlw.iterativeDev=%iterativeDevFlag% 
 -Dwlw.testConsole=%testConsoleFlag% -Dwlw.logErrorsToConsole=%logErrorsToConsoleFlag% 
 -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl 
 -Djavax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl


Deploy script

1. I modified the build.xml to include the following targets to deploy and configure jdbc

 <target name="deploy.weblogic">
   <wldeploy action="deploy" verbose="true" debug="true" name="omar" source="c:\temp\omar" user="weblogic" password="weblogic" adminurl="t3://localhost:7001" targets="examplesServer" />
 </target>
 <target name="undeploy.weblogic">
     <wldeploy action="undeploy" verbose="true" debug="true" name="omar" user="weblogic" password="weblogic" adminurl="t3://localhost:7001" targets="examplesServer" failonerror="false" />
 </target>
 <target name="weblogic.configureJDBC">
   <wlconfig url="t3://localhost:7001" username="weblogic" password="weblogic">
      <query domain="wl_server" type="Server" name="examplesServer" property="omarserver" />
      <create type="JDBCConnectionPool" name="omarPool" property="omarpool">
       <set attribute="CapacityIncrement" value="1" />
       <set attribute="DriverName" value="org.postgresql.Driver" />
       <set attribute="InitialCapacity" value="1" />
       <set attribute="MaxCapacity" value="10" />
       <set attribute="Password" value="omar" />
       <set attribute="Properties" value="user=omar" />
       <set attribute="RefreshMinutes" value="0" />
       <set attribute="ShrinkPeriodMinutes" value="15" />
       <set attribute="ShrinkingEnabled" value="true" />
       <set attribute="TestConnectionsOnRelease" value="false" />
       <set attribute="TestConnectionsOnReserve" value="false" />
       <set attribute="URL" value="jdbc:postgresql://localhost:5432/omar" />
       <set attribute="Targets" value="${omarserver}" />
     </create>
     <create type="JDBCTxDataSource" name="OMAR Tx DataSource">
       <set attribute="JNDIName" value="jdbc/omar-registry" />
       <set attribute="PoolName" value="omarPool" />
       <set attribute="Targets" value="${omarserver}" />
       </create>
  </wlconfig>
 </target>

NOTE: you must deploy from the expanded WAR. If you deploy using a omar.war, the web app will fail as it cannot get the realpath from the context in one of the omar classes.

Links