How to use JNDI to lookup remote EJB Home?

Hello,
I am writing a servlet to call a remote EJB on another machine.
I use JNDI to lookup remote EJBHome (not) but fail.
Any advice?
Any trick to configure application-client.xml?
Thanks!

Use com.evermind.server.rmi.RMIInitialContextFactory instead
Here an example
// EmployeeClient.java
package mypackage5;
import javax.ejb.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.io.*;
import java.util.*;
import java.rmi.RemoteException;
import com.evermind.server.ApplicationClientInitialContextFactory;
import com.evermind.server.rmi.RMIInitialContextFactory;
* A simple client for accessing an EJB.
public class EmployeeClient
public static void main(String[] args)
System.out.println("EmployeeClient.main(): client started...");
try
* initialize JNDI context by setting factory, url and credential
* in a hashtable
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
//env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
env.put(Context.PROVIDER_URL, "ormi://koushikm:23791/application4");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");
* or set these properties in jndi.properties
* or use container defaults if that's where client got launched from
Context context = new InitialContext(env);
* Lookup the EmployeeHome object. The reference is retrieved from the
* application-local context (java:comp/env). The variable is
* specified in the assembly descriptor (META-INF/application-client.xml).
Object homeObject =
context.lookup("HelloEJB");
System.out.println("EmployeeClient.main(): bean found...");
// Narrow the reference to EmployeeHome.
HelloEJBHome home =
     (HelloEJBHome) PortableRemoteObject.narrow(homeObject,
HelloEJBHome.class);
System.out.println("EmployeeClient.main(): home narrowed...");
// Create remote object and narrow the reference to Employee.
HelloEJB remote =
     (HelloEJB) PortableRemoteObject.narrow(home.create(), HelloEJB.class);
System.out.println("EmployeeClient.main(): remote created...");
String message=remote.helloWorld("SUCCESS");
System.out.println(message);
} catch(NumberFormatException e) {
System.err.println("NumberFormatException: " + e.getMessage());
} catch(RemoteException e) {
System.err.println("RemoteException: " + e.getMessage());
} catch(IOException e) {
System.err.println("IOException: " + e.getMessage());
} catch(NamingException e) {
System.err.println("NamingException: " + e.getMessage());
} catch(CreateException e) {
System.err.println("CreateException: " + e.getMessage());
Hello,
I am writing a servlet to call a remote EJB on another machine.
I use JNDI to lookup remote EJBHome (not) but fail.
Any advice?
Any trick to configure application-client.xml?
Thanks!

Similar Messages

  • How to change JNDI service provider for EJB's?

    I need EJBean's home interface to be bound to another JNDI provider, not Weblogic.
    How can I do it?
    The most simple solution is not working: to specify <jndi-name> in weblogic-ejb-jar.xml
    for bean as "xxx:bean_name".
    By JNDI rules for such names context factory with name com.sun.jndi.url.xxx.xxxURLContextFactory
    will be used. But for Weblogic this does not work. An exception is thrown during
    bean deployment -
    javax.management.MalformedObjectNameException: ObjectName: Invalid value -> xxx:bean_name
    at javax.management.ObjectName.validateAndAdd(ObjectName.java:440) at javax.management.ObjectName.initObjectName(ObjectName.java:409)
    at javax.management.ObjectName.<init>(ObjectName.java:254) at weblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:196)
    at weblogic.management.runtime.RuntimeMBeanDelegate.register(RuntimeMBeanDelegate.java:90)
    at weblogic.management.runtime.RuntimeMBeanDelegate.<init>(RuntimeMBeanDelegate.java:83)
    at weblogic.ejb20.internal.BaseEJBHomeMBean.<init>(BaseEJBHomeMBean.java:33) ......................

    This is not an answer on my
    question - My questions was: how to force a Welogic EJB Container to BIND EJBean's
    home interface to another JNDI Service provider, not Weblogic.
    But you wrote how to use JNDI in general - I already know how to use it :)))
    Phil.
    "VSK" <[email protected]> wrote:
    Hi
    Have a look at the code below
    private Context getInitialContext () throws NamingException
    String from = "CtxHelper::getInitialContext ";
    String webLogicHostUrl = t3://SERVERNAME:9001
    Logger.debug(from, "Begin Method", 3);
    Hashtable h = System.getProperties();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory
    h.put(Context.PROVIDER_URL, webLogicHostUrl);
    return new InitialContext(h);
    } //end getInitialContext
    This way we will get the InitailContext and then do a jndi lookup using
    the
    Context object as follows
    ctx.lookup..........
    Now in the above code replace weblogic.jndi.WLInitialContextFactory by
    ur
    provider.
    Hope this helps.
    -VKS
    "Phil Peshin" <[email protected]> wrote in message
    news:[email protected]...
    I need EJBean's home interface to be bound to another JNDI provider,not
    Weblogic.
    How can I do it?
    The most simple solution is not working: to specify <jndi-name> inweblogic-ejb-jar.xml
    for bean as "xxx:bean_name".
    By JNDI rules for such names context factory with namecom.sun.jndi.url.xxx.xxxURLContextFactory
    will be used. But for Weblogic this does not work. An exception isthrown
    during
    bean deployment -
    javax.management.MalformedObjectNameException: ObjectName: Invalidvalue -> xxx:bean_name
    at javax.management.ObjectName.validateAndAdd(ObjectName.java:440)at
    javax.management.ObjectName.initObjectName(ObjectName.java:409)
    at javax.management.ObjectName.<init>(ObjectName.java:254) atweblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:196)
    atweblogic.management.runtime.RuntimeMBeanDelegate.register(RuntimeMBeanDelega
    te.java:90)
    atweblogic.management.runtime.RuntimeMBeanDelegate.<init>(RuntimeMBeanDelegate
    ..java:83)
    atweblogic.ejb20.internal.BaseEJBHomeMBean.<init>(BaseEJBHomeMBean.java:33)

  • I have deploy an EJB in weblogic 6.1,but how to use jsp to invoke the EJB's method?

    i have deploy an EJB in weblogic 6.1,but how to use jsp to invoke the EJB's method?
    thanks!

    You'd do something like:
    <%
    //vvv this part can potentially be done in initialization
    Context ctx = getInitialContext();
    BeanHome home =
    (BeanHome)PortableRemoteObject.narrow(ctx.lookup("the.jndi.name"),
    BeanHome.class);
    Bean b = home.create();
    //^^^
    Result r = b.invokeMethod();
    %>
    "toxin" <[email protected]> wrote in message
    news:3d2e95e5$[email protected]..
    >
    i have deploy an EJB in weblogic 6.1,but how to use jsp to invoke theEJB's method?
    thanks!

  • How to lookup EJB3 beans using JNDI names without defining ejb-ref in DD?

    Hi Kenneth,
    I am just continuing the topic:
    How Lookup SLSB from other SLSB? <HELP>
    http://forum.java.sun.com/thread.jspa?threadID=5117484&tstart=0
    (my original forums account failed, so I am using new one)
    if I am not seeking portability I should be able to lookup a bean directly through JNDI without using the ejb-ref. (I just want to see how it can be done)
    http://forum.java.sun.com/thread.jspa?forumID=13&threadID=751907
    http://www.theserverside.com/discussions/thread.tss?thread_id=16402
    I am using SJSAS PE 9.0 I am failing to lookup my beans from other beans directly without ejb-ref.
    Is there some sample code to look at?
    Thanks!

    Global JNDI names are vendor-specific and not known until deployment time. That is one
    of the main reasons the Java EE component environment model defines a level of
    indirection for accessing component dependencies. It is best to use either an ejb-ref
    or @EJB annotation when accessing EJBs from a Java EE component.
    If you choose not to, you just have to make sure the global JNDI name you use matches
    the one assigned to the target EJB. We have a lot of information on how this works
    in our EJB FAQ.
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    If you're still encountering an error, please provide more specifics about your application,
    the code you're using for the lookup, and the error message you're receiving. Just
    saying "my looking fails" doesn't help us diagnose the problem :-)
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to use JNDI lookup

    Hi ,
    I am creating a POC for my project.Its using ATG and spring frameworks using RAD 6.first I have created ATG sample project in that same EAR file i created sample Spring project.Both are running in the same EAR.
    I want to use spring classes from ATG components to use those methods.that is i should pass parameters to spring project methods and i should get the return value after executing those methods.
    I heard that using JNDI look up I can get spring project class objects using that I can invoke spring project methods.
    My requirement is two projects will be running in the same EAR.But one project will not be having information about other projects.both are independent from other.Using JNDI look up i need to invoke Spring project methods.
    Please anyone help me how to do this.
    I used java:comp/env/com/dao/EmpDAO to get instance of my class EmpDAO.But i am getting naming exception.Can anyone help me how to do this
    Thanks in advance.

    If Tomcat is your servlet/JSP engine, they have a nice bit about how to do it:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    MOD

  • How to use jndi datasource on Weblogic instead of adding a DB data source

    Hi All,
    version: 11.1.1.4
    I am trying to figure out how in my ADF applications I can use an existing jndi datasource out on our weblogic servers instead of having to bury the Database db source in my adf applications. Like SOA I would like to reference the DB directly during design so I can pull in entities and build view objects, but when I deploy I want it to reference the jndi datasource out on the weblogic server.
    Is this possible? If so I am not sure how to configure it like I would a DB adapter in SOA.
    As always appreciate the info.
    Thanks,
    S

    If you use ADF in the model layer (application modules) you can configure them to use JNDI Datasources. Just right click on the application module and select 'Configurations...'. In the next dialog you see all the configurations currently available (one named xxxxxlocal and one named xxxxxshared at least). Select the local and hit the edit button. This open the DB connect dialog where you can change the connection from JDBC URL to JDBC Datasource (JNDI). Save your work and when you now start the app it will use the JNDI name.
    Timo

  • How to use Unique key constraint in EJB

    Hi All,
    I am using an entity bean to create my table in MySQL4.1.13
    I have a table called user which has userid,username,password as its columns.
    The userid is a primary key over here.
    But I want the user name to be unique.
    I.e if a user with the name 'Adrian' is present in the database then another user with this user name should not be created.
    I have been told that you can configure a unique key in jbosscmp-jdbc.xml using insert-after-ejb-post-create.
    But i dont know how to use it.
    Can anyone give me a sample code for using this.
    Any help would be appreciated.
    Thanks
    P2

    Please explain your problem better. Really can't figure what you are trying to do.....
    choosing which sql statement to use at runtime
    or creating dynamic sql statement at runtime
    which??
    Regards

  • How to use Java Web Start with EJB ?

    hi forum...
    how to use Java WebStart with EJB ?
    examples ?
    thanks...
    mindu

    Mindu,
    WebStart will work with EJB. I use it with WebLogic Server. You have to make sure and deploy the weblogic.jar file - sign it if needed.
    For signing information, look here,
    http://java.sun.com/products/javawebstart/1.2/docs/developersguide.html
    Dan

  • How to use my apple tv remote on my macbook?

    Hello, I have an Macbook pro 15 inch retina from 2013 (model number A 1398) and I want to use my apple tv remote on my macbook. But it won't work. When I look on the internet, they say I have to go to system preference -> security and privacy and then you can find your infrared but mine don't show the infrared.
    So can somebody help me to use my remote on my macbook please?

    I do not believe that the newer Mac's support this. You should look at the front bezel and see if it has an IR sensor. If it does, follow the instructions here:
    http://support.apple.com/kb/ht1619
    or
    http://support.apple.com/kb/PH14075

  • Question: How to use XMLType in a CMP EJB???

    Hello, Together,
    I have a big problem using XMLType in a CMP EJB. I don't know, if somebody knows about it:
    I am trying to write a CMP EJB, which should be deployed under JBoss later. The problem here is, which java data type should I use to map a column of XMLType. I have tried to use it as a java.lang.Object, and also as a java.lang.String, it did not work properly.
    Can someone help me? Thanks a lot!

    Just pass the in the JSP/Servlet involved ServletContext through as a method or constructor parameter of that Java class.
    Semi-pseudo:protected doPost(req, res) {
        ServletContext servletContext = getServletContext();
        SomeJavaClass someJavaClass = new SomeJavaClass(servletContext);
        // or
        someJavaClass.doSomething(servletContext);
    }

  • How to use  alternative SQL  statements  in  EJB

    I have a probelm to use alternative sql statements in EJB,
    could any one sugg on this topic,
    Thanks in advance.

    Please explain your problem better. Really can't figure what you are trying to do.....
    choosing which sql statement to use at runtime
    or creating dynamic sql statement at runtime
    which??
    Regards

  • RMI -How to use JFileChooser to see remote computer FileSystem

    i hav made a program in RMI which uses JFileChooser to show remote-machine File System. i have made my own FileSyatemView class (MyFileSyatemViewClient which extends FileSystemView) and override all the methods of FileSystemView Except getFileSystemView.
    Similarly i have made my own FileView(MyFileViewClient).
    i fed these to the JFileChooser. And object of JFileChooser i am recieving from the server through remote method getFileChooser(). Thus the code is like:
                             MyFileSystemViewClient mfsvc; //Defined Globally
                             MyFileViewClient mfvc; //Defined Globally
    public void actionPerformed(ActionEvent ae)
    if(ae.getActionCommand().equals("Open"))
                             mfsvc = new MyFileSystemViewClient();
                             mfvc = new MyFileViewClient();
    try
    JFileChooser jfc=fi.getFileChooser();
    // "fi" is the FileInterface through which we access server-side methods.
                                  jfc.setFileSystemView(mfsvc);
                                  jfc.setFileView(mfvc);                              
                                  int retval = jfc.showOpenDialog(null);
                                  if(retval==JFileChooser.APPROVE_OPTION)
                                       getf = jfc.getSelectedFile();
                             catch(Exception e)
                                  System.out.println("Error Occurred In OPEN :"+e);
    MyFileSystemViewClient class looks as :
    public class MyFileSystemViewClient extends FileSystemView
                   public MyFileSystemViewClient()
                        //super();
                        try{
                        fi.invokeMyFileSystemViewCons();
                        }catch(Exception e){
                             System.out.println("Error in invokeMyFileSystemViewCons : "+e);
                   public File[] getFiles(File file,boolean tr)
                        try{
                        return fi.getFiles(file,tr);
                        }catch(Exception e){
                             System.out.println("Error in getFiles : "+e);
                             return null;}
                   public File getHomeDirectory()
                        try{
                        return fi.getHomeDirectory();
                        }catch(Exception e){
                             System.out.println("Error in getHomeDirectory : "+e);
                             return null;}
                   public File getParentDirectory(File dir)
                        try{
                        return fi.getParentDirectory(dir);
                        }catch(Exception e){
                             System.out.println("Error in getParentDirectory : "+e);
                             return null;}
                   public File[] getRoots()
                        try{                         
                        return fi.getRoots();                    
                        }catch(Exception e){
                             System.out.println("Error in getRoots : "+e);
                             return null;}
                   public File getDefaultDirectory()
                        try{
                        return fi.getDefaultDirectory();
                        }catch(Exception e){
                             System.out.println("Error in getDefaultDirectory : "+e);
                             return null;}
                   public File createNewFolder(File containingDir)
                        try{
                        return fi.createNewFolder(containingDir);
                        }catch(Exception e){
                             System.out.println("Error in createNewFolder : "+e);
                             return null;}
                   public String getSystemDisplayName(File f)
                        try{
                        return fi.getSystemDisplayName(f);
                        }catch(Exception e){
                             System.out.println("Error in getSystemDisplayName : "+e);
                             return null;}
                   public String getSystemTypeDescription(File f)
                        try{
                        return fi.getSystemTypeDescription(f);
                        }catch(Exception e){
                             System.out.println("Error in getSystemTypeDescription : "+e);
                             return null;}
                   public File getChild(File parent, String fileName)
                        try{
                        System.out.println("Child FIle : "+fi.getChild(parent,fileName));
                        return fi.getChild(parent,fileName);
                        }catch(Exception e){
                             System.out.println("Error in getChild : "+e);
                             return null;}
                   public boolean isParent(File folder,File file)
                        try
                             return fi.isParent(folder,file);
                        catch(Exception e)
                        System.out.println("Error in isParent : "+e);
                             return false;     
                   public Icon getSystemIcon(File f)
                        try{
                        return fi.getSystemIcon(f);
                        catch(Exception e)
                        System.out.println("Error in getSystemIcon : "+e);
                             return null;     
                   public boolean isDrive(File dir)
                        try{
                        return fi.isDrive(dir);
                        catch(Exception e)
                        System.out.println("Error in isDrive : "+e);
                             return false;     
                   public boolean isFileSystem(File f)
                        try{
                        return fi.isFileSystem(f);
                        catch(Exception e)
                        System.out.println("Error in isFileSystem : "+e);
                             return false;     
                   public boolean isFileSystemRoot(File dir)
                        try{
                        return fi.isFileSystemRoot(dir);
                        catch(Exception e)
                        System.out.println("Error in isFileSystemRoot : "+e);
                             return false;     
                   public boolean isFloppyDrive(File dir)
                        try{
                        return fi.isFloppyDrive(dir);
                        catch(Exception e)
                        System.out.println("Error in isFloppyDrive : "+e);
                             return false;     
                   public boolean isRoot(File f)
                        try{
                        return fi.isRoot(f);
                        catch(Exception e)
                        System.out.println("Error in isRoot : "+e);
                             return false;     
                   public Boolean isTraversable(File f)
                        try{
                        return fi.isTraversable(f);
                        catch(Exception e)
                        System.out.println("Error in isTraversable : "+e);
                             return null;     
    //.....................................................End of the MyFileSystemViewClient.......................
    Thus each method in the class MyFileViewClient brings the required information from the server. BUT we are getting two problems:
    1) so many folders at the server-side are shown as files in the dialogbox.
    2)dialog box shows all "folders of the desktop" of the local filesystem and some more "local drives without any name". when i click a folder in the dialog box which is on my local machine, nothing happens. they are just the icon with the name but don't show the content. although i can easily see the drives of the remote filesystem and browse through except for the problem stated above at no.1.
    ok guys now its your turn to speak up.....
    plz give some suggestions and comments..
    ciao!!

    sry to all friends there who can't read the code clearly. as per the suggestion i am putting the code afresh..
    the main client class which binds to the server contains following piece of code :
    MyFileSystemViewClient mfsvc; //Defined Globally
    MyFileViewClient mfvc; //Defined Globally
    public void actionPerformed(ActionEvent ae)
         if(ae.getActionCommand().equals("Open"))
              mfsvc = new MyFileSystemViewClient();
              mfvc = new MyFileViewClient();
              try
                   JFileChooser jfc=fi.getFileChooser();//Requesting JFileChooser object from server.
                   // "fi" is the FileInterface through which we access server-side methods.
                   jfc.setFileSystemView(mfsvc);
                   jfc.setFileView(mfvc);
                   int retval = jfc.showOpenDialog(null);
                   if(retval==JFileChooser.APPROVE_OPTION)
                   getf = jfc.getSelectedFile();
              catch(Exception e)
              System.out.println("Error Occurred In OPEN :"+e);
    }i again like to convey that, "fi" is the FileInterface through which we access server-side methods.
    MyFileSystemViewClient class looks as :
    public class MyFileSystemViewClient extends FileSystemView
                   public MyFileSystemViewClient()
                        //super();
                        try{
                        fi.invokeMyFileSystemViewCons();
                        }catch(Exception e){
                             System.out.println("Error in invokeMyFileSystemViewCons : "+e);
                   public File[] getFiles(File file,boolean tr)
                        try{
                        return fi.getFiles(file,tr);
                        }catch(Exception e){
                             System.out.println("Error in getFiles : "+e);
                             return null;}
                   public File getHomeDirectory()
                        try{
                        return fi.getHomeDirectory();
                        }catch(Exception e){
                             System.out.println("Error in getHomeDirectory : "+e);
                             return null;}
                   public File getParentDirectory(File dir)
                        try{
                        return fi.getParentDirectory(dir);
                        }catch(Exception e){
                             System.out.println("Error in getParentDirectory : "+e);
                             return null;}
                   public File[] getRoots()
                        try{                         
                        return fi.getRoots();                    
                        }catch(Exception e){
                             System.out.println("Error in getRoots : "+e);
                             return null;}
                   public File getDefaultDirectory()
                        try{
                        return fi.getDefaultDirectory();
                        }catch(Exception e){
                             System.out.println("Error in getDefaultDirectory : "+e);
                             return null;}
                   public File createNewFolder(File containingDir)
                        try{
                        return fi.createNewFolder(containingDir);
                        }catch(Exception e){
                             System.out.println("Error in createNewFolder : "+e);
                             return null;}
                   public String getSystemDisplayName(File f)
                        try{
                        return fi.getSystemDisplayName(f);
                        }catch(Exception e){
                             System.out.println("Error in getSystemDisplayName : "+e);
                             return null;}
                   public String getSystemTypeDescription(File f)
                        try{
                        return fi.getSystemTypeDescription(f);
                        }catch(Exception e){
                             System.out.println("Error in getSystemTypeDescription : "+e);
                             return null;}
                   public File getChild(File parent, String fileName)
                        try{
                        System.out.println("Child FIle : "+fi.getChild(parent,fileName));
                        return fi.getChild(parent,fileName);
                        }catch(Exception e){
                             System.out.println("Error in getChild : "+e);
                             return null;}
                   public boolean isParent(File folder,File file)
                        try
                             return fi.isParent(folder,file);
                        catch(Exception e)
                        System.out.println("Error in isParent : "+e);
                             return false;     
                   public Icon getSystemIcon(File f)
                        try{
                        return fi.getSystemIcon(f);
                        catch(Exception e)
                        System.out.println("Error in getSystemIcon : "+e);
                             return null;     
                   public boolean isDrive(File dir)
                        try{
                        return fi.isDrive(dir);
                        catch(Exception e)
                        System.out.println("Error in isDrive : "+e);
                             return false;     
                   public boolean isFileSystem(File f)
                        try{
                        return fi.isFileSystem(f);
                        catch(Exception e)
                        System.out.println("Error in isFileSystem : "+e);
                             return false;     
                   public boolean isFileSystemRoot(File dir)
                        try{
                        return fi.isFileSystemRoot(dir);
                        catch(Exception e)
                        System.out.println("Error in isFileSystemRoot : "+e);
                             return false;     
                   public boolean isFloppyDrive(File dir)
                        try{
                        return fi.isFloppyDrive(dir);
                        catch(Exception e)
                        System.out.println("Error in isFloppyDrive : "+e);
                             return false;     
                   public boolean isRoot(File f)
                        try{
                        return fi.isRoot(f);
                        catch(Exception e)
                        System.out.println("Error in isRoot : "+e);
                             return false;     
                   public Boolean isTraversable(File f)
                        try{
                        return fi.isTraversable(f);
                        catch(Exception e)
                        System.out.println("Error in isTraversable : "+e);
                             return null;     
    //--------------------------------------------------------------------

  • How to use JNDI lookup from a JSP

    Hello,
    I know I should not be doing this (writing the lookup code in a JSP) but have to do it for some reasons.
    I am using this code in my JSP:
    try
         Context ctx = new InitialContext();
         dataSource = (DataSource)ctx.lookup("jdbc/mybillingora");
         conn = dataSource.getConnection();
         statement = conn.createStatement();
    catch(Exception excep)
    Is this code enough for a JNDI look up?? When I use this code, I get an exception:
    "javax.naming.NameNotFound exception:jdbc/mybillingora"
    Do I need to do something else??
    Why do we use :
    Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "<some_context_factory>");
    env.put(Context.PROVIDER_URL, PROVIDER_URL);
    env.put(Context.SECURITY_PRINCIPAL, JNDI_USER);
    env.put(Context.SECURITY_CREDENTIALS, JNDI_PWD);
    InitialContext = new InitialDirContext(env);
    where JNDI_USER is the userid If ACL is configured at the JNDI server
    where JNDI_PWD is the password If ACL is configured at the JNDI server
    Context.INITIAL_CONTEXT_FACTORY is the initial Context factory and depends on ur JNDI service provider.
    PROVIDER_URL is the url of the JNDI server containing protocol/ip/port
    do i need to use this??
    would appreciate your help on this....
    Thanks

    If Tomcat is your servlet/JSP engine, they have a nice bit about how to do it:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    MOD

  • Where to put jndi.properties in Web application to lookup remote EJB?

    Hi All,
    I want to use EJB deployed in an OC4J from web application deployed in another OC4J.
    I've try to put jndi.properties file into WEB-INF/classes; package it into a jarfile and put into WEB-INF/lib, ... In all case, it doesn't work.
    If I hard-coding the env properties as following, it works.
    env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory" );
    env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
    env.put( Context.SECURITY_CREDENTIALS, "welcome1");
    env.put(Context.PROVIDER_URL, "opmn:ormi://fmtresearch:6005:home/TEST");
    But if I put those env properties in jndi.properties file, it doesn't work.
    java.naming.factory.initial=oracle.j2ee.rmi.RMIInitialContextFactory
    java.naming.security.principal=oc4jadmin
    java.naming.security.credentials=welcome1
    java.naming.provider.url=opmn:ormi://fmtresearch:6005:home/TEST
    Note that, the jndi.properties work if it is used in client application.
    Please help me! Thanks.

    This may not help you directly. However, did you try printing the environment properties in the InitialContext you created.
    Another thing.
    You can use this function after creating the initial context to see the JNDI tree and see if it contains anything.
    Thank you.
    Function To list the JNDI Context name-object bindings
    private void listContext2 (Context ctx, int ind, String name, String spaceIndent) {
    String indent = spaceIndent + "[" + Integer.toString (ind) + "]" ;
    try {
    System.out.println (indent + "{" + name + "}");
    NamingEnumeration justList = ctx.list(name);
    while (justList.hasMore()) {
    NameClassPair listItem = (NameClassPair) justList.next();
    String className = listItem.getClassName();
    String subName = listItem.getName();
    boolean isRelative = listItem.isRelative();
    String relativeName = ("".equals(name) ? new String(subName) : new String (name + "/" + subName));
    listContext2 (ctx, (ind+1), relativeName, (" " + spaceIndent) );
    catch (Exception exc) {
    System.out.println ("Exception Occured at listContext2");
    Hope it helps not deviates. Good luck

  • How to use JNDI with JSPDYNPAGE?

    Hi Experts,
    Im having trouble looking up my deployed java proxy that is on WAS. When I try to lookup it through my JSPDYNPAGE portal component, it throws this error:
    #1.5 #00E0ED0BA5EF00710000002600000F92000453A6B0EEF782#1217875304970#System.err#sap.com/irj#System.err#TESTUSER#6717##n/a##2c379d00625411dda84d00e0ed0ba5ef#SAPEngine_Application_Thread[impl:3]_16##0#0#Error##Plain###befor 111#
    #1.5 #00E0ED0BA5EF00710000002700000F92000453A6B0EF1840#1217875304978#System.err#sap.com/irj#System.err#TESTUSER#6717##n/a##2c379d00625411dda84d00e0ed0ba5ef#SAPEngine_Application_Thread[impl:3]_16##0#0#Error##Plain###com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/ECCWS.
         at com.sap.engine.services.jndi.implserver.ServerContextImpl.getLastContainer(ServerContextImpl.java:261)
         at com.sap.engine.services.jndi.implserver.ServerContextImpl.lookup(ServerContextImpl.java:624)
         at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:344)
         at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:254)
         at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:271)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at com.xyz.ECEWenService$ECEWenServiceDynPage.callWebServicePrxy(ECEWenService.java:79)
         at com.xyz.ECEWenService$ECEWenServiceDynPage.doInitialization(ECEWenService.java:57)
         at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:105)
         at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.doPreview(AbstractPortalComponent.java:240)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:168)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
         at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
         at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:524)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:407)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    #1.5 #00E0ED0BA5EF00710000002800000F92000453A6B0EF1AAB#1217875304979#System.err#sap.com/irj#System.err#TESTUSER#6717##n/a##2c379d00625411dda84d00e0ed0ba5ef#SAPEngine_Application_Thread[impl:3]_16##0#0#Error##Plain###Naming Exception Path to object does not exist at java:comp, the whole lookup name is java:comp/env/ECCWS.#
    Here is how I am trying to use it:
    protected void callWebServicePrxy(){
         Hashtable env = new Hashtable();
         env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
         env.put(Context.PROVIDER_URL, "localhost:50004");
         try{
         InitialContext ctx = new InitialContext();
         Service obj = (Service) ctx.lookup("java:comp/env/ECCWS");
         YCUST port =  (YCUST)obj.getLogicalPort("YCUST");                         
         BAPI_CUSTOMER_GETDETAIL parameter = new BAPI_CUSTOMER_GETDETAIL();
         parameter.setCUSTOMERNO("0000009702");
         parameter.setPI_SALESORG("0001");
         BAPI_CUSTOMER_GETDETAILResponse result = new BAPI_CUSTOMER_GETDETAILResponse();
         result = port.BAPI_CUSTOMER_GETDETAIL(parameter);
         String NamePrint= result.getPE_ADDRESS().getNAME();
         System.err.println("Printing voila - " + NamePrint);
         }catch(ServiceException se){
            se.printStackTrace();
            System.err.print("Service Exception " + se.toString());
         }catch(RemoteException re){
            re.printStackTrace();
           System.err.print("Remote Exception " + re.toString());      
        }catch(NamingException ne) {
            ne.printStackTrace();
            System.err.println("Naming Exception " + ne.getMessage());
         }catch(Exception e) {
         e.printStackTrace();
         System.err.println("Exception " + e.getMessage());
    Do I need to put anything in my portal app.xml? Also, Is there any configuration required on Visual Admin.
    PLease help.
    Thanks
    SB

    Hi Stefan,
    Thanks, I was also looking at this help information. What Im doing in my portalapp.xml is below:
    <property name="PrivateSharingReference" value="SAPJ2EE::interface::ECCWS"/>
    But it is still giving the same error.
    One more question- Is it only 1 ( after interface in [SAPJ2EE::interface::] or is it TWO ( like this below
    SAPJ2EE::interface:
    Do you think im missing anything else?
    Thanks,
    SB

Maybe you are looking for

  • I recently purchased a MacBook Pro with Retina.  Which adapter do I purchase to connect it to a Samsung TV for the best quality?

    I recently purchased a MacBook Pro with Retina.  Which adapter do I purchase to connect it to a Samsung TV for the best quality? Thanks.

  • ActiveX Print Control

    1) I am having issues using the ActiveX print control. If I login as an Administrator I can get the control to work properly. On the dame machine I login as a standard user and I cannot use the print control. Any ideas why this is? It does sound like

  • SOA 10.1.3.5.1 certified with WLS 10.3.2

    You can download and run WLS 10.3.2 but only deploy SOA SUITE 10.1.3.5.1 to WLS 10.3.1. Why can't Oracle synchronize the release of their products. I am not sure what path to pursue ! We are already using WLS 10.3.2 from other reasons and would rathe

  • Corrupt Content Error after Upgrade to 7.0.1

    Ever since I upgraded to 7.0.1., I've been having problems with multiple websites generated a Corrupted Content Error when I try to load them. I NEVER had this before I allowed Firefox to update! I've double checked my version and it is, indeed, 7.0.

  • JSP/Java to Generate PDFs

    I am looking into what is involved in dynamically generating PDFs in Java. The project that I am looking into involves taking data submitted via a form and generating a PDF from it. Can anyone direct me to a good site, tutorial, or give some advice o