osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: GridSphere 2.1.4 and OGSA-DAI WSRF 2.1 Portlet -
msg#00095

List: java.gridsphere.user

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

Dear all,

I have wrote successfully a simple client for the grid services OGSA-DAI wsrf 2.1 deployed in Globus Toolkit 4.0.1. Before executing it, I have to logon to My Proxy Server.

 

Now I’m writing a portlet JSR 168 compliant for the gridsphere portal 2.1.4 using OGSA-DAI wsrf 2.1 API.

This is the code:

 

 

package ogsadai.OracleResource.portlets;

 

//(c) International Business Machines Corporation, 2005.

//(c) University of Edinburgh, 2005.

//See OGSA-DAI-Licence.txt for licencing information.

 

import javax.portlet.GenericPortlet;

import javax.portlet.RenderRequest;

import javax.portlet.RenderResponse;

 

import java.util.List;

 

import java.io.PrintWriter;

import java.io.IOException;

import java.io.File;

 

import uk.org.ogsadai.client.toolkit.GenericServiceFetcher;

import uk.org.ogsadai.client.toolkit.Response;

import uk.org.ogsadai.client.toolkit.activity.ActivityRequest;

import uk.org.ogsadai.client.toolkit.activity.sql.SQLQuery;

import uk.org.ogsadai.client.toolkit.activity.sql.WebRowSet;

import uk.org.ogsadai.client.toolkit.security.wsrf.GSITransportEncryptionProperty;

import uk.org.ogsadai.client.toolkit.service.DataService;

import uk.org.ogsadai.client.toolkit.service.ConfigurableDataService;

import uk.org.ogsadai.client.toolkit.security.wsrf.SecurityConfigProperty;

import uk.org.ogsadai.client.toolkit.exception.ServiceCommsException;

 

import org.gridlab.gridsphere.portlet.service.spi.PortletServiceFactory;

import org.gridlab.gridsphere.portlet.service.PortletService;

import org.gridlab.gridsphere.portlet.service.spi.impl.SportletServiceFactory;

import org.gridlab.gridsphere.portlet.service.PortletServiceException;

import org.gridlab.gridsphere.services.security.gss.CredentialManagerService;

import org.gridlab.gridsphere.portlet.impl.SportletProperties;

import org.gridlab.gridsphere.portlet.User;

import org.ietf.jgss.GSSCredential;

import uk.org.ogsadai.common.SecurityContext;

 

 

/**

* This example shows how to connect to a secure data service using transport

* level security.

*

* @author The OGSA-DAI team.

*/

public class Client extends GenericPortlet {

 

public void doView(RenderRequest req, RenderResponse resp) throws IOException

  {

     

      resp.setContentType("text/html");

      PrintWriter out = resp.getWriter();

      GSSCredential credential = null;

      CredentialManagerService credentialManagerService = null;

      PortletServiceFactory factory = SportletServiceFactory.getInstance();

      try

      {

         credentialManagerService = (org.gridlab.gridsphere.services.security.gss.CredentialManagerService)factory.createPortletService(org.gridlab.gridsphere.services.security.gss.CredentialManagerService.class,null,true);

      }

      catch (PortletServiceException e)

      {

          out.println("Unable to initialize required portlet services "+e);

      }

      User user = (User)req.getAttribute(SportletProperties.PORTLET_USER);

      List credentialList = credentialManagerService.getActiveCredentials(user);

      if (credentialList.size() > 0)

      {

         credential = (GSSCredential)credentialList.get(0);

      }

     

     

      // set up service URL and resource ID

      String handle = "https://my_machine:8443/wsrf/services/ogsadai/DataService";

      String id = "OracleResource";

      out.println(handle);

      try

      {

         out.println("Credential DN: "+ credential.getName().toString());

         SecurityContext s = new SecurityContext(credential.getName().toString(),credential);

      }

      catch (Exception e)

      {

          out.println("Errore di sicurezza: "+e);

      }

 

      // Locate a Data Service

      //DataService secureService = GenericServiceFetcher.getInstance().getWSRFDataService(handle, id);

 

      // Setup message level security

 

      ConfigurableDataService secureService = null;

      try

      {     

         secureService = GenericServiceFetcher.getInstance().getConfigurableDataService(handle,id);

      }

      catch (ServiceCommsException e)

      {

         out.println("        ERROR:  "+e);

         out.println("        URL:  "+e.getURL());

      }

      catch (Exception e)

      {

         out.println("        ERROR:  "+e);

      }

 

      SecurityConfigProperty securityProperty = new SecurityConfigProperty(new File("/usr/local/ogsadai-wsrf-2.1/examples/src/uk/org/ogsadai/examples/clienttoolkit/MLSecurityDescriptor.xml"));

      secureService.setConnectionProperty(securityProperty);

      // Setup encryption

      //secureService.setConnectionProperty(new GSITransportEncryptionProperty());

 

      out.println("Ready to connect to secure data service at " + secureService.getURL());

 

      // Now perform a simple SQLQuery

           SQLQuery query = new SQLQuery("select * from prova");

      WebRowSet rowset = new WebRowSet( query.getOutput() );

      ActivityRequest request = new ActivityRequest();

      request.add( query );

      request.add( rowset );

      out.println(" Performing SQL query...");

      Response response=null;

      try

      {

         response = secureService.perform( request );

      }

      catch (Exception e)

      {

         out.println(e);

      }

      out.println("Response:\n" + response.getAsString());

 

  }

}

 

 

