Initializing jndi context to call ejb??Help!!!

hi!
I installed j2ee sdk 1.4 ,deployed a ejb on my server.I tried to call the ejb following the example given by the
book.:
import javax.naming.*;
import javax.rmi.*;
import java.util.*;
public class jndi {
public static void main(String[] args) {
try {
     Hashtable env = new Hashtable();
     Context initctx = new InitialContext();
     Object objref = initctx.lookup("java:comp/env/ejb/HelloRef");
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
the error occured:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
then I try to initalize the jndi context:
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,"ldap://localhost:389");
Context initctx = new InitialContext(env);
It still does not work:
javax.naming.CommunicationException: localhost:389. Root exception is java.net.ConnectException: Connection refused: connect
Whatcan I do to call the ejb??

Hi, I think your original code should work ok but you should check the JNDI name of the EJB you deployed.
In order for your lookup to work properly the JNDI name of your EJB should be "java:comp/env/ejb/HelloRef" to match the lookup in your code.
Object objref = initctx.lookup("java:comp/env/ejb/HelloRef");
I'd try that first, you should find the EJB JNDI name in your deployment descriptors within the jar file.

Similar Messages

  • How to set jndi context to call EJB?

    Hello!
    install the j2ee sdk 1.4 on a server that has the ip address 211.83.144.48.
    then I deploy a EJB ,but I want to call the method from another pc.
    The problem is that how I initialize the jndi context? How can get the url for "Context.PROVIDER_URL"?
    thks.

    Hi there, I am having what appears to be a very similar problem.
    the code I am using for gaining the initial context is as follows:
    properties.put("java.naming.factory.initial",JNDI_FACT_CLASS_NAME);
    properties.put("java.naming.provider.url", s);
    return new InitialContext(properties);
    where these instantiated variables when pulled out of the hash are :
    java.naming.factory.initial : com.sun.appserv.naming.S1ASCtxFactory
    java.naming.provider.url : iiop://lich.ecs.soton.ac.uk:3700
    this works absolutely fine on the localhost machine, running both client and server, however when
    running on seperate machines I get the same ORB_COMM error as previously stated:
    WARNING: ORBUTIL.connectFailure
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:1739) com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:1757)
    ..etc..
    apparently this is caused by :
    java.net.ConnectException: Connection refused
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:460)
    at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
    ...etc...
    the server is definately up and running, and can provide all other services to the remote client, using both the IP and the DNS resolved name, and JVT seems to work fine, just not corba look up's of a queue.
    I am using the Sun Application Platform Server 8 and the standard j2EE RI versions of corba , JNDI e.t.c
    if you could suggest any further reason why the localhost may be resolvable, but the remote may not I would drastically appreciate the help, as I have been scouring forums for 2 days now, and exhaused all
    other potential solutions.
    thanks
    Tim

  • JNDI Context Retrieval in EJB 3.0

    I have a doubt about JNDI context retrieval in EJB 3.0. I know that when I call a bean from another bean I can use this line:
    InitialContext ctx=new InitialContext();
    But I'd like to know whether in a Client I am obliged to pass this parameter:
    InitialContext ctx=new InitialContext(System.getProperties());
    This method was the one I called when I used EJB 2.1..Now in many examples I find both these approaches...I'd like to know what differentiates one from another and which is the standard in EJB 3.0?
    I read that when calling a bean from another bean I can use the first constructor with no parameters...but in clients I am obliged to give the param..why?
    Thanks!

    Correct me if I am wrong: the application client
    container is a "static" container: you need to know
    which EJB to call at develop time and you can not
    change it later without recompiling.That's not quite right. First, there's nothing special about the application client
    container with respect to retrieving Java EE dependencies that is not also true
    of Java EE web containers and EJB containers. The programming model for
    defining and accessing EE dependencies is exactly the same, independent of
    whether the code is running in an Application Client, EJB container, etc.
    It's true that dependencies are defined at development time, but one of the
    whole reasons for the level of indirection provided by Java EE dependencies
    is to allow the target of those dependencies to change without changing code.
    E.g, with EJB dependencies this is done using the ejb-link attribute in ejb-ref
    or ejb-local-ref. That specifies which EJB is the target of the ejb dependency
    without changing the code used to retrieve the dependency.
    >
    JNDI was designed to be more flexible: you can
    dynamically lookup EJB homes, then call a remote
    method you like at runtime. Is that flexibility lost
    with application client container. Is there any way
    to dynamically inquiry-invoke?In the Java EE programming model, components always define what their
    dependencies are so that the deployer can configure them. The idea of
    doing a direct global lookup without using a Java EE dependency is
    outside the scope of Java EE. It works in many implementations but the
    specifics are not portable.
    We have a presentation that covers some of these topics you might find
    interesting. See here :
    https://glassfish.dev.java.net/javaee5/ejb/compdependencies_xmlforum_nov15.pdf

  • Initial JNDI context doesn't return the root node

    Hi :
    I just deployed a java application on Netweaver CE 7.2, when the application starts up, the code is trying to perform a JNDI bind and lookup operations by calling " Context context = new Initialcontext(), context.bind(), context.lookup("...)", the problem is that the initial context returned is not the root context (i.e. "/"), it's something like "webcontainer/applications/vendor-name/application-name/module-name/...." etc.. This is a problem for us because our application is consisted of multiple ears with multiple modues(wars) inside each ear, each module needs to publish a set of services as JNDI entries and those services (JNDI entries) need to be accessible to other ears or modules, which means they have to be published under some public directory (for exmaple the root directory), it can NOT be published under the current context of the current module.
    So,  my questions is, is there a way to make the "new Initialcontext()" to return the root directory, perhaps by changing the deployment descriptor or configuration settings somewhere? thanks a lot for your help.

    Hi,
       Add this code to the <i>wdDoModifyView()</i> method:
    IWDRoadMap rdMap = (IWDRoadMap) view.getElement("<id of the RoadMap UI>");
    rdMap.mappingOfOnSelect().addSourceMapping("step","selectedStep");
    Edit the StepSelected action to add a parameter called "<i>selectedStep</i>" of type String. After this the signature for the action handler will look like:
    public void onActionStepSelected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, String selectedStep )
    Inside the action handler you can access the selected step simply as "<i>selectedStep</i>".
    Regards,
    Satyajit.

  • JNDI Error  when calling ejb

    I've create a ear file include a war and jar
    when I call the servlet that call a ejb
    the following error prompt out:
    javax.naming.NameNotFoundException: Unable to resolve gendocnum. Resolved:
    '' Unresolved:'gendocnum' ; remaining name ''
    <<no stack trace available>>
    [2001/04/09 12:14:27, 0] nmbd/nmbd_namequery.c:query_name_response(93)
    query_name_response: Multiple (2) responses received for a query on subnet
    192.168.1.222 for name EDP<1d>. This response was from IP 192.168.1.134
    Please help
    Regards,
    Angel
    p.s. 'gendocnum' is the JNDI name of ejb

    It seems that u need a ejbPostCreate with the same parameters as ejbCreate:
    public Integer ejbCreate(Integer id) {
    setId(id);
    return id;
    public void ejbPostCreate(Integer id) {
    }

  • Oracle Service Bus, calling ejb on ormi protocol

    Hi.
    I'm trying to call an EJB on a Oracle Application server on the ormi protocol, but when i try to call it, I get this error:
    <con:fault xmlns:con="http://www.bea.com/wli/sb/context">
    <con:errorCode>BEA-380000</con:errorCode>
    <con:reason>
    General runtime error: Error accessing the JNDI context for the EJB call: java.net.UnknownHostException: Unknown protocol: 'ORMI'
    </con:reason>
    <con:location>
    <con:node>PipelinePairNode1</con:node>
    <con:pipeline>PipelinePairNode1_request</con:pipeline>
    <con:stage>stage1</con:stage>
    <con:path>request-pipeline</con:path>
    </con:location>
    </con:fault>
    I have my business service referencing a local jndi provider which in turn points to the remote server, on the ormi protocol.
    Could I be missing some libraries?

    I have my business service referencing a local jndi provider which in turn points to the remote server, on the ormi protocol.
    Could I be missing some libraries?EJB transport doesn't support ORMI. Protocols supported by JNDI Provider resource are documented. Click help on you JNDI provider page.
    supported protocols : http, https,t3, t3s, iiop,iiops.
    Only BPEL transport supports ORMI (http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/bpelpmtransport/transport.html)
    cheers
    Manoj
    Edited by: mneelapu on Jun 8, 2009 2:39 PM

  • Having touble getting the initial weblogic context

    Hi all,
    I am getting the following error when I try run the EJB client code. I have modified
    the classpath to point to WLInitialContextFactory.class but still I am getting the
    error. Can someone give me a pointer as what I am doing wrong here.
    WebGain Java! JustInTime Compiler Version 4.00.002(x) for JDK 1.2
    Copyright (C) 2000 WebGain, Inc.
    ** Unable to connect to the server at:
    [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]javax.naming.NoInitialContextException:
    Cannot instantiate class: weblogic.jndi.WLInitialContextFactory
    at javax.naming.spi.NamingManager.getDefaultInitialContextFactory(NamingManager.java:720)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:768)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169)
    at javax.naming.InitialContext.<init>(InitialContext.java:146)
    at GreetWorld.HelloWorldClient.main(HelloWorldClient.java:18)
    Thanks
    Ramanan

    ps: weblogic docs recommend releasing InitialContext when you're done so, as
    they are often overlooked resources as well.
    try
    get and use context
    catch( )
    finally
    try {    intialContext.close(); } blah blah...
    "Ramanan" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hi,
    Thanks for your reply. Following is my client code. I tried with yourcode too,
    but am getting the same result. Is there any setting that I need to do inthe weblogic
    property file or server setting?
    Context ctx=null;
    try
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, "t3://localhost:80");
    ctx = new InitialContext(p);
    catch (NamingException ne)
    ne.printStackTrace();
    return;
    Thanks
    Ramanan
    Deepak Vohra <[email protected]> wrote:
    To get an initial JNDI context to the WebLogic JNDI provider:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    // URL for the WebLogic Server
    env.put(Context.PROVIDER_URL, "t3://localhost:7001");
    ramanan wrote:
    Hi all,
    I am getting the following error when I try run the EJB client code.I have modified
    the classpath to point to WLInitialContextFactory.class but still I amgetting the
    error. Can someone give me a pointer as what I am doing wrong here.
    WebGain Java! JustInTime Compiler Version 4.00.002(x) for JDK 1.2
    Copyright (C) 2000 WebGain, Inc.
    ** Unable to connect to the server at:
    [Root exception is java.lang.ClassNotFoundException:
    weblogic.jndi.WLInitialContextFactoryjavax.naming.NoInitialContextException:
    Cannot instantiate class: weblogic.jndi.WLInitialContextFactory
    atjavax.naming.spi.NamingManager.getDefaultInitialContextFactory(NamingManager
    .java:720)
    atjavax.naming.spi.NamingManager.getInitialContext(NamingManager.java:768)
    atjavax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169)
    at javax.naming.InitialContext.<init>(InitialContext.java:146)
    at GreetWorld.HelloWorldClient.main(HelloWorldClient.java:18)
    Thanks
    Ramanan

  • How OSB pass Initial Context parameters to EJB

    For security reasons I have to pass a ticket (through initial context) to legacy system from OSB for calling EJB, below is a code
    Hashtable env = new Hashtable(2);
    env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL, connectionUrl);
    env.put(javax.naming.Context.SECURITY_PRINCIPAL, ticket);
    env.put(javax.naming.Context.SECURITY_CREDENTIALS, "");
    InitialContext ctx = new InitialContext(env);
    Object homeRef = ctx.lookup("com.cih.services.contact.interfaces.IContactServiceRemote");
    IContactServiceRemoteHome home = (IContactServiceRemoteHome) javax.rmi.PortableRemoteObject
    .narrow(homeRef, IContactServiceRemoteHome.class);
    IContactServiceRemote ejb = home.create();
    Please let me know how we can pass Initial context parameter from Business service or proxy service to legacy system.
    Thanks

    Hi Russ
    Yes, I've done this too. Basic SQL though will not allow the updating of a table inside a function, so we have to get clever. The trick is to use the PRAGMA AUTONOMOUS TRANSACTION command. Here's an example:
    FUNCTION UPDATE_MYTABLE(P_VALUE IN NUMBER)
    RETURN VARCHAR2 IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    UPDATE SCHEMA_OWNER.MY_TABLE SET MY_VALUE = P_VALUE;
    COMMIT;
    RETURN('Done');
    END UPDATE_TABLE;
    When the update has been completed the Discoverer worksheet will respond with 'Done'.
    Everyone: don't forget to grant EXECUTE on this function to all of the necessary users, including the EUL owner, and also don't forget to import the function using the Admin edition so that it is available for the users. You will also need to make sure that all necessary users have been granted the UPDATE privilege on the table.
    I hope this helps
    Regards
    Michael

  • Help: applet call ejb in oracle8i

    Hello:
    Can someone tell me how to call ejb in oracle8i from applet?
    thanks a lot!
    tom
    null

    Hi mark tomlinson:
    It does not work(IE and Netscape). Did you run the example
    ejbclubmed?
    tom
    mark tomlinson (guest) wrote:
    : Here is an example snippet:
    : Assuming that the EJB MyEJB has been deployed and the generated
    : server stubs (MyEJB_generated.jar) is referenced to resolve the
    : Home and Bean objects, then:
    : MyEJB myejb_obj;
    : String user = "scott";
    : String password = "tiger"
    : String URL = "sess_iiop://<my8iserver>:2481:ORCL:/test/MyEJB";
    : // Creates the Hashtable to hold the environment variables.
    : Hashtable environment = new Hashtable();
    : // Tells JNDI to speak sess_iiop
    : environment.put(javax.naming.Context.URL_PKG_PREFIXES,
    : "oracle.aurora.jndi");
    : // Tells sess_iiop the userid, password, and credential
    : authentication.environment.put
    (Context.SECURITY_PRINCIPAL,user);
    : environment.put(Context.SECURITY_CREDENTIALS, password);
    : environment.put(Context.SECURITY_AUTHENTICATION,
    : ServiceCtx.NON_SSL_LOGIN);
    : // Creates the initial context.
    : Context ic = new InitialContext(environment);
    : // Gets an implementation of the EJB's home interface from the
    : // inital context.
    : MyEJBHome home = (RentalsEJBHome) ic.lookup(URL);
    : // Tells the home interface to create an instance of the bean
    : myejb_obj = home.create();
    : From there you invoke moethods exposed on the bean object as
    you
    : would any other java object...
    null

  • Error during JNDI lookup Accessing Remote EJB (access to web service restricted using declarative security model)

    Hello everyone,
    I developed a Web Service prototype accessing remote EJB using the EJB
    control with special syntax in the jndi-name attribute: @jws:ejb
    home-jndi-name="t3://10.10.245.70:7131/AccountDelegatorEJB"
    Everything works fine, but I get an error when I restrict access to my web
    service with a declarative security model by implementing steps provided in
    help doc:
    - Define the web resource you wish to protect
    - Define which security role is required to access the web resource
    - Define which users are granted the required security role
    - Configure WebLogic Server security for my web service(Compatibility
    Security/Users)
    I launch the service by entering the address in a web browser. When prompted
    to accept the digital certificate, click Yes, when prompted for network
    authentication information, enter username and password, navigate to the
    Test Form tab of Test View, invoke the method by clicking the button and I
    get the following exception:
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Error during JNDI lookup from
    jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed for
    name:t3://10.10.245.70:7131/AccountDelegatorEJB]</faultstring>
    <detail>
    <jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
    lookup from jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed
    for name:t3://10.10.245.70:7131/AccountDelegatorEJB] at
    weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
    8) at
    weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
    .java:220) at
    weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
    ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
    ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64) </jwErrorDetail>
    </detail>
    </error>
    I have a simple Hello method as well in my WebService (which is also
    restricted) and it works fine, but remote EJB access doesn't. I tested my
    prototype on Weblogic 7.2 and 8.1 platforms - same result.
    Is that a bug or I am missing some additional configuration in order to get
    that working. Has anyone seen similar behavior? Is there a known resolution?
    Or a suggested way to work around the problem?
    Thank you.
    Andre

    Andre,
    It would be best if this issue is handled as an Eval Support case. Please
    BEA Customer Support at http://support.beasys.com along with the required
    files, and request that an Eval support case be created for this issue.
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "Andre Shergin" <[email protected]> wrote in message
    news:[email protected]...
    Anurag,
    I removed "t3", still get an error but a different one (Unable to create
    InitialContext:null):
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Error during JNDI lookup from
    jndi://secuser1:[email protected]:7131/AccountDelegatorEJB[Unable to
    create InitialContext:null]</faultstring>
    <detail>
    <jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
    lookup from
    jndi://secuser1:[email protected]:7131/AccountDelegatorEJB[Unable to
    create InitialContext:null] at
    weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
    8) at
    weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
    .java:220) at
    weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
    ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
    ibas.GetVisaHistoryTransactions.getVisaHistoryTxn(GetVisaHistoryTransactions
    .jws:67) </jwErrorDetail>
    </detail>
    </error>
    Note: inter-domain communication is configured properly. The Web Service to
    remote EJB works fine without a declarative security.
    Any other ideas?
    Thank you for your help.
    Andre
    "Anurag" <[email protected]> wrote in message
    news:[email protected]...
    Andre,
    It seems you are using the URL
    jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB
    whereas you should not be specifying the "t3:" protocol.
    The URL should be like
    jndi://secuser1:[email protected]:7131/AccountDelegatorEJB
    Please do let me know if you see any issues with this.
    Note that this will only allow you to access remote EJBs in the same WLS
    domain. For accessing EJBs on another domain, you need to configure
    inter-domain communication by
    following a few simple steps as mentioned at
    http://e-docs.bea.com/wls/docs81/ConsoleHelp/jta.html#1106135. This link has
    been provided in the EJB Control Workshop documentation.
    Regards,
    Anurag
    "Andre Shergin" <[email protected]> wrote in message
    news:[email protected]...
    Raj,
    I tried that before, it didn't help. I got similar error message:
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Error during JNDI lookup from
    jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB[Lookup
    failed for
    name:t3://secuser1:[email protected]:7131/AccountDelegatorEJB]</faultstr
    ing>
    <detail>
    <jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
    lookup from
    jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB[Lookup
    failed for
    name:t3://secuser1:[email protected]:7131/AccountDelegatorEJB] at
    weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
    8) at
    weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
    .java:220) at
    weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
    ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
    ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64) </jwErrorDetail>
    </detail>
    </error>
    Anything else should I try?
    P.S. AccountDelegatorEJB, the remote EJB my Web Service calls is NOTaccess
    restricted.
    I hope there is a solution.
    Thanks,
    Andre
    "Raj Alagumalai" <[email protected]> wrote in message
    news:[email protected]...
    Andre,
    Can you try using the following url with username and password
    jndi://username:password@host:7001/my.resource.jndi.object ?
    once you add webapp level security, the authenticated is the user who
    invokes the EJB.
    http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/ejb/con
    CreatingANewEJBControl.html?skipReload=true
    has more info on using remote EJB's.
    Hope this helps.
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "Alla Resnik" <[email protected]> wrote in message
    news:[email protected]...
    Hello everyone,
    I developed a Web Service prototype accessing remote EJB using the EJB
    control with special syntax in the jndi-name attribute: @jws:ejb
    home-jndi-name="t3://10.10.245.70:7131/AccountDelegatorEJB"
    Everything works fine, but I get an error when I restrict access to my
    web
    service with a declarative security model by implementing steps
    provided
    in
    help doc:
    - Define the web resource you wish to protect
    - Define which security role is required to access the web resource
    - Define which users are granted the required security role
    - Configure WebLogic Server security for my web service(Compatibility
    Security/Users)
    I launch the service by entering the address in a web browser. Whenprompted
    to accept the digital certificate, click Yes, when prompted for
    network
    authentication information, enter username and password, navigate tothe
    Test Form tab of Test View, invoke the method by clicking the buttonand
    I
    get the following exception:
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Error during JNDI lookup from
    jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed for
    name:t3://10.10.245.70:7131/AccountDelegatorEJB]</faultstring>
    <detail>
    <jwErrorDetail> weblogic.jws.control.ControlException: Error during
    JNDI
    lookup from jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookupfailed
    for name:t3://10.10.245.70:7131/AccountDelegatorEJB] at
    weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
    8) at
    weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
    .java:220) at
    weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260)at
    ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
    ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64)</jwErrorDetail>
    </detail>
    </error>
    I have a simple Hello method as well in my WebService (which is also
    restricted) and it works fine, but remote EJB access doesn't. I testedmy
    prototype on Weblogic 7.2 and 8.1 platforms - same result.
    Is that a bug or I am missing some additional configuration in order
    to
    get
    that working. Has anyone seen similar behavior? Is there a knownresolution?
    Or a suggested way to work around the problem?
    Thank you.
    Andre

  • Calling EJB from from a client app

    Hi all,
    I am trying to call an EJB component from portal. The example EJB I have taken is from SDN Bonus Calculator example - Application Server/Web Dynpro/Samples and Tutorials/Using EJBs (20)
    I deployed the EAR file - no issue
    I wrote the following code in a client app and trying to connect to the EJB remotely.
              try {
                   java.util.Properties properties = new Properties();
                   properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
                   properties.put(Context.PROVIDER_URL, "ux0800:55304");
                   InitialContext ctx = new InitialContext(properties);
                   //InitialContext ctx = new InitialContext();
                   // get ejb home
                   home =
                        (BonusCalculatorLocalHome) ctx.lookup(
                             "localejbs/MySessionBean");
                   theCalculator = home.create();
              } catch (Exception namingException) {
                   namingException.printStackTrace();
    I get the following error
    javax.naming.NoInitialContextException: Cannot instantiate class: com.sap.engine.services.jndi.InitialContextFactoryImpl [Root exception is java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl]
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at com.sap.bonus.calculation.sessionBean.MyCommandBean.<init>(MyCommandBean.java:27)
         at com.sap.bonus.calculation.sessionBean.MyCommandBean.main(MyCommandBean.java:68)
    Caused by: java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
    Any clue will be appreciated.
    thnx

    Hi Sabbir,
    Following code works for me in calling EJB from normal java application. Did you added the jar files to your application?. see the required jar files in end of code.
    Create simple java applcation do the following steps:
    Give JNDI name to the EJB(HelloJNDI)->Add the HelloEJB to HelloEAR ->deploy
    Proxy Program to call ejb:
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import com.sample.Hello;
    import com.sample.HelloHome;
    public class HelloTest {
         public static void main(String[] args) {
                       Hello remote = null;
                      try {
                        Context ctx = new InitialContext();
                        HelloHome home = (HelloHome) ctx.lookup("HelloJNDI");
                        remote = home.create();
                        String result = remote.hello();
                        System.out.print("Result:" + result);
                         } catch (Exception e) {
                                System.out.println("Exception:" + e.getLocalizedMessage());
    1. Go To  Run > Java Application ->New->select your project and select your main class(java program from which your going to call EJB)
    2. Click  next tab ->(x)=Arguments
    paste the following code in VM Arguments
    -Djava.naming.factory.initial=com.sap.engine.services.jndi.InitialContextFactoryImpl -Djava.naming.provider.url=localhost:50104
    replace the server IP address with your server IP address where your ejbs are running.
    Under Class path settings for the program put the following jar files.
    You can search for them from net weaver soruce folders
    or copy from D:\usr\sap\J2E\JC01\j2ee\j2eeclient
    ejb20.jar
    logging.jar
    exception.jar
    sapj2eeclient.jar
    Add Corresponding ejb.jar
    and RUN >>>
    this makes testing of your client programs easier, you can find the error trace on which line and saves lot of time.
    Regards, Suresh

  • Calling EJB from applet

    Hi friends,
    I have a problem of caling EJB from applet.that too from browser.
    Through dos prompt,I am able to set the classpath and then open the applet and then call the EJB.but thru browser i am encontering two problems,
    First,The codebase of applet is not being set and i am unable to view the applet.
    Second,my Initial Context Factory is not being found it is giving error as
    Cannot instantiate class: com.evermind.server.rmi.RMIInitialContextFactory.I am using oracle app server Oc4j2.
    can any one help me out.
    i am able to get output thru dos prompt where i can set classpath

    kyren,
    he has used something called HTML ConvertersDepends on the version of the plug-in you are using.
    (I'm sorry, but I couldn't find that detail in any of your posts!)
    You have to use the (HTML) converter with java version 1.3 (for example), but you don't have to with java version 1.4.
    thru my jbuilder version i am able to solve my
    problem.
    but thru browser,i am first of all not able to
    display applet.That's because "JBuilder" uses the appletviewer to display the applet (and not a browser).
    I Think for normal displaying applet we don't need of
    signed or unsigned applet.when calling ejb we may
    require.As Anupama has stated, the "codebase" attribute of the applet tag must be relative to the directory where the HTML file (containing the "applet" tag) is located. Where I work, we also use the "archive" attribute that tells the applet where to download the JAR files from. In order to lookup your ejb from your applet, you need (at least) the "oc4jclient.jar" file.
    By the way, if you want your name to appear next to your posts (instead of your ID number), you need to update your profile. Click on the "Forum Settings" link at the top of the (Web) page.
    Good Luck,
    Avi.

  • Stateless Session Bean has no Context when called from WAR

    Hello,
    Here is the code for my stateless session bean (it will carry out certain actions based on the timer service)
    package DigestTest;
    import java.io.BufferedWriter;
    import java.io.FileWriter;
    import java.util.Date;
    import javax.ejb.*;
    import javax.ejb.TimedObject;
    import javax.ejb.Timer;
    * This is the bean class for the MasterTimerBean enterprise bean.
    * Created Sep 7, 2006 9:05:09 AM
    * @author ttaylor
    public class MasterTimerBean implements SessionBean, MasterTimerRemoteBusiness, MasterTimerLocalBusiness, TimedObject
    private SessionContext context;
    public void setSessionContext(SessionContext aContext)
    context = aContext;
    * @see javax.ejb.SessionBean#ejbActivate()
    public void ejbActivate()
    * @see javax.ejb.SessionBean#ejbPassivate()
    public void ejbPassivate()
    * @see javax.ejb.SessionBean#ejbRemove()
    public void ejbRemove()
    // </editor-fold>
    * See section 7.10.3 of the EJB 2.0 specification
    * See section 7.11.3 of the EJB 2.1 specification
    public void ejbCreate()
    // TODO implement ejbCreate if necessary, acquire resources
    // This method has access to the JNDI context so resource aquisition
    // spanning all methods can be performed here such as home interfaces
    // and data sources.
    public void ejbTimeout(Timer timer)
    try
    BufferedWriter writer = new BufferedWriter(new FileWriter("C:\\timerTest.txt"));
    writer.write("Timer has tripped");
    writer.newLine();
    writer.flush();
    writer.close();
    catch(Exception e)
    return;
    // Add business logic below. (Right-click in editor and choose
    // "EJB Methods > Add Business Method" or "Web Service > Add Operation")
    public String initializeTimer()
    String result = "\n\nInitializing Timer\n";
    try
    // Create Your Timer
    if(context!=null)
    TimerService ts = context.getTimerService();
    result = result+"Instantiating Timer Object\n";
    Timer timer = ts.createTimer(new Date(), 5000, "TestTimer");
    result = result+"About to grab TimerHandle";
    TimerHandle timerHandle = timer.getHandle();
    else
    result = result+"\nContext Object is null\n";
    catch (Exception e)
    result = result+"\nError:\n"+e.toString();
    return result;
    public String writerTest()
    String result = "about to write";
    try
    result = result+"\nOpening the file";
    BufferedWriter writer = new BufferedWriter(new FileWriter("C:\\timerTest.txt"));
    result = result+"\nWriter Test Passed";
    writer.write("Writer Works");
    writer.newLine();
    result = result+"\nFlushing writer";
    writer.flush();
    result = result+"\nClosing writer";
    writer.close();
    catch (Exception e)
    result = result+"\n"+e.toString();
    return result;
    I am calling initializeTimer() from a jsp page with a simple <jsp:useBean tag>.
    The program keeps returning that the context variable is not set(this is from the context!=null conditional in initializeTimer()). I am very confused, I thought that setContext(...) was called by the container upon instantiation (and thus should happen completely without any action from me).
    How am I able to call a session bean that has not had the context set?
    Any information is appreciated,
    Thanks,
    Scott

    thank you for your reply, rajeevm007.
    it seems that the question is really a problem now.
    i think i should update weblogic to the lastest version and confirm this question. if it still in there, it seems that we have to reset the global variables all manually. so, now, we are discussing that should we modify all the ejbs, or wait the next version of weblogic. :) of cause the second choice is a joke.
    no other good choice?
    maybe in the march of the next year....
    cheers
    thank you again.

  • Call ejb from browsers

    Hello Developers!
    I deployed my ejb to OAS4081. I call that
    from JDeveloper so it good. But when I try
    to call from applet in IExpl5 I can't
    instantiate the ORB. I've got a com.ms.security.SecurityException : oracle.oas.orb.CORBA.ORB.init
    I coded the CLASSPATH(oasoorb(yoj),client,
    ejbapi...) perfectly, I think.
    If anybody could help, please...
    Thanx!

    Hi there,
              I saw someone on this group had a problem to locate proper classpath
              to call EJB from JSP. I thought if you call EJB from classpath, you are
              calling the bean. But you loss all the EJB functions. To be able to utilize
              EJB features like object pooling. You need to call it from Weblogic server
              using url/jndi, not from the jar directly.
              Any comment? Am I right?
              BTW, my question about calling EJB from JSP means calling through URL,
              not a local path.
              Thank you
              >-------------------------------------------------------------------->
              Jim wrote in message <[email protected]>...
              >Hi there,
              > Can I call EJB from JSP? Is there a particular security setting or
              >concern for Weblogic? Is there an coding example?
              >
              >Thank you
              >
              >
              

  • Calling EJB from an applet in 9iAS Release 2?

    Hello!
    In 9iAS Release 1 it is not so easy to call an EJB from an applet. First the applet needs special privileges and then the applet starts only once. The cause of problem is the implementation of ormi.
    Will 9iAS Rel. 2 support Applets calling EJBs?

    Jeff,
    I am also trying to make an applet client for an EJB deployed to OC4J.
    I modified the java2.policy file as you suggested, but when I tried to run my applet, I
    got the following error:
    java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.util.PropertyPermission tunneling.shortcut read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at java.lang.Boolean.getBoolean(Unknown Source)
         at com.evermind.server.rmi.RMIInitialContextFactory.<clinit>(RMIInitialContextFactory.java:34)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at its.fnd.ejb.EJBHomeFinder.getHomeObject(Unknown Source)
         at its.fnd.flight.ejb.EJBFlightFactory.<init>(Unknown Source)
         at its.fnd.flight.FlightFactory.<init>(FlightFactory.java:97)
         at EJBApplet.jbInit(EJBApplet.java:47)
         at EJBApplet.init(EJBApplet.java:36)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    I am using OC4J (stand-alone) version 9.0.2.0.0 on Solaris 7 and Microsoft Internet Explorer
    5.0 with the java 1.3.1 plug-in.
    Here is the applet code that I use to lookup the EJB home interface:
    Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
    props.put(Context.PROVIDER_URL,"ormi://host:6666/app");
    props.put(Context.SECURITY_PRINCIPAL,"admin");
    props.put(Context.SECURITY_CREDENTIALS,"password");
    Context ctxt = new InitialContext(props);
    Object homeObj = ctxt.lookup("my_bean");
    MyBeanHome home = PortableRemoteObject.narrow(homeObj, MyBeanHome.class);
    The HTML page with the <applet> tag is a static HTML page that is part of OC4J's default
    web application. The applet class file is located in a subdirectory of the default-web-app
    directory. Here is the HTML page...
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <TITLE>
    HTML Test Page
    </TITLE>
    </HEAD>
    <BODY>
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="580" height="450" name="EJBApplet" align="middle" alt="Loading EJBApplet ...">
    <param name="java_code" value="EJBApplet">
    <param name="java_codebase" value="/tests">
    <param name="java_archive" value="xerces.jar,ejb.jar,oc4j.jar,jaas.jar"/>
    <param name="java_type" value="application/x-java-applet;version=1.3">
    <param name="java_scriptable" value="true">
    <table cellpadding="1" bgcolor="#FFFFFF" width="580" height="450">
    <tr><td>
    This is a place for an APPLET.<br>Your browser doesn't support the correct applet java plug-in.<br><br>You can install the correct plug-in from here.<br><a target='_blank' onClick='javascript:self.window.close()' href="/classes/3rdparty/j2re-win-plug-in.exe">Click here to install plug-in.</a><br><br>Or if you have an Internet connection you can install the correct plug-in from here.<br><a target='_blank' onClick='javascript:self.window.close()' href="http://java.sun.com/products/plugin/1.3/plugin-install.html">Click here to install plug-in from Internet.</a><br><br>You can call your System Administrator for assistance.</td></tr>
    </table>
    </object>
    </BODY>
    </HTML>
    I have searched the Internet, and the documentation, and tried several, different things,
    but I can't get it to work.
    Any and all help will be greatly appreciated.
    Thanks,
    Sofia.

Maybe you are looking for

  • How to change the 'Default operating mode' of a mapping on the repository and not from the client

    Hi everybody, I am using OWB 11.2.0.3 and under the mapping's configuration property, I have the necessity to change the Run time parameter "Default operating mode" to SET_BASED in almost all my mappings. Because I have 745 mappings in which the Defa

  • My mac wakes from sleep on its own?

    Hi all, for some reason my mac wakes from sleep overnight, not quite sure at which time it does this but I have found the computer awake and up and running in the morning for a few days now? any ideas why it would wake itself up? cheers, Robert G4 MD

  • Looking for Acrobat 9 Pro

    Where can I find an Acrobat 9 Pro download? I have a CS4 cd and serial number but my new machine does not have a cd drive.

  • Graphical errors when using Catalyst

    I have trouble with using the proprietary driver for my AMD RADEON HD 6970 gpu. After following instructions on the wiki, everything runs reasonably well, except: - Inside my DE, the wallpaper seems to be missing in various occasions. For example, it

  • Multiple devices -how to sync all to icloud and iphoto then delete from device

    Hello, I have 2 ipads, an iphone and a macbook.  I want to be able to take pictures using whichever device and have all the pictures be stored in my iphoto on my macbook.  I have purchased plenty of icloud storage but want to make sure that all devic