Problem in looking up EJB Home

Hi,
I am a starter to EJB's.. I am trying to run the "ConverterApp" application from the Sun's J2EE tutorial bundle. When I run the program thru the J2EE application client, I dont get any errors and I get the desired output. But when I use the Web client(index.jsp) then I get an "Internal Server Error" and it gives me an "Null pointer exception".
At the command prompt it says: "Unable to lookup home: TheConverter No object bound to name java:comp/env/ejb/TheConverter
I would greatly appreciate it if somebody could tell me what the problem is.
Thanks
prasanna

Hi Kumar,
Thanks for your help.. I had given the wrong slash "\" while typing the full path name. figured it out...
thanks
prasanna

Similar Messages

  • Looking up EJBs at different OC4J instances

    Hi there,
    I´m facing a little weird problem for looking up EJBs deployed at remote OC4J instancias. That is, my application runs at an OC4J instance at host A while some external components, needed by my application, run at an OC4J instance at host B.
    Host A runs OC4J version 10.1.3.2 while host B runs OC4J version 10.1.3.3. When I try to lookup some EJB I get the following exception:
    Caused by: java.io.InvalidClassException: oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl; local class incompatible: stream classdesc serialVersionUID = -7010736017799296921, local class serialVersionUID = 5036353448034635021
    It seems that the serialVersionUID field was not overriden in the class ManagedConnectionFactoryImpl, so each OC4J version has a ManagedConnectionFactoryImpl class with a distinct serial version.
    Well, how do I turn around this? Is this a limitation of OC4J that I should cope with (not being able to exchange data through components deployed at different OC4J versions)?
    Regards,
    Loreno

    There are some days since this thread was created. Does the miss of an answer means that it is no possible to exchange data through EJBs deployed at different OC4J instancies, with different versions?

  • Problem with Dynamically accessing EJB Class objects in WL 7.0 SP1

    I am trying to build a component which has the ability to instantiate and execute
    an known EJB method on the fly.
    I have managed to build the component but when I try and execute it I get a ClassNotFoundException.
    I know that the EJB I am trying to invoke is deployed and available on the server,
    as I can see it in the console, I also seen to have been able to get the remote
    interface of the object, my problem occurs when I try and access the class object
    so I can perform a create on the object and then execute my method
    The code I have written is below:
    private Object getRemoteObject(Context pCtx, String pJNDIName, String pHomeBean)
    throws Exception {
         String homeCreate = "create";
         Class []homeCreateParam = { };
         Object []homeCreateParamValues = {};           
    try {  
    //This call seems to work and doesn't throw an exception     
    Object home = pCtx.lookup(pJNDIName);
    //However this call throws a java.lang.ClassNotFoundException
    Class homeBean = Class.forName(pHomeBean);
    Method homeCreateMethod = homeBean.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    } catch (NamingException ne) {             
    logStandardErrorMessage("The client was unable to lookup the EJBHome.
    Please make sure ");
    logStandardErrorMessage("that you have deployed the ejb with the JNDI
    name "+pJNDIName+" on the WebLogic server ");
    throw ne;
    } catch (Exception e) {
    logStandardErrorMessage(e.toString());
    throw e;     
    Any advice would be really appreciated, I'm fast running out of ideas, I suspect
    it has something to do with the class loader but I'm not sure how to resolve it
    Regards
    Jo Corless

    Hello Joanne,
    Congratulations! I'm very happy that you've managed to fix your problem. It's
    always essential to understand how to package applications when deploying on BEA
    WebLogic. Usually, by throwing everything into an EAR file solves just about all
    the class loader problems. :-) Let us know if you have any further problems that
    we can assist you with.
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Joanne Corless" <[email protected]> wrote:
    >
    >
    I've fixed it!!!!!!!!
    Thanks to everyone who gave me help!!!!
    The class loader was the culprit which is what I suspected all along.
    As soon
    as I put the 2 jar files I was using into an EAR file the problem went
    away!!!!!
    Thanks again
    Jo Corless
    "Ryan LeCompte" <[email protected]> wrote:
    Hello Joanne,
    As Mr. Woollen mentioned, I also believe it's a problem with the class
    loader.
    You need to be careful how you arrange your EJBs, because WebLogic has
    a specific
    method in which it loads classes in an EAR, JAR, and WAR file(s). Please
    refer
    to http://dev2dev.bea.com/articles/musser.jsp for more information about
    BEA WebLogic
    class loading mechanisms and caveats. Also, try printing out the various
    methods
    that are available on the object that was returned to you via reflection.
    For
    example, use the getMethods() method, which returns an array of Method
    objects
    that you can subsequently cycle through and print out the various method
    names.
    This way you can discover if the class found/returned to you is indeed
    the one
    you intend to locate.
    Hope this helps,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    Rob Woollen <[email protected]> wrote:
    I believe the issue is the home interface class for this EJB is not
    available in the class loader which is doing the reflection.
    If you do:
    getClass().getClassLoader().loadClass(homeInterfaceClassName)
    I suspect it will fail. Reflection still requires that the class be
    loadable.
    -- Rob
    Joanne Corless wrote:
    Hi Slava,
    If I make my code look like you describe below I get a compliationerror telling
    me that
    home.getMethod() is not recognised (no such method)
    If I change it slightly and use
    Method homeCreateMethod =
    home.getClass().getMethod(homeCreate,homeCreateParam);
    The code will compile OK but when executed it still throws a NoSuchMethodException
    Any ideas ?
    Thanks for your help so far
    Regards
    Jo Corless
    Your code should look like
    Object home = pCtx.lookup(pJNDIName);
    Method homeCreateMethod =
    home.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    Regards,
    Slava Imeshev
    "Joanne Corless" <[email protected]> wrote in message
    news:[email protected]...
    Hi Ryan,
    I also wanted to mention that if you do a "header search" in this
    particular
    newsgroup
    with the search query as "reflection", you will see many previousmessages
    regarding
    reflection and EJBs. I believe you could learn a lot from thedifficulties
    that
    others have faced and solved.I tried that and although there was a number of similar cases noneof them
    actually
    seem to fix my issue. Thanks for the suggestion though
    Are the EJBs that you are trying to access accessible via your
    system
    classpath?
    Try to avoid having them accessible via the main system classpath,and
    only bundle
    them in your appropriate EJB jar files (contained in an EAR file,for
    example).Maybe I should have laid the problem out a little clearer.
    I have a number of EJB's bundled up in a JAR file which is hot deployedto
    the
    server. Within this first JAR file is an EJB (SSB) component that
    needs
    to
    be
    able to invoke a known method on another EJB. This second EJB may
    or
    may
    not be
    within the first JAR file but it also will be hot deployed.
    The component trying to invoke the method on the 2nd EJB has to
    be
    able to
    create
    an instance of the 2nd EJB without actually knowing anything bar
    a
    JNDI
    Name which
    is passed in at runtime.
    I can get as far as doing the
    Object home = pCtx.lookup(pJNDIName);
    This returned a class with the name
    "com.csc.edc.projects.allders.httppostoffice.postman.PostmanBean_mp8qy2_Home
    Impl_WLStub"
    My problem seems to occur when I try and invoke the create method
    Method homeCreate = home.getClass().getMethod("create", new Class[0]);
    My code throws a java.lang.NoSuchMethodException at this point so
    I
    am
    unable
    to progress to the next step of :
    Object bean = homeCreate.invoke(home, null);
    So I can return the instantiated bean back to the calling client.
    Why am I getting the NoSuchMethodException, is is because I am gettinga
    stub
    back rather than the home interface and if so how do I get the truehome
    interface
    from the bean
    Thanks in advance
    Jo Corless

  • Looking up EJBs from a java client

    While trying to migrate my application from standalone-oc4j
    to Oracle Application Server 10g, I ran into the following problem.
    My application has a stateless session bean. When trying to lookup the bean (from a java client), I get the following exception:
    javax.naming.NamingException: Lookup error: javax.naming.AuthenticationException
    Invalid username/password for UnifyoccEAR (ias_admin)
    My code used the username/password I used to log into web-based console (which I used to deploy the application). The lookup code follows:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    OracleJASLayer.INITIAL_CONTEXT_FACTORY);
    env.put(Context.PROVIDER_URL, "ormi://localhost:3201/UnifyoccEAR");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL, username);
    env.put(Context.SECURITY_CREDENTIALS, password);
    Context ctx = new InitialContext(env);
    Object obj = ctx.lookup("unify/nxj/controlCenters/occ/ControlCenterEJB");
    On a whim, I tried the old SCOTT/TIGER username/password and got the following
    exception:
    javax.naming.NoPermissionException: Not allowed to look up unify/nxj/controlCenters/occ/ControlCenterEJB,
    check the namespace-access tag setting in orion-application.xml for details
    So evidently, SCOTT/TIGER is in the security database used by the app (but isn't
    authorized) while the ias_admin user is not in the security database.
    I have the following questions:
    1. In the default configuration, is there a username/password I can use to
    lookup EJB homes in the jndi namespace of an OC4J instance? If so, what
    is it?
    2. Where is the security database? I tried looking in the web-based console
    to find how to configure security and could not figure it out. I did find
    the Security page for the application, but when I tried to add a user,
    it had no effect. Furthermore, this page did not show a user entry for
    SCOTT; hence, it doesn't seem that OC4J is actually using the information
    on this page. This is strange because the path to this page is:
    Farm > Application Server: ias_admin.lab10.sac.unify.com > OC4J: home > Application: UnifyoccEAR > Security
    I then went to the Security page for the default application and found
    that it did have a SCOTT user. So I added a new user and tried to run
    my java client. This resulted in the javax.naming.AuthenticationException
    described above (I was expected the NoPermissionException encounted when
    using SCOTT/TIGER). Next, I used the Security page for the default application
    to change the password for SCOTT and reran my java client using SCOTT/TIGER.
    This time I was expecting an AuthenticationException exception, but got the
    NoPermission exception. Therefore, it seems that OC4J isn't using this
    security data either.
    Hunting in the console (again) for the security database, I stumble accross
    the Infrasturcture page and see an Identity Management section and see that
    it is configure to use an Oracle Internet Directory server. Using
    <ORACLE_HOME>/bin/oidadmin, I connect to the directory server and look
    for the SCOTT user. I don't find it, so I believe that this can't be the
    security database either.
    3. Finally, how do I configure the OC4J instance such that it will allow
    anonymous users to lookup my EJB from a java client?
    Please help a confused and frustrated user.

    Looking at your example, it looks like you are using a J2EE client container or some properties file to specify the JNDI environment used to create the initial context (for you use the no-arg constructor to InitialContext). Since our application needs to the ability to dynamically connect to ejb's running on different Java application servers (e.g., WebLogic, WebSphere, JBoss), such an approach will not work. Instead we must do it the old-fashioned way and pass the jdni connection info to the InitialContext constructor.
    In any event, our problem isn't how to write the connection code, it is how to test it. Specifically, we can't figure out a valid username/password that will allow us to look up the home. Nor can we figure out how to configure security for the oc4j instance.

  • New problem, Lycos Mail is my home page. When I open a new window I usually get Google search, which is what I want. Now, somehow when I open a new window I get Yahoo search. How do I change it back to Google? Thank you, Randy

    New problem, Lycos Mail is my home page. When I open a new window I usually get Google search, which is what I want. Now, somehow when I open a new window I get Yahoo search. How do I change it back to Google?
    Thank you,
    Randy

    A new tab opens by default as a blank tab (about:blank).
    If that isn't the case then an extension has changed that behavior.
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    You can middle-click or hold down Ctrl and left-click the Home button on the Navigation toolbar to open the Home page in a new tab.
    You can look at this extension to set which page to open in a new tab:
    * NewTabURL : https://addons.mozilla.org/firefox/addon/newtaburl/

  • My iPhone 5 is experiencing problems with the Wifi at home. It shows that it is connected to the wifi but anything that uses wifi doesn't load. The wifi works sometimes however but this is rare. How do I fix this?

    My iPhone 5 is experiencing problems with the Wifi at home. It shows that it is connected to the wifi but anything that uses wifi (apps etc) doesn't load content and just looks like it's loading forever but nothing ever comes. However the wifi and wifi/internet dependant apps work sometimes but it's rare. How do I fix this?

    Back up all data.
    Unlock the Network preference pane, if necessary, by clicking the lock icon in the lower left corner and entering your password. Cllck Advanced, open the DNS tab, and change the server addresses to the following:
              8.8.8.8
              8.8.4.4
    That's Google DNS. Click OK, then Apply.
    In Safari, select
              Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
    and confirm. If you’re using another browser, empty the cache. Test. Any difference?
    Notes:
    1. If you lose Internet access after making the above change to your network settings, delete the Google servers in the  Network preference pane, then select the TCP/IP tab and click Renew DHCP Lease. That should restore the original DNS settings; otherwise restore them yourself. Remember that you must click Apply in order for any changes to take effect.
    2. I don't use Google DNS myself, though I have tested it, and I'm not recommending it or any other DNS provider; the server addresses are offered merely for testing purposes. There may be privacy and technical issues involved in using that service, which you should investigate personally before you decide whether to keep the settings. Other public DNS services exist.

  • EJB home stubs in a cluster

    The following URL describes how replica-aware EJB home stubs work. Basically,
    when you do a lookup for the EJB home in JNDI, you get a home stub on any of the
    nodes in the cluster.
    However, I want to invoke EJBs on a particular node in the cluster. Can I do
    this by simply disabling the replica-aware EJB home in the deployment descriptor
    and doing a remote JNDI lookup on the desired node in the cluster? And if so,
    would I have to bind each EJB's home to JNDI with a different name?
    -reza
    http://edocs.bea.com/wls/docs61/cluster/object.html#1006777
    All bean homes can be clustered. When a bean is deployed on a server, its home
    is bound into the cluster-wide naming service.
    Because homes can be clustered, each server can bind an instance of the home under
    the same name. When a client looks up this home, it gets a replica-aware stub
    that has a reference to the home on each server that deployed the bean. When create()
    or find() is called, the replica-aware stub routes the call to one of the replicas.
    The home replica receives the find() results or creates an instance of the bean
    on this server.

    However, I want to invoke EJBs on a particular node in the cluster. Can Ido
    this by simply disabling the replica-aware EJB home in the deploymentdescriptor
    and doing a remote JNDI lookup on the desired node in the cluster? Andif so,
    would I have to bind each EJB's home to JNDI with a different name?Yes. Something like that. We do that with JMS queues sometimes (to send a
    message to a particular machine in the cluster).
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "Behforooz" <[email protected]> wrote in message
    news:3c8fc8bf$[email protected]..
    >

  • ClassNotFound while narrowing JNDI ref to ejb home interface

    Hello everybody
    I'm quite new to BEA WebLogic. I deployed Jasmine application on Bea WLS7 (example
    app from Mastering EJB 2). But when i tried to use login servlet, it threw an
    exception ClassNotFound when narrowing ejb home interface (obtained via JNDI).
    EJBs are in .jar file, and web files are in the .war file, maybe this is the problem.
    Should I copy ejb classes to .war file, or make some tricks with CLASSPATH, or
    maybe there is better way to make it work (maybe via J2EE references or something
    like this).
    Thanks in advance

    Strange. And you do not have any application classes in the system
    classpath?
    Konrad R. <[email protected]> wrote:
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Did you deploy ejbs and war in the same ear?
    Yes, both were packed up into one .ear archive>>
    Konrad R. <[email protected]> wrote:
    Hello everybody
    I'm quite new to BEA WebLogic. I deployed Jasmine application on BeaWLS7 (example
    app from Mastering EJB 2). But when i tried to use login servlet, itthrew an
    exception ClassNotFound when narrowing ejb home interface (obtainedvia JNDI).
    EJBs are in .jar file, and web files are in the .war file, maybe thisis the problem.
    Should I copy ejb classes to .war file, or make some tricks with CLASSPATH,or
    maybe there is better way to make it work (maybe via J2EE referencesor something
    like this).
    Thanks in advance--
    Dimitri

  • EJB Home Objects and Stubs

    Hi,
    Can anyone pls tell me,what are the objects are created in Server after the Deployment of EJB.
    Is the EJB Home Object,EJB Home Object Stub,EJB Home Object Skeleton, EJB Local Home Object, EJB LocalHome Object Stub,Ejb LocalHome Object Skeleton.And Finally both the Stub objects and Skeleton Objects will be stored in the Jndi Registry ?
    Thanks in Advance,
    Venkat

    Nic,
    Caching the home object is a comon practice.
    Take a look here:
    http://www.theserverside.com/resources/patterns_review.jsp
    Look at the EJB Home Factory Pattern.
    Regards,
    -Dat

  • Unable to bind EJB Home Interface to the JNDI name

    Why do I get this error?? What is the jndi-name in weblogic-ejb-jar.xml
    Unable to deploy EJB: OrganizationEJB from sempire_bc.jar:
    Unable to bind EJB Home Interface to the JNDI name:
    com.sempire.builder.business
    _component.Organization. The error was:
    javax.naming.NameAlreadyBoundException: Organization is already bound;
    remaining
    name 'com.sempire.builder.business_component'
    <<no stack trace available>>

    Slava,
    In case I change the name of the jndi name to a unique name. I still get the same
    problem. I checked for multiple occurences, but there aren't any.
    My web.xml file is:
    <ejb-local-ref>
    <description>
    Reference EJB resources in Weblogic Resources
    </description>
    <ejb-ref-name>GangsterEJB</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>com.sempire.builder.business_component.GangsterHome</local-home>
    <local>com.sempire.builder.business_component.Gangster</local>
    </ejb-local-ref>
    My weblogic-ejb-jar.xml file is:
    <weblogic-enterprise-bean>
    <ejb-name>GangsterEJB</ejb-name>
    <entity-descriptor>
    <persistence>
    <persistence-type>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>6.0</type-version>
    <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
    </persistence-type>
    <persistence-use>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>6.0</type-version>
    </persistence-use>
    </persistence>
    </entity-descriptor>
    <reference-descriptor>
    <resource-description>
    <res-ref-name>jdbc/GangsterDB</res-ref-name>
    <jndi-name>oraclePool</jndi-name>
    </resource-description>
    </reference-descriptor>
    <local-jndi-name>Gangster_test</local-jndi-name>
    </weblogic-enterprise-bean>
    I do not get the problem.
    Thank you
    Ronak Parekh
    "Slava Imeshev" <[email protected]> wrote:
    Hi Ronak,
    This exception means that you already have a bean
    with the same JNDI name. Search your weblogic-ejb-jar.xml files
    for multiple occurrences of the name and fix the problem.
    Regards,
    Slava Imeshev
    "Ronak Parekh" <[email protected]> wrote in message
    news:[email protected]...
    Why do I get this error?? What is the jndi-name in weblogic-ejb-jar.xml
    Unable to deploy EJB: OrganizationEJB from sempire_bc.jar:
    Unable to bind EJB Home Interface to the JNDI name:
    com.sempire.builder.business
    _component.Organization. The error was:
    javax.naming.NameAlreadyBoundException: Organization is already bound;
    remaining
    name 'com.sempire.builder.business_component'
    <<no stack trace available>>

  • Undable to bind EJB Home during deploy

    Hi
    I'm getting an exception when I redeploy to weblogic81. I have and ear with several ejb jars in it. The following is the message I get...
    Unable to bind EJB Home Interface to the JNDI name: EJBTestService. javax.naming.NameAlreadyBoundException: EJBTestService is already bound; remaining name :at weblogic.jndi.internal.BasicNamingNode.bindHere(BasicNamingNode.java:333) at weblogic.jndi.internal.ServerNamingNode.bindHere(ServerNamingNode.java:124) at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:291) at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:279) at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:384) at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:1116) at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1362) at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:631)
    This error doesn't always occur with the same jar in the ear. Sometimes the above jar prepares and activates fine and another one fails.
    If anyone has any idea I'd appreciate feedback.

    Hello,
    The error suggests that an object is already bound to the JNDI name.
    This can happen if you have 2 or more ejbs in your EAR file wit the same JNDI name or if your application has not fully/cleanly undeployed before you try to redeploy it.
    I suspect the latter is your problem. Once you have undeployed your application use the weblogic console to view your JNDI tree and make sure nothing is bound that should not be bound. Then redeploy your app. If you still have the problem check your ear does not have duplicate ejbs or ejbs using the same JNDI name.

  • Can l make an instance of EJB home handler / Datasource shared by EJB objs

    all ejb guru
    As far as l know, it is general rule of thumb to cache the EJB home handlers and datasource object at EJB bean instance. But can l go a step further, make the same instance of EJB home handlers and datasource object shared by more than 1 EJB bean instance ?
    ( l checked out the methods of javax.ejb.EJBhome and javax.sql.DataSource. They are not declared as synchronized. It seems to me that EJB home handlers and datasource object are not thread safe and not suitable for being shared. Even they are thread-safe, if they are shared by 1+ EJB bean instance. Sharing EJB home handlers and datasource object may interfere the thread management of EJB container. Am l correct ? )
    It is highly appreciated someone can share with me your insight in this issue.
    thanks & regards
    Danny

    Okay, you got me there. However, it's usually a better practice to start a new thread with your specific question instead of resurrecting old threads that (obviously) nobody cared enough to answer.
    DataSources are retrieved from the container via JNDI. You may (generally) cache them in order to alleviate the JNDI lookup without worrying about Threads, as there is only (usually) one DataSource object per server (or node in a cluster). Do not cache (in your code) the Connection objects obtained from the DataSource - always close them in order to return them to the pool maintained by the DataSource.
    Caching EJB HomeHandles is the accepted manner of avoiding repeated JNDI calls to locate EJBs. Typically, extracting the EJBHome from the HomeHandle re-initializes whatever network operations are embedded in the EJBHome object(s) by the vendor's implementation. Once again, you do not necessarily need to worry about Threads - the container and vendor implementation is already taking care of that for you, transparently.
    Think about it: if there were Threading issues, even retrieving the above objects via JNDI would ensure that J2EE application servers wouldn't be Thread safe and all operations would be, essentially, blocked each time. Obviously, this is not the case since both DataSources and EJBHome objects can have multiple clients using them simultaneously. Just because there's not explicit synchronized tag on any of the methods defined in these interfaces doesn't mean they're single-Thread objects.

  • Problem in accessing a EJB bean through a servlet

    Dear all,
    I'm a trying to call a stateless session bean which has its home and component interfaces, which prints the name it receives from the servlet client.
    I'm trying to access a remote server EJB beans, which has been registered with JNDI & when deploying the EJB beans onto the Jboss server which operates in localhost: 8081 it has shown
    20:19:16,890 INFO  [EjbModule] Deploying greetBean
       20:19:17,109 INFO  [ProxyFactory] Bound EJB Home 'greetBean' to jndi 'greetJndi'
    20:19:17,125 INFO  [EJBDeployer] Deployed: file:/C:/jboss-4.0.5.GA/server/default/deploy/greet.jarThis is my servlet which is there in tomcat container which runs in localhost:8082 to access the bean:
    import java.net.*;
    import javax.ejb.*;
    import javax.rmi.*;
    import java.rmi.*;
    import javax.naming.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class greetServlet extends HttpServlet
    public void doPost
    (HttpServletRequest req, HttpServletResponse res)
    throws ServletException,IOException
    res.setContentType("text/html");
    PrintWriter out=res.getWriter();
    try
         out.println("Inside servlet");
    Properties props=new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    *props.put(Context.PROVIDER_URL, "localhost:8081");*
    props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
    System.out.println("Properties ok");
    Context ctx=new InitialContext(props);
    System.out.println("context ok");
    greetHome home = (greetHome)
    ctx.lookup("greetJndi");
    System.out.println("home ok");
    greetRemote remote=home.create();
    System.out.println("remote ok");
    String a = req.getParameter("text1");
    String s = remote.greetme(a);
    System.out.println(s);
    out.println(s);
    catch(Exception e)
    {System.out.println(""+e);}
    }When i try to access the bean it's throwing a communication exception. The exact stack trace is:
    javax.naming.CommunicationException: Could not obtain connection to any of these
          urls: localhost:8081 and discovery failed with error: javax.naming.Communicatio
         nException: Receive timed out [Root exception is java.net.SocketTimeoutException
         : Receive timed out] [Root exception is javax.naming.CommunicationException: Fai
         led to retrieve stub from server localhost:8081 [Root exception is java.io.EOFEx
    ception]]Could anyone say why this is occuring and how this can be fixed.
    Thanx in advance.

    when i change the properties url attribute to jnp://localhost:1099 like
    props.put(Context.PROVIDER_URL, "jnp://localhost:1099");It's throwing unmarshall exception:
    javax.naming.CommunicationException [Root exception is java.rmi.ServerException:
    RemoteException occurred in server thread; nested exception is:
            java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
            java.net.MalformedURLException: no protocol: Files/Apache]Could anyone throw light on this?

  • Problem compiling Web Service EJB endpoint - URGENT

    I was compiling a simple HelloWorld SLSB as an EJB Endpoints. The problem is with the ejb-jar.xml when compiler encounters xmlns namespace dec -
    <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" version="2.1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    I tried compiling this guy using weblogic builtin ant utlity from the example, then I tried using weblogic.ejbc but all are in vain.
    Please suggest, how to get rid of this problem.
    Thanks
    xgr3

    no, it's just like invoking any other webservice.
    That's why it's called a WEBSERVICE ENDPOINT to the EJB, and not an EJB ENDPOINT to a webservice.

  • At Apple Store we reset my Iphone 4s to factory settings in an unsuccessful bit to fix my Wi-fi problem.  Now I'm home trying to get my contacts, pics, etc. back.  I'm lost...

    At Apple Store we reset my Iphone 4s to factory settings in an unsuccessful bit to fix my Wi-fi problem.  Now I'm home trying to get my contacts, pics, etc. back.  I'm lost...

    Okay - see if the instructions here help: http://support.apple.com/kb/ph12521
    ~Lyssa

Maybe you are looking for