When I run the portlet above deployed into GridSphere 2.1.4, I obtain the following error:

 

uk.org.ogsadai.client.toolkit.exception.ServiceCommsException: A problem arose during communication with service https://my_machine:8443/wsrf/services/ogsadai/DataService?WSDL. Message: Default SSL context init failed: null An error arose in a non-OGSA-DAI class. Message: Default SSL context init failed: null

 

I think it is related with context initilizing i.e it’s necessary to pass credential to the method ‘getConfigurableDataService(String handle,String id)’.

In the source code above I have recovered portal’s user credential within MyProxy Server and I want to pass it when I invoke getConfigurableDataService(handle,id) method.

 

Have you experiences with OGSA-DAI and in particular with OGSA-DAI 2.1 in a web application?

 

 

Thanks in advance for your help and excuse me for my English.

 

 

Vincenzo Gioviale

 

Thread at a glance:

Previous Message by Date:

Compatibility with other portlets

Dear all, in a 2004 paper on GridSphere I read that it supports both the IBM WebSphere and JSR 168 Portlet API. Does "API" mean "portlets" as well? And is this still the case with GS 2.1.4? The thing is: I was wondering if one could profit from the large list of portlets for WebSphere available at http://catalog.lotus.com/wps/portal . As an example, I downloaded (after some elaborate registration process :-) the free Calculator WAR from there and tried to upload/deploy it via the GS Portlet Application Manager as admin. It replied with "Successfully deployed webapp: Calculator", but it does not show up anywhere and the tomcat log looks erroneous as well. (I supply the latter for convenience below.) I would be very glad if you could tell me your experiences whether and how non-Gridsphere portlets could be used with Gridsphere. Thanks a lot, Martin ----------- tomcat log ----------------------------------------------- 26.05.2006 12:15:07 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive Calculator.war 26.05.2006 12:15:07 org.apache.catalina.startup.HostConfig deployWAR SCHWERWIEGEND: Error deploying web application archive Calculator.war java.lang.NoClassDefFoundError: org/apache/jetspeed/portlet/PortletAdapter at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1034) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4197) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1175) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558) at java.lang.Thread.run(Thread.java:534) -- ----------------------------------------------------------------------- Martin Haase DAASI International GmbH phone: +49 7071 2970335 Wilhelmstr. 106 Fax : +49 7071 295114 D-72074 Tübingen email: martin.haase@xxxxxxxx Germany Web : http://www.daasi.de Directory Applications for Advanced Security and Information Management -----------------------------------------------------------------------

Next Message by Date:

Re: Compatibility with other portlets

