Looking up an EJB

I have a web server (apache) that wants to look up an EJB into an ejb container (weblogic) what seteps should i go throw to make this hapen and do the servlets need stubs to communicate to the ejb if yes how are they generated.

well, the point is that servlets are like ANY other client to access an ejb. so it doesn't make a difference really what you use as a client. the same way of looking up a bean is required.
because ejb is primarily built over rmi, there really is no other way to communicate except by using stubs and skeletons. just as rmic generates stubs and skeletons, the ejbcontainer also generates them. try to extract the jar file made by a container(weblogic, for instance needs only the class files and it generates its own stubs, skeletons, xmldeployment descriptors, etal) and see how it goes about.
when you invoke a bean from a servlet it naturally acquires the stub to the bean. so no question there. try to deploy your servlet into weblogic too. coz accessing the bean from a servlet deployed in other webservers sometimes creates probs(where there shouldn't be).
hope this solves your problem.

Similar Messages

  • How can i look up a EJB residing in different machine from client side?

    hai ,
    How can i look up a EJB residing in different machine from client side?
    this is my code...........i don't know what should i use as Initial Context Factory...................i am using a sun appserver 8............
    package com.parx.lms.lmsdelegate;
    import com.parx.lms.exception.LMSException;
    import javax.naming.Context;
    import javax .ejb.CreateException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import java.rmi.RemoteException;
    import com.parx.lms.controller.*;
    import com.parx.lms.vo.UserVo;
    import com.parx.lms.exception.BusinessException;
    import java.util.Hashtable;
    import java.lang.*;
    public class LmsDelegate{
    private final static String JNDI_NAME="LmsBean";
    private static String url="http://localhost:4848";
    public static Lms lms = null;
    public void getController() throws CreateException,
    NamingException,RemoteException{
    if(lms == null){
    Hashtable h=new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY," ********what should i use here???????*************************");
    h.put(Context.PROVIDER_URL,url);
    System.out.println("Before Loading Context in Delegate");
    Context ctx=new InitialContext(h);
    System.out.println("Loaded Context in Delegate");
    Object obj=ctx.lookup(JNDI_NAME);
    System.out.println("Loaded Object in Delegate");
    System.out.println("Before Loading Home in Delegate");
    LmsHome home = (LmsHome )PortableRemoteObject.narrow(obj,com.parx.lms.controller.LmsHome.class);
    System.out.println("Loaded Home in Delegate");
    lms = home.create();
    System.out.println("Loaded remote in Delegate");
    public void addUserDelegate(UserVo vo) throws BusinessException{
    try{
    getController();
    System.out.println("Before calling the addUser of Session");
    lms.addUser(vo);
    }catch(CreateException e){
    System.out.println("Create Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    }catch(NamingException e){
    System.out.println("Naming Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    catch(RemoteException e){
    System.out.println("Remote Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    }catch(LMSException e){
    System.out.println("duplicate user name--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    pls help me..........

    h.put(Context.INITIAL_CONTEXT_FACTORY," ********what should i use here???????*************************")
    Each app server provides their own jndi factory class. For ex for weblogic it is weblogic.jndi.WLInitialContextFactory. SInce you are using sun app server, check if there are any examples to find out or the docs.
    private static String url="http://localhost:4848
    Since the client is in a different machine the localhost is not going to work here. provide the url or the machine name of the system in which ur sunapp server is running. In addition u will need to have the stubs of the remote interfaces in ur client machine.

  • Looking up an EJB in a foreign app server

    Hi,
    I am trying to look up an EJB in a foreign app server from within an EJB deployed
    in WLS 7.0.2. I have passed the name of the initialcontext factory with the -Djava.naming.factory.initial
    argument to the java command in the startWebLogic.cmd file. However WLS uses the
    weblogic.jndi.internal.WLContextImpl class to perform the lookup. Why is this
    happening, any ideas, advises?
    Thanks
    Sriram

    "sriram" <[email protected]> wrote:
    >
    Deepak, Thank you for the reply. Setting the weblogic.jndi.WLInitialContextFactory
    to my foreign app server's ContextFactory doesn't work. The WLS still
    uses weblogic.jndi.internal.WLContextImpl
    to do the lookup. Does any other propertes need to set as well to accomplish
    what I am doing
    Thanks
    Sriram
    "Deepak Vohra" <[email protected]> wrote:
    Specify the system property
    weblogic.jndi.WLInitialContextFactory=<initial context factory>
    "sriram" <[email protected]> wrote:
    Hi,
    I am trying to look up an EJB in a foreign app server from within an
    EJB deployed
    in WLS 7.0.2. I have passed the name of the initialcontext factory
    with
    the -Djava.naming.factory.initial
    argument to the java command in the startWebLogic.cmd file. HoweverWLS
    uses the
    weblogic.jndi.internal.WLContextImpl class to perform the lookup. Why
    is this
    happening, any ideas, advises?
    Thanks
    Sriram
    hi,
    Try the below code in the Lookup EJB
    Properties prop = new properties();
    /* For Weblogic */
    prop.put(Context.INITAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    prop.put(Context.PROVIDER_URL,"t3://ipaddress:7001");
    /* For JBOSS */
    prop.put(Context.INITAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
    prop.put(Context.PROVIDER_URL,"jnp://ipaddress:7001");
    InitialContext prop = new InitialContext(prop);
    regards,
    Elango TR
    Elango TR
    Sip Technologies & Exports Ltd. Elnet Software City,Chennai
    http://www.siptech.co.in
    [email protected]

  • Looking up Identical EJB both locally and remotely

    prior to posting this request, i have read and
    attempted multiple solutions to this problem
    suggested in the forums to no avail.
    if i have the same EAR, which contains both
    an EJB Component and a WAR, deployed to multiple
    servers, is it possible to look up an EJB both
    locally and remotely?
    for instance, on the server performing the lookup,
    EJB A is deployed. i successfully look it up
    via the following call:
    InitialContext context = new InitialContext();
    Object ref = context.lookup(name);
    return javax.rmi.PortableRemoteObject.narrow("EJBA", EJBAClass.class);
    subsequently, i try to lookup the same ejb
    on a remote server by performing the following
    calls:
    Properties environment = new Properties();
    environment.put("java.naming.factory.initial", "com.evermind.server.rmi.RMIInitialContextFactory");
    environment.put("java.naming.provider.url",
         "ormi://remoteserver:23791/application");
    environment.put( "java.naming.security.principal", "user");
    environment.put( "java.naming.security.credential", "password");
    jndiContext = new InitialContext(environment);
    Object ref = context.lookup(name);
    return javax.rmi.PortableRemoteObject.narrow("EJBA", EJBAClass.class);
    however, i either receive an authentican exception, saying "user"
    doesnt have access to allication "application", or a null pointer
    exception int the RMIInitialContext.
    on my local application, i have defined my ejbs in the web.xml
    as defined by the spec. the ejb component is marked as remote="false"
    in my orion-application.xml as well.
    the version of oc4j is 1.0.2.2.1.
    any directinon on this would be greatly appreciated.
    thanks,
    ted rice

    as a follow up to my own question, using a application
    client, outisde of the web application i can
    successfully look up my ejbs locally and remotely.
    however, from within the web application, i constantly
    receive a ClassCastException.
    if no one can tell me how to resolve this, could someone
    let me know if they have in fact looked up the
    same EJB, both deployed locally and remotely, from the
    same web application.
    thanks,
    ted

  • Looking for BC4J EJB deployment example

    Hi,
    I am looking for an very simple example project for BC4J deployed as EJB, including table definition, BC4J source files, and EJB client source files. I have previously successfully deployed the BC4J to Oracle8i JVM and OC4J, but currently struck at how to write the client application. I would like to know how to call my own remote methods other than working with ViewObjects directly.
    Help needed.
    Regards,
    Patrick.

    Maybe this will help:
    In JServer, ejb inactivity timeout is controlled by property jbo.ejb.txntimeout which value is 60 (secs) by default.
    JServer properties file is deployed as oracle/jbo/server/jboserver.properties, you can get it from jbomt.zip (you should create the same directory structure and a project, say jServerProps.jpr, containing the file).
    Edit the file:
    jbo.ejb.txntimeout=28800
    jbo.ejb.txntype=local
    , then deploy it as Classes and Java Stored Procedures to Oracle 8i.
    To see effective values of jServer properties you have to set jbo.debugoutput=console in file oracle/jbo/common/Diagnostic.properties - from the same jbomt.zip.
    It's better to include the file in the above jServerProps project and deploy at once with jboserver.properties.
    null

  • Looking up a EJB 3.0 Session Bean in JSP Scriptlet

    Hello There,
    Somebody please enlighten me. I have a bean named
    a.b.MyBeanextending local interface
    a.b.MyLocalNow I want to use this bean in a JSP (Maybe just for fun, but the point is I am not using resource injection).
    So the question is, What is the default JNDI name of the session bean with only a local interface, which I can use to look-it-up in jsp scriptlet code.
    Cheers. Am trying for last hour, nothings turned up
    Bye

    It's the classname under the initial context or a.b.MyLocal in your case.
         <% MyLocal intf = null;
              try {
                   InitialContext context = new InitialContext();
                   intf = (MyLocal) context.lookup(MyLocal.class.getName());
              } catch (Exception ex) {
                   System.err.println("Error looking up MyLocal: " + ex.getMessage());
              } %>

  • Issues in looking up a ejb deployed on glassfish from tomcat.

    Hi all,
    I have followed the steps mentioned in the EJB FAQ in the glassfish site and was able to lookup a remote ejb deployed in glassfish from a standalone client.
    In case of standalone client, i set the appropriate jndi properties in the initial context as mentioned in the FAQ and added the 4 jars specified to the classpath of the application.
    It all worked perfectly well.
    But I attempted to do the same from a servlet running under tomcat.
    I set the appropriate jndi properties in the intial context and added 4 jars specified in the lib directory of the war file.
    But this did not turn out well and tomcat complained me with some servlet init errors.
    Then i searched through the web and found this posting from you:
    http://www.archivesat.com/GlassFish_Enterprise_JavaBeans_Developers/thread1399339.htm
    Then i created a folder called "shared/lib" under TOMCAT_HOME directory in my machine and ran the same example. Wow.....miraculously the application ran well.
    But i found that the "index.jsp" which i configured in the welcome file list does not appear now. But i was able to access the servlet without any problem. And the servlet was able to successfully lookup the ejb deployed in glassfish.
    Then i thought, let me try to access the ejb from a jsf application.
    Then i created a jsf application in netbeans 5.5.1 and tried to access the bean deployed in glassfish.
    (Note: the jsf application runs in tomcat 5.5.17 which is bundled with netbeans)
    OOPSS....
    Tomcat now complains me that it cannot compile the jsp page..
    This is the error i got...
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    C:\Documents and Settings\james\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\CityExplorer-WebClient1\org\apache\jsp\index_jsp.java:7: org.apache.jsp.index_jsp is not abstract and does not override abstract method getDependants() in org.apache.jasper.runtime.JspSourceDependent
    public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
    ^
    Generated servlet error:
    C:\Documents and Settings\james\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\CityExplorer-WebClient1\org\apache\jsp\index_jsp.java:12: getDependants() in org.apache.jsp.index_jsp cannot implement getDependants() in org.apache.jasper.runtime.JspSourceDependent; attempting to use incompatible return type
    found : java.lang.Object
    required: java.util.List
    public Object getDependants() {
    ^
    2 errors
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    Any ideas...
    Can you please help me.
    I've noticed that you were eagerly answering questions related to ejb lookup in many places.
    I feel there is some potential compatability issue between tomcat and glassfish...
    I request you to investigate on this and clarify the community with your response.
    Thanks in advance,
    James Selvakumar

    Thank you guys!
    I've found the answer myself.

  • Oracle 8i - problems while looking up an EJB

    I have created and published a EJB in Oracle 8i (in a particular
    schema) by running the deployejb tool supplied. The ejb was
    published successfully. On running the client program I get an
    error saying that the mybeans's HomeHelper class cannot be
    found. This error occurs when there is a lookup to the home
    interface of the bean. The exception thrown says Reasons are
    unknown. On checking the objects of type 'JAVA CLASS' I found
    that the homeHelper class object had been created automatically
    be the deploy process. What is the reason for the class not
    found exception and what can I do to correct it. ?
    The code for the beans is as given below :
    Home Interface
    package mituser ;
    import javax.ejb.*;
    import java.rmi.RemoteException;
    public interface MITUserHome extends EJBHome {
    public MITUser create()
    throws CreateException, RemoteException;
    Remote Interface
    package mituser ;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    public interface MITUser extends EJBObject {
    public int validateUserName (String username)
    throws java.sql.SQLException, RemoteException;
    public int validatePassword (String username, String password)
    throws java.sql.SQLException, RemoteException;
    public String validateSearchAccess (String username, String
    password)
    throws java.sql.SQLException, RemoteException;
    Bean
    package mituserServer ;
    import java.sql.*;
    import java.rmi.RemoteException;
    import javax.ejb.*;
    public class MITUserBean implements SessionBean {
    SessionContext ctx;
    public void ejbCreate() throws CreateException,
    RemoteException {
    public void ejbActivate() {
    public void ejbPassivate() {
    public void ejbRemove() {
    public void setSessionContext(SessionContext ctx) {
    this.ctx = ctx;
    public int validateUserName (String username) throws
    SQLException, RemoteException
    int count = 0 ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select count(username) from
    useraccountinfo where username = ?");
    try {
    ps.setString (1, username);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("no registered user with User
    Name " + username);
    count = rset.getShort(1) ;
    return count ;
    } finally {
    ps.close();
    public int validatePassword (String username, String password)
    throws SQLException, RemoteException
    int count = 0 ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select count(username) from
    useraccountinfo where username = ? and password = ?");
    try {
    ps.setString (1, username);
    ps.setString(2, password);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("Invalid Password ");
    count = rset.getShort(1) ;
    return count ;
    } finally {
    ps.close();
    public String validateSearchAccess (String username, String
    password) throws SQLException, RemoteException
    String searchaccess = "" ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select searchprofileaccess from
    useraccountinfo where username = ? and password = ?");
    try {
    ps.setString (1, username);
    ps.setString(2, password);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("Access Denied for " +
    username );
    searchaccess = rset.getString(1) ;
    return searchaccess ;
    } finally {
    ps.close();
    Client program
    import mituser.MITUser;
    import mituser.MITUserHome;
    import oracle.aurora.jndi.sess_iiop.ServiceCtx;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.Hashtable;
    public class Client {
    public static void main (String [] args) throws Exception {
    int count = 0 ;
    String access = "" ;
    if (args.length != 4) {
    System.out.println("usage: Client serviceURL objectName
    user password");
    System.exit(1);
    String serviceURL = args [0];
    String objectName = args [1];
    String user = args [2];
    String password = args [3];
    Hashtable env = new Hashtable();
    env.put(Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    env.put(Context.SECURITY_PRINCIPAL, user);
    env.put(Context.SECURITY_CREDENTIALS, password);
    env.put(Context.SECURITY_AUTHENTICATION,
    ServiceCtx.NON_SSL_LOGIN);
    Context ic = new InitialContext(env);
    MITUserHome home = (MITUserHome)ic.lookup (serviceURL +
    objectName);
    MITUser testBean = home.create ();
    count = testBean.validateUserName("MITA");
    if (count > 0 )
    System.out.println ("Valid User");
    else
    System.out.println ("Invalid User");
    count = testBean.validatePassword("MITA", "MITA");
    if (count > 0 )
    System.out.println ("Valid Password");
    else
    System.out.println ("Invalid Password");
    access = testBean.validateSearchAccess("MITA", "MITA");
    if ( access.equalsIgnoreCase("YES") )
    System.out.println ("Search Access Available");
    else
    System.out.println ("Search Access Denied");
    The Descriptor file
    // MIT UserBean EJB deployment descriptor
    SessionBean mituserServer.MITUserBean {
    BeanHomeName = "test/mitUserJDBCBean";
    RemoteInterfaceClassName = mituser.MITUser;
    HomeInterfaceClassName = mituser.MITUserHome;
    AllowedIdentities = {MIT};
    SessionTimeout = 20;
    StateManagementType = STATEFUL_SESSION;
    RunAsMode = CLIENT_IDENTITY;
    TransactionAttribute = TX_REQUIRED;
    Batch File for deploying the ejb
    @echo off
    if (%ORACLE_HOME%)==() goto usage
    if (%ORACLE_SERVICE%)==() goto usage
    if (%JDK_CLASSPATH%)==() goto usage
    @echo on
    set CLASSPATH=.;%ORACLE_HOME%\lib\aurora_client.jar;%ORACLE_HOME%
    \jdbc\lib\classes111.zip;%ORACLE_HOME%\sqlj\lib\translator.zip;%
    ORACLE_HOME%\lib\vbjorb.jar;%ORACLE_HOME%\lib\vbjapp.jar;%
    JDK_CLASSPATH%
    javac -g mituser\MITUser.java
    javac -g mituser\MITUserHome.java
    javac -g mituserServer\MITUserBean.java
    jar cf0 mituser.jar mituser\MITUser.class
    mituser\MITUserHome.class mituserServer\MITUserBean.class
    javac -g Client.java
    call deployejb -republish -temp temp -u mit -p mit -s %
    ORACLE_SERVICE% -descriptor mituser.ejb mituser.jar
    @echo off
    goto done
    :usage
    @echo -------------------------------------------------------
    @echo Following are the requirements to run this script
    @echo set ORACLE_HOME to installed Oracle home
    @echo set ORACLE_SERVICE to the CORBA service name of
    your databae
    @echo for example sess_iiop://localhost:2481:ORCL
    @echo set JDK_CLASSPATH to the full path of your JDK
    classes.zip
    @echo -------------------------------------------------------
    :done
    Batch file for running the cleint program
    @echo off
    if (%ORACLE_HOME%)==() goto usage
    if (%ORACLE_SERVICE%)==() goto usage
    if (%JDK_CLASSPATH%)==() goto usage
    @echo on
    set CLASSPATH=.;%ORACLE_HOME%\lib\aurora_client.jar;%ORACLE_HOME%
    \jdbc\lib\classes111.zip;%ORACLE_HOME%\sqlj\lib\translator.zip;%
    ORACLE_HOME%\lib\vbjorb.jar;%ORACLE_HOME%\lib\vbjapp.jar;%
    JDK_CLASSPATH%;server_generated.jar
    java Client %ORACLE_SERVICE% /test/mitUserJDBCBean mit mit
    @echo off
    goto done
    :usage
    @echo -------------------------------------------------------
    @echo Following are the requirements to run this script
    @echo set ORACLE_HOME to installed Oracle home
    @echo set ORACLE_SERVICE to the CORBA service name of
    your databae
    @echo for example sess_iiop://localhost:2481:ORCL
    @echo set JDK_CLASSPATH to the full path of your JDK
    classes.zip
    @echo -------------------------------------------------------
    :done
    Hoping for a response soon as it us very URGENT
    Thanks
    Mita
    null

    The helper class cannot be found on the client side, not on the
    server;
    All you need (actually, required) to do is to include 2 jar files
    produced during deployment ("generated" - here is your helper;
    and "source") into your project properties or put them on your
    classpath;
    -Alex
    =============================
    Mita Balasubramanian (guest) wrote:
    : I have created and published a EJB in Oracle 8i (in a
    particular
    : schema) by running the deployejb tool supplied. The ejb was
    : published successfully. On running the client program I get an
    : error saying that the mybeans's HomeHelper class cannot be
    : found. This error occurs when there is a lookup to the home
    : interface of the bean. The exception thrown says Reasons are
    : unknown. On checking the objects of type 'JAVA CLASS' I found
    : that the homeHelper class object had been created automatically
    : be the deploy process. What is the reason for the class not
    : found exception and what can I do to correct it. ?
    null

  • Very Urgent !!! Exception in looking up Local EJB from Servlet in WSAD 5.1

    Hi,
    I have a servlet and a local EJB. The servlet and EJB are deployed on same application server but in different J2EE applications i.e. different EAR files.
    When I lookup an EJB with remote interfaces from servlet everything works fine. But when I try to lookup EJB with local interfaces from
    Servlet I get following Exception.
    Exception Stack: -
    ========================================================
    avax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server1, name: TestLocalHome: First component in name TestLocalHome not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:968)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:1399)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3491)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1519)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1480)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1187)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1067)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at javax.naming.InitialContext.lookup(InitialContext.java:360)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at org.apache.jsp._DomainClient._jspService(_DomainClient.java:95)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:669)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:767)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
    ========================================================
    Please help asap.
    Regds
    VJ.

    The ejb spec only defines local ejb access within the same application. It's possible some app servers support access from a different application but it wouldn't be portable, nor would it work within the J2EE SDK or Sun Java System App Servers. To access a local ejb from a web component or ejb , define an ejb-local-ref in the client component's standard .xml file (web.xml or ejb-jar.xml) and use the ejb-link element to specify the ejb-name of the target ejb.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Exception looking up weblogic ejb from tomcat

    i have a servlet in tomcat 4.0 doing a remote lookup on an ejb in
    weblogic 6.1. the code works from a standalone client, but not in tomcat.
    so i assume it is something to do with jaas. do i have to configure jaas
    differently? and how?? i do not need to do anything with a standalone
    client to work.
    the code is
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, "t3://192.168.254.3:7001");
    p.put(Context.SECURITY_PRINCIPAL, "user");
    p.put(Context.SECURITY_CREDENTIALS, "password");
    InitialContext ctx = new InitialContext(p);
    the exception is
    javax.servlet.ServletException: javax.naming.AuthenticationException
    [Root exception is java.lang.SecurityException: attempting to add an
    object which is not an instance of java.security.Principal to a
    Subject's Principal Set]
         at
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)
         at
    org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:71)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
    org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at
    org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    com.realty.remoteservice.RemoteServiceException:
    javax.naming.AuthenticationException [Root exception is
    java.lang.SecurityException: attempting to add an object which is not an
    instance of java.security.Principal to a Subject's Principal Set]
         at com.realty.remoteservice.EjbService.addListingAgent(EjbService.java:43)
         at com.realty.remoteservice.EjbService.main(EjbService.java:23)
         at
    org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:61)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
    org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at
    org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:536)
    nested exception is:
    javax.naming.AuthenticationException. Root exception is
    java.lang.SecurityException: attempting to add an object which is not an
    instance of java.security.Principal to a Subject's Principal Set
         at javax.security.auth.Subject$SecureSet.add(Subject.java:1071)
         at
    weblogic.common.internal.BootServicesStub.writeUserInfoToSubject(BootServicesStub.java:72)
         at
    weblogic.common.internal.BootServicesStub.authenticate(BootServicesStub.java:80)
         at weblogic.security.acl.internal.Security.authenticate(Security.java:108)
         at
    weblogic.jndi.WLInitialContextFactoryDelegate.pushUser(WLInitialContextFactoryDelegate.java:461)
         at
    weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:316)
         at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:288)
         at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:203)
         at
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:124)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
         at javax.naming.InitialContext.init(InitialContext.java:219)
         at javax.naming.InitialContext.(InitialContext.java:195)
         at
    com.realty.util.RealtyContextFactory.create(RealtyContextFactory.java:25)
         at com.realty.remoteservice.EjbService.addListingAgent(EjbService.java:36)
         at com.realty.remoteservice.EjbService.main(EjbService.java:23)
         at
    org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:61)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
    org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at
    org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at
    org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:536)

    Did you try placing weblogic.jar in front of the classpath?
    Or use WebLogic servlet container instead ;-)
    "Simon Evans" <[email protected]> wrote in message
    news:[email protected]...
    any solution? tomcat also uses jaas so i cant remove them.
    Dimitri I. Rakitine wrote:
    Happened to me once - as far as I remember it was caused by non-WL jaas
    classes in the
    classpath.
    "Simon Evans" <[email protected]> wrote in message
    news:[email protected]...
    i have a servlet in tomcat 4.0 doing a remote lookup on an ejb in
    weblogic 6.1. the code works from a standalone client, but not in
    tomcat.
    so i assume it is something to do with jaas. do i have to configure jaas
    differently? and how?? i do not need to do anything with a standalone
    client to work.
    the code is
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, "t3://192.168.254.3:7001");
    p.put(Context.SECURITY_PRINCIPAL, "user");
    p.put(Context.SECURITY_CREDENTIALS, "password");
    InitialContext ctx = new InitialContext(p);
    the exception is
    javax.servlet.ServletException: javax.naming.AuthenticationException
    [Root exception is java.lang.SecurityException: attempting to add an
    object which is not an instance of java.security.Principal to a
    Subject's Principal Set]
    at
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
    l.java:457)
    at
    org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:71
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
    va:201)
    atorg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:247)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    va:243)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    va:190)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
    46)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    java:170)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    :174)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
    1027)
    at
    org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
    at java.lang.Thread.run(Thread.java:536)
    root cause
    com.realty.remoteservice.RemoteServiceException:
    javax.naming.AuthenticationException [Root exception is
    java.lang.SecurityException: attempting to add an object which is not an
    instance of java.security.Principal to a Subject's Principal Set]
    at
    com.realty.remoteservice.EjbService.addListingAgent(EjbService.java:43)
    at com.realty.remoteservice.EjbService.main(EjbService.java:23)
    at
    org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:61
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
    va:201)
    atorg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:247)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    va:243)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    va:190)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
    46)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    java:170)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    :174)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
    1027)
    at
    org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
    at java.lang.Thread.run(Thread.java:536)
    nested exception is:
    javax.naming.AuthenticationException. Root exception is
    java.lang.SecurityException: attempting to add an object which is not an
    instance of java.security.Principal to a Subject's Principal Set
    at javax.security.auth.Subject$SecureSet.add(Subject.java:1071)
    at
    weblogic.common.internal.BootServicesStub.writeUserInfoToSubject(BootService
    sStub.java:72)
    at
    weblogic.common.internal.BootServicesStub.authenticate(BootServicesStub.java
    :80)
    at
    weblogic.security.acl.internal.Security.authenticate(Security.java:108)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.pushUser(WLInitialContextFacto
    ryDelegate.java:461)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFac
    toryDelegate.java:316)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:288)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:203)
    at
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFact
    ory.java:124)
    atjavax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
    at
    javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.(InitialContext.java:195)
    at
    com.realty.util.RealtyContextFactory.create(RealtyContextFactory.java:25)
    at
    com.realty.remoteservice.EjbService.addListingAgent(EjbService.java:36)
    at com.realty.remoteservice.EjbService.main(EjbService.java:23)
    at
    org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:61
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
    va:201)
    atorg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:247)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    va:243)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    va:190)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
    46)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    java:170)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    :174)
    at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    >>
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at
    org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
    1027)
    at
    org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
    at java.lang.Thread.run(Thread.java:536)
    Dimitri
    Dimitri

  • Looking up an EJB – best practices

    Hi, what's the correct way to specify an EJB when attempting to get
    the home interface?
    Using WebLogic, it seems people just specify the JNDI name and it
    seems to work fine.
    Object ref = context.lookup("testsession");
    But other times I see this syntax:
    Object ref = context.lookup("java:comp/env/ejb/MySession2");
    Which method is best practices?
    Thanks

    Hello Marcus,
    Actually, EJB 1.1 introduced a formal manner to specify the location of the EJBs,
    namely the
    "java:comp/env/ejb" location. This is actually a best practice for specifying
    the location of
    your EJBs, because the "application assembler" doesn't need to know exactly what
    the JNDI
    name of the particular EJB is. This task is left to the actual deployer. If you
    use the actual JNDI
    name of the EJB instead of Sun's recommended prefix, then you are limiting the
    overall portability
    of the EJBs, because the code must be modified to reflect the exact JNDI name
    that will be used
    based on the particular J2EE application server that they are being deployed on.
    You can read up about this in chapter 14 of the EJB 1.1 specification as well
    as chapter 5 of the
    J2EE 1.2 specification. Also, check out Mastering Enterprise JavaBeans 2nd Edition
    by
    Ed Roman, Scott W. Ambler, and Tyler Jewell for more explanation and code examples.
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    [email protected] (Marcus Leon) wrote:
    Hi, what's the correct way to specify an EJB when attempting to get
    the home interface?
    Using WebLogic, it seems people just specify the JNDI name and it
    seems to work fine.
    Object ref = context.lookup("testsession");
    But other times I see this syntax:
    Object ref = context.lookup("java:comp/env/ejb/MySession2");
    Which method is best practices?
    Thanks

  • Error while looking up EJB

    Hello,
    I'm trying to develop EJBs 2.0 for my company.
    creation and EJB deployment works fine, but when I try to look up my EJB, I get a NamingException.
    EAR is deployed on a Websphere Application Server 5.1, and I would like to communicate with my EJB in a portlet. This portlet is deployed on a Websphere portal Server 5.1. WPS ans WAS servers are on the same system.
    this is my JSP code :
    Context ctx = new InitialContext();
    Object obj = ctx.lookup("ejb/fr/test/ejbtest/EJBTest2Home");
    EJBTest2Home cacheHome = (EJBTest2Home)javax.rmi.PortableRemoteObject.narrow(obj, EJBTest2Home.class);I think my InitialContext is Websphere Portal Server so it cannot access to my EJB interface deployed on the Websphere Application Server 5.1
    Thx for your help !

    Hi,
    I guess u had made 2 mistakes.
    First one as to ur guess, u got the IntialContext wrong and secondly u should lookup the HomeObject using JNDI name instead of the fully qualified classpath.
    I am not so sure of websphere5.1, but for most of the servers have diff context for webcontainer and BeanContainer
    First u try to get it done changing the code to,
    ctx.lookup("ejb/fr/test/ejbtest/EJBTest2Home");
    to
    ctx.lookup("JNDIName");
    if it doesnt workout then do changes to the context as well
    Thanks and Regards
    Srikanth

  • Looking up EJB from Java Web start

    I have a java client application that looks-up an EJB deployed in WebLogic Server 10.3 on windows xp. the application works fine when invoked from command line. But when I try to run the same application via Java Web Start, I get following error while doing EJB lookup:
    java.lang.AssertionError: java.lang.ClassNotFoundException: com.pks.dummy.SL1
    at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:57)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:205)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:197)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:564)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
    at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at com.pks.dummy.client.TestClientDummy.doTest(Unknown Source)
    at com.pks.dummy.client.TestClientDummy.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.javaws.Launcher.executeApplication(Unknown Source)
    at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: com.pks.dummy.SL1
    at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.getClassBytes(RemoteBizIntfClassLoader.java:151)
    at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.loadClass(RemoteBizIntfClassLoader.java:96)
    at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:54)
    ... 36 more
    #### Java Web Start Error:
    #### null
    com.pks.dummy.SL1 is Remote interface for the Session Bean. and is packaged in same jar with client jar. Also, I am able to instantiate the com.pks.dummy.SL1 using class.forName in main() method of client code in both command line as well as Web start environment.
    Any help is appreciated. Thanks.
    Edited by: javaDev on Dec 19, 2008 11:58 AM
    Edited by: javaDev on Dec 19, 2008 12:18 PM

    I got the solution for ClassNotFound issue. To avoid this error, one need to package EJB stubs on client side. Packaging just the EJB interfaces doesn't help.
    EJB stubs can be generated using weblogic.appc utility. For more information about this utility please refer
    WebLogic Server Command Reference : Link: [http://edocs.bea.com/wls/docs103/pdf/admin_ref.pdf]

  • Trying to look up a LOCAL EJB (Weblogic 8.1)

    Hi,
    I'm trying to look up a LOCAL EJB (Weblogic 8.1):
    try
    Context ct = new InitialContext();
    Object o = ct.lookup("*ejbSecurityDataLocalHelper*");
    catch(...)
    I systematically get the following exception:
    Caused by: javax.naming.LinkException: Root exception is javax.naming.NameNotFoundException: While trying to look up /app/ejb/AEX_JRK_security_EJB.jar#SecurityDataHelper/local-home in /app/ejb/ISL_MSD_mktdata_general_EJB.jar#MarketDataGeneralManager.; remaining name '/app/ejb/AEX_JRK_security_EJB/jar#SecurityDataHelper/local-home'; Link Remaining Name: 'java:app/ejb/AEX_JRK_security_EJB.jar#SecurityDataHelper/local-home'
    Where SecurityDataHelper is the Local EJB, who's called from MarketDataGeneralManager EJB.
    I realized that the Weblogic JNDI tree shows a red dot next to the name SecurityDataHelperLocalHome: as the other names are not red, I could guess there was something wrong at deployment... buy deployment logs are OK. When I tryied to test the EJB via the Weblogic console there was a message "The EJB SecurityDataHelper has not been tested successfully. There was a problem determining the JNDI Name of the given bean. "
    My ejb-jar.xml looks like this:
    <session>
    <ejb-name>SecurityDataHelper</ejb-name>
    <local-home>com.MyLocalHome</local-home>
    <local>com.MyLocalObject</local>
    <ejb-class>com.MyBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    and my weblogic-ejb-jar.xml:
    <weblogic-enterprise-bean>
    <ejb-name>SecurityDataHelper</ejb-name>
    <stateless-session-descriptor>
    </stateless-session-descriptor>
    <enable-call-by-reference>True</enable-call-by-reference>
    <local-jndi-name>ejbSecurityDataLocalHelper</local-jndi-name>
    </weblogic-enterprise-bean>
    What I am doing wrong???

    Hi Dan,
    As u have targeted the ConnectionFactory to "soa_server1" which is running on "realHostName:7001" ....Can u please check from the AdminConsole that the JNDI name ""jms/b2b/B2BQueueConnectionFactory" is present in the JNDI Tree?
    AdminConsole---->Servers---soa_server1 (click) ---> in this general configuration page you will see a link "View JNDI Tree" please ckick on that link to see the JNDI tree entries.
    If you dont see any JNDI entry there then it means there is something wrong while setting up the Connection Factory in that case please refer to the Screenshots of Creating and Targeting the Connection Factory: *http://middlewaremagic.com/weblogic/?p=1987*
    Thanks
    Jay SenSharma
    *http://middlewaremagic.com/weblogic (Middleware magic Is Here)*

  • How to get an instance of Session EJB 3.0  in a JSP?

    Hi! All,
    Can any one help me in looking up SessionEJB in a JSP.
    I know how to look up a EJB 2.x bean ; but since EJB 3.0 does not have a home interface,there is no meaning of using PortableRemoteObject.narrow() method and then using home method create() to create the instance of the bean.
    can you plase help me how can I look up for an instance of Session Bean 3.0 ?
    Thanking you in advance,
    Samba.

    Check out this tutorial:
    http://www.oracle.com/technology/obe/JavaEE_tutorial_10131/index.htm

Maybe you are looking for