Archive

Archive for the ‘Weblogic Portal’ Category

Weblogic WSRP Keystore

February 10, 2011 Leave a comment

wsrpKeystore.jks found in domain root password:password

Goto myrealm –> Providers –> Credential Mapping –> PKICredentialMapper –> Provider Specific –> you should see details for wsrpKeystore.jks

Now list keystore entires:

$keytool -list -v -keystore DOMAIN_HOME/wsrpKeystore.jks
pasword: password

should list the alias name wsrpconsumer

Goto myrealm –> Credential Mappings –> PKI tab you should see PKI Credential Mappings. Click on wsrpconsumer__81_COMPAT, you will notice it will use alias from above keystore ‘wsrpconsumer’

OpenPortal/Weblogic WSRP Interoperability: URL Rewriting Issue

December 11, 2010 Leave a comment

I am trying to consume a Open Portal 2.0 Producer (JSR 286) on Weblogic 10.3.2 Consumer.

Issue: Encoded URL has un-necessary tokens making the resouce URLs break on the consumer side.

I am rendering an image like this with src attribute =

<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/ico_normal.jpg")%> 

which produces following url on the consumer:

 http://localhost:7001/ConsumerApp/resource/cs__pageLabel%3Dtest_portal_page_2_page_3%26_portlet.portalUrl%3D%252FConsumerApp%252Fconsumer%252Ftest.portal%26_st%3D%26_windowLabel%3DhelloWorldPortletInvoicePortletMINE_1/u_http%3A%2F%2Flocalhost%3A8080%2FhelloWorldPortlet%2Fico_normal.jpg/id_/rr_false/po_/rs_/rc_/iu_oracle:immutableURI/*wsrp*separatororacle:mutableURI;jsessionid=Y1lnM27Zk68ZQ86sBvG19Js9vcncmGTR8s5WStcLQtS448nZ2fQT!-1164873313?oracle:mutableParameters 

Please notice the tokens that start with {oracle:mutable*} in above URL which makes the images not to render on the consumer. Once I remove these tokens ({oracle:immutableURI} , {oracle:mutableURI} and {oracle:mutableParameters})and paste in the browser, the image do show up. The solution seems to be while generating the WSRP markup, if I can replace all the tokens of form {oracle:mutable *blah …} with empty string, I will arrive at a solution.

The consumer is sending the following URL template for wsrp-resource:

http://url:domain:url:port/url:path/resource/cs_url:queryString/u_wsrp-url/id_wsrp-resourceID/rr_wsrp-requiresRewrite/po_wsrp-preferOperation/rs_wsrp-resourceState/rc_wsrp-resourceCacheability/iu_oracle:immutableURI/*wsrp*separatororacle:mutableURI?oracle:mutableParameters 

Even section 9.2.2 of the WSRP 2.0 specification says, the producer MUST replace all tokens in the consumer-supplied URL template with values, including replacing all tokens for which it does not have a value (or does not understand) with the empty string. So the “{oracle:immutableURI}” and “{oracle:mutableURI}” tokens should be getting replaced with “” (the empty string) by the producer.

#1. is this a bug? what specific Java classes in the source deal with handling encoding so that I can touch them to hotfix this issue for the timebeing in my environment?

#2. Is there any flag or configuration that enable the Producer to use “consumer URL rewriting”?

Open Portal WSRP: CSS class name collision

December 2, 2010 4 comments

We have a Open Portal 2.1.2 Producer running on Tomcat 5.5.26.The producer hosts JSR 286 portlets. The consumer is Weblogic 10.3.2 Portal based.

Issue : On the consumer, the CSS style class collide with styles of other portlets. One solution to prevent this collision is to use unque CSS class names but on consumer side federated portal there is no guarantee that the it does not have the style that producer has.

There is a nice article on SDN (see [3]), discussing the javascript namespace collision, suggests prefixing JavaScript variables and functions with <portlet:namespace/>.This is a great solution but,for an external CSS file, there is no way we can use <portlet:namespace/>. For internal CSS in JSP, we can prefix the CSS class with <portlet:namespace/>_someClass.

Rest of the article explains how this can be achieved for External CSS.

original external css file : sample.css

#_someClass
{
width:300px;
word-spacing:12px;
font-size:90%;
padding-left:12px;
padding-right:10px;
white-space:nowrap
}

:
:
:

Orginal sample.jsp

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />
<%PortletPreferences prefs = renderRequest.getPreferences();%>

<link rel="stylesheet" type="text/css" href="<%=renderResponse.encodeURL(renderRequest.getContextPath() + "/sample.css")%>"/>

<div id="someClass">
<p>some portlet content goes here</p>
</div>

Now, the approach is to generate the CSS dynamically by prefixing the namespace for each class. The namespace is passed from the sample.jsp to the dynamic CSS generating page as a request paramter as shown below.

Modified CSS file: sample.css.jsp

<% String namespace = request.getParamter("namespace");
<style type="text/css">
.<%=namespace %>_someClass
{
width:300px;
word-spacing:12px;
font-size:90%;
padding-left:12px;
padding-right:10px;
white-space:nowrap
}

:
:
:
</style>

Modified sample.jsp

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />
<%PortletPreferences prefs = renderRequest.getPreferences();%>

<%-- removed link tag and added dynamic CSS page using <jsp:include .../>--%>
<jsp:include page="/sample.css.jsp">
   <jsp:param name="namespace" value="<portlet:namespace/>"/>
</jsp:include>

<%-- prefix css class with namespace --%>
<div id="<portlet:namespace/>_someClass">
<p>some portlet content goes here</p>
</div>

This should resolve the namespace collision issue on the consumer.

References

[1]. My original post on this issue at OpenPortal forums

[2]. My Original post on this issue at Oracle OTN forums

[3]. Nice article on OpenPortal from SDN

Sample WSRP Producer URL

December 1, 2010 Leave a comment

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

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");

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

wldeploy: versioning of WebServices is not supported

November 18, 2010 1 comment

Following error is thrown when running wldeploy with redeploy flag.


<Nov 18, 2010 9:46:13 AM EST> <Error> <HTTP> <BEA-101355> <[weblogic.webservice.server.servlet.WebServiceServlet@2fe9b2e] Version b1 is specified for WebServices CampaignWS,PropertySetWS, but versioning of WebServices is not supported.> 
<Nov 18, 2010 9:46:13 AM EST> <Error> <HTTP> <BEA-101216> <Servlet: "WebServiceServlet" failed to preload on startup in Web application: "MyProducerEARToolSupport".
javax.servlet.ServletException: [HTTP:101355][weblogic.webservice.server.servlet.WebServiceServlet@2fe9b2e] Version b1 is specified for WebServices CampaignWS,PropertySetWS, but versioning of WebServices is not supported.
        at weblogic.webservice.server.servlet.WebServiceServlet.checkAppVersion(WebServiceServlet.java:173)
        at weblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebServiceServlet.java:113)
        at weblogic.webservice.server.servlet.WebServiceServlet.init(WebServiceServlet.java:97)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
        Truncated. see log file for complete stacktrace
> 
<Nov 18, 2010 9:46:13 AM EST> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application 'MyProducer [Version=b1]'.
weblogic.application.ModuleException: [HTTP:101216]Servlet: "WebServiceServlet" failed to preload on startup in Web application: "MyProducerEARToolSupport".
javax.servlet.ServletException: [HTTP:101355][weblogic.webservice.server.servlet.WebServiceServlet@2fe9b2e] Version b1 is specified for WebServices CampaignWS,PropertySetWS, but versioning of WebServices is not supported.
        at weblogic.webservice.server.servlet.WebServiceServlet.checkAppVersion(WebServiceServlet.java:173)
        at weblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebServiceServlet.java:113)
        at weblogic.webservice.server.servlet.WebServiceServlet.init(WebServiceServlet.java:97)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
        at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:531)
        at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1915)
        at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1889)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1807)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3045)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1397)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:460)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:54)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
        at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
        at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)
        at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
        at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
        at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
        at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
        at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
        at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1399)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:460)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        Truncated. see log file for complete stacktrace

Caused By: javax.servlet.ServletException: [HTTP:101355][weblogic.webservice.server.servlet.WebServiceServlet@2fe9b2e] Version b1 is specified for WebServices CampaignWS,PropertySetWS, but versioning of WebServices is not supported.
        at weblogic.webservice.server.servlet.WebServiceServlet.checkAppVersion(WebServiceServlet.java:173)
        at weblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebServiceServlet.java:113)
        at weblogic.webservice.server.servlet.WebServiceServlet.init(WebServiceServlet.java:97)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
        Truncated. see log file for complete stacktrace
> 

As suggested in [1], the solution is to comment out following section in weblogic-application.xml

weblogic-application.xml

<wls:library-ref>
<wls:library-name>wlp-tools-support-app-lib</wls:library-name>
<wls:specification-version>10.3.2</wls:specification-version>
<wls:implementation-version>10.3.2</wls:implementation-version>
</wls:library-ref>

References
[1]. http://kr.forums.oracle.com/forums/thread.jspa?threadID=804617