Hi Martin, Although the original API was based on WebSphere 4.1 (which itself was taken from Apache Jetspeed at the time), the basic problem is that we use our own namespace. This is why in your stack trace, it says: java.lang.NoClassDefFoundError: org/apache/jetspeed/portlet/PortletAdapter when in fact it exists in the GridSphere codebase as org/gridlab/gridsphere/portlet/PortletAdapter This brings up a serious limitation-- unless you have the source code, it would be impossible to refactor the class names to use the gridsphere namespace. I have to say, that as we move further into the direction of standards, we're hoping to deprecate the old portlet API. I'm sure many portlet vendors are already quickly refactoring to the JSR-168 standards since they gain a foothold in a much larger portal marketplace outside of IBM WebSphere. Cheers, Jason Martin Haase wrote: Dear all, in a 2004 paper on GridSphere I read that it supports both the IBM WebSphere and JSR 168 Portlet API. Does "API" mean "portlets" as well? And is this still the case with GS 2.1.4? The thing is: I was wondering if one could profit from the large list of portlets for WebSphere available at http://catalog.lotus.com/wps/portal . As an example, I downloaded (after some elaborate registration process :-) the free Calculator WAR from there and tried to upload/deploy it via the GS Portlet Application Manager as admin. It replied with "Successfully deployed webapp: Calculator", but it does not show up anywhere and the tomcat log looks erroneous as well. (I supply the latter for convenience below.) I would be very glad if you could tell me your experiences whether and how non-Gridsphere portlets could be used with Gridsphere. Thanks a lot, Martin ----------- tomcat log ----------------------------------------------- 26.05.2006 12:15:07 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive Calculator.war 26.05.2006 12:15:07 org.apache.catalina.startup.HostConfig deployWAR SCHWERWIEGEND: Error deploying web application archive Calculator.war java.lang.NoClassDefFoundError: org/apache/jetspeed/portlet/PortletAdapter at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1034) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4197) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1175) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558) at java.lang.Thread.run(Thread.java:534)

Previous Message by Thread:

Compatibility with other portlets

Dear all, in a 2004 paper on GridSphere I read that it supports both the IBM WebSphere and JSR 168 Portlet API. Does "API" mean "portlets" as well? And is this still the case with GS 2.1.4? The thing is: I was wondering if one could profit from the large list of portlets for WebSphere available at http://catalog.lotus.com/wps/portal . As an example, I downloaded (after some elaborate registration process :-) the free Calculator WAR from there and tried to upload/deploy it via the GS Portlet Application Manager as admin. It replied with "Successfully deployed webapp: Calculator", but it does not show up anywhere and the tomcat log looks erroneous as well. (I supply the latter for convenience below.) I would be very glad if you could tell me your experiences whether and how non-Gridsphere portlets could be used with Gridsphere. Thanks a lot, Martin ----------- tomcat log ----------------------------------------------- 26.05.2006 12:15:07 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive Calculator.war 26.05.2006 12:15:07 org.apache.catalina.startup.HostConfig deployWAR SCHWERWIEGEND: Error deploying web application archive Calculator.war java.lang.NoClassDefFoundError: org/apache/jetspeed/portlet/PortletAdapter at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1034) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4197) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1175) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1305) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558) at java.lang.Thread.run(Thread.java:534) -- ----------------------------------------------------------------------- Martin Haase DAASI International GmbH phone: +49 7071 2970335 Wilhelmstr. 106 Fax : +49 7071 295114 D-72074 Tübingen email: martin.haase@xxxxxxxx Germany Web : http://www.daasi.de Directory Applications for Advanced Security and Information Management -----------------------------------------------------------------------

Next Message by Thread:

Re: GridSphere 2.1.4 and OGSA-DAI WSRF 2.1 Portlet

Hi Vincezo, A quick glance at your code looks fine (at least the gridsphere/gridportlets usage). My suggestion would be to have a look at the server logs of the OGSA-DAI webservice. Probably you might try posting this to the OGSA DAI mail list as well, and let us know if you find out anything :-) Cheers, Jason Vincenzo Gioviale wrote: Dear all, I have wrote successfully a simple client for the grid services OGSA-DAI wsrf 2.1 deployed in Globus Toolkit 4.0.1. Before executing it, I have to logon to My Proxy Server. Now I’m writing a portlet JSR 168 compliant for the gridsphere portal 2.1.4 using OGSA-DAI wsrf 2.1 API. This is the code: package ogsadai.OracleResource.portlets; //(c) International Business Machines Corporation, 2005. //(c) University of Edinburgh, 2005. //See OGSA-DAI-Licence.txt for licencing information. import javax.portlet.GenericPortlet; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import java.util.List; import java.io.PrintWriter; import java.io.IOException; import java.io.File; import uk.org.ogsadai.client.toolkit.GenericServiceFetcher; import uk.org.ogsadai.client.toolkit.Response; import uk.org.ogsadai.client.toolkit.activity.ActivityRequest; import uk.org.ogsadai.client.toolkit.activity.sql.SQLQuery; import uk.org.ogsadai.client.toolkit.activity.sql.WebRowSet; import uk.org.ogsadai.client.toolkit.security.wsrf.GSITransportEncryptionProperty; import uk.org.ogsadai.client.toolkit.service.DataService; import uk.org.ogsadai.client.toolkit.service.ConfigurableDataService; import uk.org.ogsadai.client.toolkit.security.wsrf.SecurityConfigProperty; import uk.org.ogsadai.client.toolkit.exception.ServiceCommsException; import org.gridlab.gridsphere.portlet.service.spi.PortletServiceFactory; import org.gridlab.gridsphere.portlet.service.PortletService; import org.gridlab.gridsphere.portlet.service.spi.impl.SportletServiceFactory; import org.gridlab.gridsphere.portlet.service.PortletServiceException; import org.gridlab.gridsphere.services.security.gss.CredentialManagerService; import org.gridlab.gridsphere.portlet.impl.SportletProperties; import org.gridlab.gridsphere.portlet.User; import org.ietf.jgss.GSSCredential; import uk.org.ogsadai.common.SecurityContext; /** * This example shows how to connect to a secure data service using transport * level security. * * @author The OGSA-DAI team. */ public class Client extends GenericPortlet { public void doView(RenderRequest req, RenderResponse resp) throws IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); GSSCredential credential = null; CredentialManagerService credentialManagerService = null; PortletServiceFactory factory = SportletServiceFactory.getInstance(); try { credentialManagerService = (org.gridlab.gridsphere.services.security.gss.CredentialManagerService)factory.createPortletService(org.gridlab.gridsphere.services.security.gss.CredentialManagerService.class,null,true); } catch (PortletServiceException e) { out.println("Unable to initialize required portlet services "+e); } User user = (User)req.getAttribute(SportletProperties.PORTLET_USER); List credentialList = credentialManagerService.getActiveCredentials(user); if (credentialList.size() > 0) { credential = (GSSCredential)credentialList.get(0); } // set up service URL and resource ID String handle = "https://my_machine:8443/wsrf/services/ogsadai/DataService"; String id = "OracleResource"; out.println(handle); try { out.println("Credential DN: "+ credential.getName().toString()); SecurityContext s = new SecurityContext(credential.getName().toString(),credential); } catch (Exception e) { out.println("Errore di sicurezza: "+e); } // Locate a Data Service //DataService secureService = GenericServiceFetcher.getInstance().getWSRFDataService(handle, id); // Setup message level security ConfigurableDataService secureService = null; try { secureService = GenericServiceFetcher.getInstance().getConfigurableDataService(handle,id); } catch (ServiceCommsException e) { out.println(" ERROR: "+e); out.println(" URL: "+e.getURL()); } catch (Exception e) { out.println(" ERROR: "+e); } SecurityConfigProperty securityProperty = new SecurityConfigProperty(new File("/usr/local/ogsadai-wsrf-2.1/examples/src/uk/org/ogsadai/examples/clienttoolkit/MLSecurityDescriptor.xml")); secureService.setConnectionProperty(securityProperty); // Setup encryption //secureService.setConnectionProperty(new GSITransportEncryptionProperty()); out.println("Ready to connect to secure data service at " + secureService.getURL()); // Now perform a simple SQLQuery SQLQuery query = new SQLQuery("select * from prova"); WebRowSet rowset = new WebRowSet( query.getOutput() ); ActivityRequest request = new ActivityRequest(); request.add( query ); request.add( rowset ); out.println(" Performing SQL query..."); Response response=null; try { response = secureService.perform( request ); } catch (Exception e) { out.println(e); } out.println("Response:\n" + response.getAsString()); } } When I run the portlet above deployed into GridSphere 2.1.4, I obtain the following error: uk.org.ogsadai.client.toolkit.exception.ServiceCommsException: A problem arose during communication with service https://my_machine:8443/wsrf/services/ogsadai/DataService?WSDL. Message: Default SSL context init failed: null An error arose in a non-OGSA-DAI class. Message: Default SSL context init failed: null I think it is related with context initilizing i.e it’s necessary to pass credential to the method ‘getConfigurableDataService(String handle,String id)’. In the source code above I have recovered portal’s user credential within MyProxy Server and I want to pass it when I invoke getConfigurableDataService(handle,id) method. Have you experiences with OGSA-DAI and in particular with OGSA-DAI 2.1 in a web application? Thanks in advance for your help and excuse me for my English. Vincenzo Gioviale
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!