Accessing WPS objects from a servlet
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Portal Server > Accessing WPS objects from a servlet




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Accessing WPS objects from a servlet  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-17-06 01:04 PM

Hello again.
I have another question for you WPS wizzes out there.

Is it possible to call WPS objects (PumaHome and PumaLocator to be more spec
ific) from a "classic" servlet mapped to the WebSphere_Portal instance ?
Apparently the JNDI lookup fails, it cannot find the required context :
javax.naming.ConfigurationException: NamingManager.getURLContext cannot find
 the factory for this scheme: portal
Is there anything that can be done to solve this, maybe by configuration ?

Here is the code for my servlet :

import java.io.IOException;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ibm.portal.um.*;
import com.ibm.portal.um.exceptions.*;
//import com.ibm.wps.puma.*;
import javax.naming.*;

public class ServletUserManager extends HttpServlet implements Servlet {
;
/* (non-Java-doc)
* @see javax.servlet.http.HttpServlet#HttpServlet()
*/
public ServletUserManager() {
super();
}

/* (non-Java-doc)
* @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpSer
vletResponse arg1)
*/
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
 ServletException, IOException {
// TODO Auto-generated method stub

PumaHome myHome = null;
String userIdentifier = req.getParameter("UID");

//Lookup the PumaHome Instance
try {
Context ctx = new InitialContext();
Name myjndiname = new CompositeName(PumaHome.JNDI_NAME);
myHome = (PumaHome) ctx.lookup(myjndiname);
}
catch (InvalidNameException e) {
System.out.println("InvalidNameException : "+e.getMessage());
}
catch (NamingException e) {
System.out.println("NamingException : "+e.getMessage());
}
//Obtain the PumaLocator
PumaLocator myLocator = myHome.getLocator(req);

//Lookup member
try {
User myUser = myLocator.findUserByIdentifier(userIdentifier);
System.out.println("User found !");
}
catch (PumaSystemException e) {
System.out.println("PumaSystemException : "+e.getMessage());
}
catch (PumaModelException e) {
System.out.println("PumaModelException : "+e.getMessage());
}
catch (PumaMissingAccessRightsException e) {
System.out.println("PumaissingAccessRightsException : "+e.getMessage());
}

}





[ Post a follow-up to this message ]



    Re: Accessing WPS objects from a servlet  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-18-06 12:52 PM

Apparently the JNDI lookup is correct, but the servlet cannot find the corre
ct IntialContext, and thus cannot lookup portal:service/usermanagement/Puma.

Does anybody know which WPS Context needs to be used by the servlet for this
 lookup to work ?
If similar code is used in a JSP in a Theme, it works, which confirms that t
he problem is linked to obtaining the correct WPS-related context.






[ Post a follow-up to this message ]



    Re: Accessing WPS objects from a servlet  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-06 06:23 PM

try this:

env.put(Context.PROVIDER_URL, "iiop://<server>:<port>/NameService");
Context ctx = new InitialContext(env);
Name myjndiname = new CompositeName(PumaHome.JNDI_NAME);

This is not working for me yet -- still getting a problem with the implfacto
ry.properties -- but I believe it's closer since this will open the InitialC
ontext to the portal's RMI listener.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:18 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register