Archive

Archive for November, 2010

Apache Struts 1.3 Migration to Weblogic Portal Server 10.3.2

November 28, 2010 Leave a comment

Prerequisites:

  1. A working Struts 1.3 Application
  2. Working Weblogic Portal Installation (I used 10.3.2)
  3. struts-adapter.jar file located under the installation directory

Create a Portal Web Project with following Facets:

PortalWeb Project Facets

PortalWeb Project Facets

The migration documentation from Oracle at [1] is kind of in-complete. I thought why not blog about this topic.In the reminder of article I will scribble the configuration needed and will provide sample code for making a sample Hello World App working.

Will do the rest when I get free time. Pls. bare with me or contact me/comment here if you need this earlier



The homepage should bring up this

 

 

Unlike regular Struts based applications, WLP expects all struts based content organized as modules.

The above doc recommends having a separate struts-config for each module but it is not necessary. It also recommends having a struts config of the form struts-auto-config-<module-path>.xml, where <module-path> is the module path to the Struts application relative to the web application root, with all instances of ‘/’ or ‘\’ changed to ‘-‘, which is also not necessary.

struts-config.xml should override the default Controller

<controller processorClass="com.bea.struts.adapter.action.AdapterRequestProcessor"/>

will update the rest of the doc very soon..ping me if you need this early.

The struts-adapter.jar can be found in one of the following locations:

<BEA_HOME>/wlportal_10.3/light-portal/lib/netuix_legacy/struts-adapter.jar
<BEA_HOME>/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/struts-adapter.jar
<BEA_HOME>/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/struts-adapter.jar

Refrences:
[1]. http://download.oracle.com/docs/cd/E15919_01/wlp.1032/e14243/integrate.htm#i1005658

Debugging J2EE Applications: Some Tips

November 28, 2010 Leave a comment
Some Debugging Tips

  1. For Struts based applicataions, enable log4j logging on org.apache.struts/org.apache.struts2 package
  2. For JAX-WS Metro based Webservices, capture SOAP on the wire by setting following system property
System.setProperty(
"com.sun.xml.ws.transport.local.LocalTransportPipe.dump","true");

Installation of OpenPortal WSRP Version 2.0 on Tomcat 5.5

November 24, 2010 Leave a comment

Here is the install instruction for installing OpenPortal WSRP on Tomcat 5.5.

Step 1:Install and verify Tomcat 5.5

