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 ]
|