Monday, July 9, 2012

org.omg.CORBA.NO_PERMISSION Exception


Whenever we are hitting ejb service from portal which is deployed on different WAS , and if we face the below stack trace:---

Exception = org.omg.CORBA.NO_PERMISSION
Source = com.ibm.ws.naming.jndicos.CNContextImpl.doLookup
probeid = 1489
Stack Dump = org.omg.CORBA.NO_PERMISSION:
>> SERVER (id=64e777ef, host=SVHJ0898.ideaconnect.com) TRACE START:
>>    org.omg.CORBA.NO_PERMISSION: Subject is null.  Authentication Failed.  vmcid: 0x49424000  minor code: 300  completed: No
>> at com.ibm.ISecurityLocalObjectBaseL13Impl.PrincipalAuthFailReason.map_auth_fail_to_minor_code(PrincipalAuthFailReason.java:88)
>> at com.ibm.ISecurityLocalObjectBaseL13Impl.CSIServerRIBase.authenticateSecurityTokens(CSIServerRIBase.java:2815)
>> at com.ibm.ISecurityLocalObjectBaseL13Impl.CSIServerRI.receive_request(CSIServerRI.java:622)
>> at com.ibm.rmi.pi.InterceptorManager.invokeInterceptor(InterceptorManager.java:631)
>> at com.ibm.rmi.pi.InterceptorManager.iterateServerInterceptors(InterceptorManager.java:535)
>> at com.ibm.rmi.pi.InterceptorManager.iterateReceiveRequest(InterceptorManager.java:777)
>> at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:616)
>> at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:480)
>> at com.ibm.rmi.iiop.ORB.process(ORB.java:512)
>> at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
>> at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2680)
>> at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2543)
>> at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
>> at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
>> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1560)
>> SERVER (id=64e777ef, host=SVHJ0898.ideaconnect.com) TRACE END.
  vmcid: 0x49424000  minor code: 300  completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)


1.Go To Security of the WAS.
2.Then go to global security on clicking Secure administration, applications, and infrastructure.
3. Go To Authentication mechanisms and expiration
Export the keys and import them to the Portal WAS.
Restart Portal server .


Thursday, June 14, 2012

calling ajax in jsr 286

I have created a sample portlet to show the suggestion by calling ajax:-









The sample jsp for calling the ajax as above is:


<%@page language="java" contentType="text/html; charset=ISO-8859-1"
  pageEncoding="ISO-8859-1" session="false"%>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<portlet:defineObjects />
<script type="text/javascript">
  function createXMLHttpRequestObject() {
    var xmlHttp;
    try {
      xmlHttp = new XMLHttpRequest();
    } catch (e) {
      try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
      } catch (e) {
      }
    }
    if (!xmlHttp)
      alert("Error creating the XMLHttpRequest object.");
    else
      return xmlHttp;
  }
  var xmlHttp = createXMLHttpRequestObject();
 
 
  function makeResourceCall(str){
 
 
  if (str.length==0)
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
 
    if (xmlHttp){
    var newvalue ="Harish"+str;
 
      try{
      var url ="<portlet:resourceURL></portlet:resourceURL>?txtValue="+str;
   
        xmlHttp.open("GET", url, true);
        xmlHttp.onreadystatechange = handleRequestStateChange;
       
        xmlHttp.send(null);
      }catch (e){
        alert("Can't connect to server:\n" + e.toString());
      }
    }
  }

  function handleRequestStateChange(){
    if (xmlHttp.readyState == 4){
      if (xmlHttp.status == 200){
     
      if(xmlHttp.responseText == "")
      {
      document.getElementById("txtHint").style.display="none";
      }
      else
      {
       document.getElementById("txtHint").style.display="block";
       document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
       }
      }
    }
  }
</script>

Enter Name<input type="text" name="txtValue" onkeyup="JavaScript:makeResourceCall(this.value)" >


 <!-- <p>Suggestions: <span id="txtHint"></span></p>  -->

<TEXTAREA name="annotationTxt" rows="10" cols="30" style="overflow:hidden;" id="txtHint" maxlength="235"></TEXTAREA>

<script>
function onload()
{
 document.getElementById("txtHint").style.display="none";
}
onload();
</script>


Onkeyup I am calling makeResourceCall and from makeResourceCall function calling <portlet:resourceURL>
From this the control will go the portlet class and will call the serverResource method:

 public void serveResource(ResourceRequest request, ResourceResponse response)
     throws PortletException, IOException {
     System.out.println("Entering ValidationCacheSamplePortlet.serveResource()");
     response.setContentType("text/html");
     System.out.println("String input value"+request.getParameter("txtValue"));
     inserRec rec = new inserRec();
     List list = rec.getData(request.getParameter("txtValue"));
    
    for (Iterator iterator = list.iterator(); iterator.hasNext();) 
    {
    HibernateprjPojo pojo = (HibernateprjPojo) iterator.next();
response.getWriter().println(pojo.getName());
In the serve resource method I am making a hibernate call and fetching the related values for txtValue.
From the getwritter the result will be shown in the drop down box.


Hidden portal page

To create a hidden portal page , first create a page and give it a proper unique name .
Export the portal page and save the xml.
Edit the xml and add the parameter


<parameter name="com.ibm.portal.Hidden" type="string" update="set"><![CDATA[true]]></parameter>
As shown below:-





<?xml version="1.0" encoding="UTF-8"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" build="wp6101_115_01" type="update" version="6.1.0.1" xsi:noNamespaceSchemaLocation="PortalConfig_6.1.0.xsd">
    <portal action="locate">
      
       
        <content-node action="locate" domain="rel" objectid="6_20DO18N3Q4IL40ITIA32AM2085"/>
        <content-node action="update" active="true" allportletsallowed="true" content-parentref="6_20DO18N3Q4IL40ITIA32AM2085" create-type="explicit" domain="rel" objectid="6_20DO18N3QCKQ40ITNC79MH00O6" ordinal="200" type="page" uniquename="ibm.home.test">
            <supported-markup markup="html" update="set"/>
            <localedata locale="en">
                <title>test2</title>
            </localedata>
<parameter name="com.ibm.portal.Hidden" type="string" update="set"><![CDATA[true]]></parameter>
            <parameter name="com.ibm.portal.IgnoreAccessControlInCaches" type="string" update="set"><![CDATA[false]]></parameter>
            <parameter name="com.ibm.portal.bookmarkable" type="string" update="set"><![CDATA[Yes]]></parameter>
            <parameter name="com.ibm.portal.remote-cache-expiry" type="string" update="set"><![CDATA[0]]></parameter>
            <parameter name="com.ibm.portal.remote-cache-scope" type="string" update="set"><![CDATA[NON-SHARED]]></parameter>
            <access-control externalized="false" owner="uid=wpsadmin,o=defaultWIMFileBasedRealm" private="false"/>
            <component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_20DO18N3QCKQ40ITNC79MH00O1" ordinal="100" orientation="H" skinref="undefined" type="container" width="undefined">
                <component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_20DO18N3QCKQ40ITNC79MH00O5" ordinal="100" orientation="V" skinref="undefined" type="container" width="undefined"/>
                <component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_20DO18N3QCKQ40ITNC79MH00O3" ordinal="200" orientation="V" skinref="undefined" type="container" width="undefined"/>
            </component>
        </content-node>
    </portal>
    <status element="all" result="ok"/>
</request>







Tuesday, June 12, 2012

Shared Libraries for portal project

For creating a shared library open the WAS console and create a shared variable:


















After giving the path of your shared library go to

ApplicationServer> WebSphere_Portal> and select java and process Management and select the class loader

and chhose the shared library reference.












and in the shared reference select your shared library reference:












Restart your server and deploy your war file , it will automatically take references of your jars .


Monday, June 11, 2012

PUMA API for anonymous users

For creating portlets like signUp or forget Password we need the puma api to access the user information .But before accessing attributes you have to give following  access rights others wise you won't be able to access the values.
1.From the admin console go to resource permission.

2.Select the User Groups.
3.For All Portal User Groups give the anonymous access  for USER,Editor ,Manager,Security administrator.

After that your code will work fine.



Thursday, March 1, 2012

java.lang.RuntimePermission getClassLoader exception on portlet deployment


java.lang.RuntimePermission getClassLoader issue while deploying portlet:-

When you deploy portlet in a in new environment you might get portlet error with below stack trace:--
Error occurred during portlet request dispatcher inclusion
                                 java.security.AccessControlException: Access denied (java.lang.RuntimePermission getClassLoader)
at java.security.AccessController.checkPermission(AccessController.java:103)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:558)
at com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java:214)
at java.lang.Thread.getContextClassLoader(Thread.java:497)
at org.apache.taglibs.standard.tag.common.fmt.BundleSupport.findMatch(Unknown Source)
at org.apache.taglibs.standard.tag.common.fmt.BundleSupport.findMatch(Unknown Source)
at org.apache.taglibs.standard.tag.common.fmt.BundleSupport.getLocalizationContext(Unknown Source)


Solution:-- For the non root user check for access rights by using chown -R newadmuser:newadmuser

if you are using cluster then also check for dmgr for all folders.

Common WCM and Portal Interview questions.


what is credential vault
what is themes and skin
wht are the difference between portlet and servlet
what is the credential vault
what is wcm
what is was
what is LDAP
what is WMM
what is single sign on
what are the types of portlet
what is JSR286
have u work on it
how u do the syndication
how u create Pt
what is Authoring template
how u create Workflow
how u define personalisation rule in wcm
what is the difference between portletConfig.getInitParameter()
and PortletContext.getInitParameter()
what is portlet data
what is portlet preference
how to manage portlet page
how to enable single sign on on WAS
what are the different componet u are work on WCM
which data base u r using in portal
what is Cloudscape?
what is struts navigation
what is WSDL
what is copertaive portlet
what is interportlet communication
what is portlet preference
what is the life cycle of JSR168 portlet
what are the difference between JSR168 and IBM Api
what is content agregation
what is jsp component
where u save the jsp file for jsp component
what are the WCM api
how u create a contentr using WCM api
what are the main JSP page on Themes,skin and screen
what are the file u have made changes on Portal onfiguration
how to migrate Cloudscape to Db2 and LDAP
what are the schema on cloudscape
what is PUMA
How to create JNDI on WAS