1. Download and Install Tomcat 5.5.x (Tested these instructions with 5.527)
2. Verify the installation by accessing the catalina home page in the browser (http://localhost:8080)

Step 2:Install and verify Portlet Container 2.0 on Tomcat

Every WSRP stable binary works with a particular version of OpenPortal PortletContainer binary. The OpenPortal WSRP download page would provide a link to the corresponding OpenPortal PortletContainer binary. Make sure you download the correct OpenPortal PortletContainer binary.

Prereq: Download Openportal container 2.1 and Openportal WSRP version 2.0 FCS from https://wsrp.dev.java.net/

  1. Download JSTL 1.1 (http://jakarta.apache.org/taglibs/index.html#Downloads). Copy standard.jar and jstl.jar to common/lib + c.tld and fmt.tld to common/classes
  2. For JDK 1.5 JRE, you need to install Metro 1.1
  3. 	catalina.sh stop
    	ant -Dtomcat.home=<tomcat install directory> -f path/to/metro/wsit-on-tomcat.xml install
    	catalina.sh start
       
  4. Copy the jar files from /lib to /common/lib
  5. java -jar portlet-container-configurator.jar Tomcat
  6. java -jar wsrp-configurator.jar /space/apache-tomcat-5.5.26/ /space/apache-tomcat-5.5.26/webapps/ Tomcat
  7. Download the corresponding OpenPortal PortletContainer. https://wsrp.dev.java.net/
  8. Restart the tomcat server and verify the portlet-container configuration by accessing the portlet driver admin page
  9. java -jar /wsrp-configurator.jar Tomcat
  10. Restart Tomcat server and verify the installation by accessing portletdriver at http://localhost:8080/portletdriver to see the WSRP tab and the admin portlets deployed

Customizing WSRP SOAP MIME Headers

November 23, 2010 Leave a comment

For Federated Portals, WSRP Interceptor framework can be used on the Consumer side to customizing the SOAP MIME Headers

The interceptors are configured in wsrp-consumer-handler-config.xml, a web application scoped configuration file. This configuration file requires two entries: interceptor and interceptor-group. Both of these entries must be present in the configuration file. The <producer-handle> – is optional, omitting which applies the interceptor to all producers the consumer invokes.

<interceptor>
    <name>CustomMimeHeaderInterceptor</name>
    <class-name>com.vbandaru.consumer.interceptors.CustomizeMimeHeaderInterceptor</class-name>
</interceptor>
 <interceptor-group>
    <name>Group1</name>
    <producer-handle>MyProducer</producer-handle>
    <interceptor-name>CustomMimeHeaderInterceptor</interceptor-name>
</interceptor-group>

The following class does the actual magic:


package com.vbandaru.consumer.interceptors;
import com.bea.wsrp.consumer.interceptor.IGetMarkupInterceptor;
import com.bea.wsrp.model.markup.IGetMarkupRequestContext;
import com.bea.wsrp.model.markup.IGetMarkupResponseContext;
import com.bea.wsrp.consumer.interceptor.Status;
import weblogic.xml.util.StringInputStream;

public class CustomMimeHeaderInterceptor implements IGetMarkupInterceptor
{
    public Status.PreInvoke preInvoke(IGetMarkupRequestContext requestContext)
    {

        //Either of below methods can be used to pass 
        //custom SOAP Mime Headers to WSRP Producer
        //addMimeHeader - Adds a custom HTTP Header with the supplied name 
        //and the supplied value to the underlying SOAP message.
        //setMimeHeader -  Associates the supplied value to an 
        //HTTP header identified by the supplied name
        requestContext.setMimeHeader("myHeadername", "myHeaderValue") ;
        return Status.PreInvoke.CONTINUE_CHAIN;
    }

    public Status.PostInvoke postInvoke(IGetMarkupRequestContext requestContext,
    IGetMarkupResponseContext responseContext)
    {

        return Status.PostInvoke.CONTINUE_CHAIN;
    }

    public Status.OnFault onFault(IGetMarkupRequestContext requestContext,
    IGetMarkupResponseContext responseContext, Throwable t)
    {

        return Status.OnFault.HANDLED;
    }

    public Status.OnIOFailure onIOFailure(IGetMarkupRequestContext requestContext,
    IGetMarkupResponseContext responseContext, Throwable t)
    {
        return Status.OnIOFailure.CONTINUE_CHAIN;
    }
}

On Producer, the header can be retrieved using

 String customHeader  = request.getHeader("myHeadername");

ResourceProxyServlet Implementation

November 23, 2010 Leave a comment

Customizing headers for WSRP consumer Resource URLs is discussed in [1]

References
[1]. http://cn.forums.oracle.com/forums/thread.jspa?messageID=3058314

Some useful Database commands

November 22, 2010 Leave a comment

Grant Trigger permission to a MySQL user:

GRANT TRIGGER ON <DBNAME>.* to <USER>;

WSRP Interoporability with Weblogic Producer

November 22, 2010 Leave a comment

I am doing more R&D on this topic. I am currently working on Interop of a Weblogic 10.3.2 producer with following open (non-commercial) portlet implementations.

  • WSRP4J
  • Open Portal Container + Open Portal WSRP Implemenation
  • liferay

For now I am listing all references I am using here, will post resuts of my R&D here soon.

Resources

[1]. http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/interopwsrp/example.html

Weblogic Server: RDBMS Security Store Errors

November 19, 2010 Leave a comment

Following error is thrown on Weblogic Server domain startup. Apparently as discussed in [1] and [2], this is due to incorrect test query (Table SYSTABLES applies for pointbase only).This is not a bug. Weblogic server execute test query to test jdbc connection. You can change this test query on Weblogic Server Administration Console. Open the administration console (default: http://localhost:7001/console/) and change the “Test Table Name:” field under “yourserver -> services-> jdbc -> data sources -> cgDataSource (or other data sources) -> advanced” and write your Database test query.For Instance, “Select * from dual” for Oracle.

<Sep 17, 2010 12:48:05 PM IST> <Error> <JDBC> <BEA-001112> <Test "SELECT COUNT(*) FROM SYSTABLES" set up for pool "appsGroupSpaceDataSource" failed with exception: "java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
".>
<Sep 17, 2010 12:48:05 PM IST> <Error> <JDBC> <BEA-001112> <Test "SELECT COUNT(*) FROM SYSTABLES" set up for pool "cgDataSource" failed with exception: "java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
".>
<Sep 17, 2010 12:48:06 PM IST> <Error> <JDBC> <BEA-001112> <Test "SELECT COUNT(*) FROM SYSTABLES" set up for pool "cgDataSource-nonXA" failed with exception: "java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
".>
<Sep 17, 2010 12:48:06 PM IST> <Error> <JDBC> <BEA-001112> <Test "SELECT COUNT(*) FROM SYSTABLES" set up for pool "p13nDataSource" failed with exception: "java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
".>
<Sep 17, 2010 12:48:07 PM IST> <Error> <JDBC> <BEA-001112> <Test "SELECT COUNT(*) FROM SYSTABLES" set up for pool "portalDataSource" failed with exception: "java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
".> 

References:

[1]. http://forums.oracle.com/forums/thread.jspa?threadID=1130337&tstart=0
[2].http://forums.oracle.com/forums/thread.jspa?threadID=2134807&tstart=0

Configure RDBMS Security store for Weblogic Server

November 19, 2010 Leave a comment

Nice post on configuring RDBMS Security store for Weblogic Server here

Protected: Posting Source Code on WordPress

November 18, 2010 Enter your password to view comments.

This content is password protected. To view it please enter your password below: