EJB Java Client to Corba C++ object

Does BEA have any examples of calling from an EJB java client to a CORBA C++ object
(please no Tuxedo examples, thank you)?
I've tried the c++ -> EJB examples, however now I need the other way around.
thanks,
Sean

Andy Piper <[email protected]> wrote:
"Sean Cloutier" <[email protected]> writes:
Does BEA have any examples of calling from an EJB java client to aCORBA C++ object
(please no Tuxedo examples, thank you)? Not that I am aware of. This is just a standard CORBA client scenario.
andy
-- Cool, thanks Andy!

Similar Messages

  • Setting timeout property in java client using corba

    Hi all,
    We are facing a problem regarding corba timeout. We have a java based client (jdk 1.5), which connects to a cpp server using corba. Now we want to set a timeout at client side if some call takes a long to come back (due to TCP/IP connection problem or any other reason). We are using borland's visibroker and implemented their 'RelativeRequestTimeoutPolicy' policy but it gives an exception like this : org.omg.CORBA.PolicyError: There is no PolicyFactory Registered for type 31
    I have searched this forum for the same but could not find any particular solution or may be I was unable to find that. Can anyone please help regarding this issue? Is there any SUN specified property that can be used? What is the use of 'com.sun.CORBA.transport.ORBTCPReadTimeouts'? Can anyone help?.

    Hi ,
    I am getting the same exception org.omg.CORBA.PolicyError: There is no PolicyFactory Registered for type 31
    at com.sun.corba.se.internal.Interceptors.PIORB.create_policy
    Below is source code :
    long relative_expiry = 30L * 10000000L; // 30 seconds
    Any relative_request_timeout_value = orb.create_any();
    TimeTHelper.insert(relative_request_timeout_value,relative_expiry);
    Policy policies = orb.create_policy(org.omg.Messaging.RELATIVE_REQ_TIMEOUT_POLICY_TYPE.value,relative_request_timeout_value);
    PolicyManager orbManager = PolicyManagerHelper.narrow(
    orb.resolve_initial_references("ORBPolicyManager"));
    orbManager.set_policy_overrides(new Policy[] {policies},SetOverrideType.SET_OVERRIDE);
    Please let me know how the problem was resolved

  • Problem calling a EJB Java Client from Java Activity Agent

    Hi,
    We have a wrapper java class that calls to an EJB through a JNDI lookup. The wrapper class is called from a workflow. The problem is that the call fail with the following message error:
    Error : getRemoteHome Lugar: ServiceLocator NamingException Mensaje Error: Receive timed out
    Mon Jan 09 15:32:13 EST 2006 Enqueuing VIC/97513 com.tallion.tax.workflow.assessment.Update
    F_FN_ERROR (MODULE=com.tallion.tax.workflow.assessment.Update) (ITEMTYPE=VIC) (ITEMKEY=97513) (ACTID=10617) (FUNCMODE=RUN) (ERRMESSAGE=getRemoteHome Lugar: ServiceLocator NamingException Mensaje Erro
    The wrapper class has in their classpath a jndi.properties as follows:
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=69.0.137.120:1099
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    The call just works fine when we restart the Java Activity Agent and then, after a while it fails again with the same error.
    Any ideas/workaround?
    Thanks.

    I have a situation that is a bit similar. I have successfully used beans for storing methods used in JSPs and used by other methods in the same class as was suggested above. Now I would like to break some methods into another (utility) class since they are lower level and can be used by lots of things. They are for database operations (given a String query and String dbname, it queries and returns ResultSet for example). I want to have them in a separate class for reusability and OOP.
    I am having problems calling those public static methods in the public class from my bean that communicates with the JSP. I can't compile the class that calls the method in the database ops class. I get an error like :
    loginHelper.java:45: cannot find symbol
    symbol : variable sqlHelper
    location: class dbHelperBean.loginHelper
    and when I include the package name in the call I get
    loginHelper.java:45: cannot find symbol
    symbol : class sqlHelper
    location: package dbHelperBean
    That's strange since the package of both classes is dbHelperBean and the class is indeed called sqlHelper. I tried to compile it in the same directory as sqlHelper as well. What am I doing wrong?
    Thanks for any help.

  • How to bind the java client stub and the C++ server's skeleton?

    hi, i'm currently working on a project which a java client invoke a C++ object.
    i've wrote the idl and compile it using idl2cpp and a object is created.
    then i try to compile my java client using vbjc Client. it was done without errors.
    but when i try to run the client (after i run the smart agent and the C++ server) using vbj Client, it promts error which fail to load the class Client.java
    and i've try to run my java client using jre (java Client), the program throws exception --> org.omg.CORBA.BAD_PARAM: minor code: 0 completed: No
    so, wat's wrong with my codes actually??
    it's urgent and i really need you all's help...
    thanks a lot...

    below is my code:
    TimeObject.cpp (C++ server)
    #include "TimeImpl.h"
    // USE_STD_NS is a define setup by VisiBroker to use the std namespace
    USE_STD_NS
    int main(int argc, char* const* argv)
    try {
    // Initialize the ORB.
    CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv);
    /* // Initialize the BOA
    CORBA::BOA_ptr boa = orb->BOA_init(argc, argv);
    // Create the Time object
    POA_Time::TimeSetting timesetting = new TimeSettingImpl("My TimeSetting");
    // Export the newly created object
    boa->obj_is_ready(timesetting);
    // Ready to service requests
    boa->impl_is_ready(); */
    // get a reference to the root POA
    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
    PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(obj);
    CORBA::PolicyList policies;
    policies.length(1);
    policies[(CORBA::ULong)0] = rootPOA->create_lifespan_policy(
    PortableServer::PERSISTENT);
    // get the POA Manager
    PortableServer::POAManager_var poa_manager = rootPOA->the_POAManager();
    // Create myPOA with the right policies
    PortableServer::POA_var myPOA = rootPOA->create_POA("sntp_poa",
    poa_manager,
    policies);
    // Create the servant
    TimeSettingImpl timeServant;
    // Decide on the ID for the servant
    PortableServer::ObjectId_var managerId =
    PortableServer::string_to_ObjectId("TimeManager");
    // Activate the servant with the ID on myPOA
    myPOA->activate_object_with_id(managerId, &timeServant);
    // Activate the POA Manager
    poa_manager->activate();
    CORBA::Object_var reference = myPOA->servant_to_reference(&timeServant);
    cout << reference << " is ready" << endl;
    // Wait for incoming requests
    orb->run();
    catch(const CORBA::Exception& e) {
    cerr << e << endl;
    return 1;
    return 0;
    Client.java:
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class Client
         public static void main(String args[]) throws IOException, InterruptedException
              try
                   // Initialize the ORB
                   System.out.println("Initializing the ORB");
                   org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
                   // Get the manager Id
                   byte[] managerId = "TimeManager".getBytes();
                   System.out.println("get the manager id");
                   // Locate an account manager. Give the full POA name and the servant ID.
                   Time.TimeSetting time =
                   Time.TimeSettingHelper.bind(orb, "/sntp_poa", managerId);
                   System.out.println("bind the object");
                   // Bind to the TimeSetting Object
                   //System.out.println("Binding to TimeSetting Object");
                   //Time.TimeSetting time = Time.TimeSettingHelper.bind(orb, "My TimeSetting");
                   SntpClient client = new SntpClient();
                   long Offset = client.synchronizeTime();
                   // Set offset
                   System.out.println("Setting offset to" + Offset);
                   time.offset((long)Offset);
                   // Set the system time
                   System.out.println("Setting system time");
                   time.SetTime();
              } catch (org.omg.CORBA.SystemException e)
                   System.out.println("System Exception");
                   System.err.println(e);

  • Finding an EJB object. Web clients vs. Java clients

    From what I've read this is the process for a web client to find an EJB object: the client uses JDNI to find a reference to the EJBHome interface and then it uses the create method from this interface which makes the container to begin to work, creating an instance of the implementation class and an instance of the EJBObject interface, and returning a reference to the EJBObject, which will be used by the client to call the methods.
    Are there any differences if the client is a java application and not a web client?

    The Java Client talk to the server with random ports
    not 80. Gives me a headache. _*why?
    There's no need to get headaches about it, in fact no need to worry about it at all.
    Just have the JNDI services available so you can do the lookup (which might require opening a port (or more than one) on the firewall, but that's it.
    And that's no different between a standalone client and a web application client. Both need to do that JNDI lookup.

  • Problem running Java client of EJB deployed on WebSphere

    Hi,
    I am using websphere studio 5.1.2 with fix pack 3. I have a sample Stateless Session Bean (EJB) deployed and running on websphere.
    I wrote a small Java client program as below.
    import java.util.Hashtable;
    import HelloJavaHome;
    import HelloJava;
    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.ejb.EJBHome;
    import javax.ejb.EJBObject;
    public class RemoteConn {
    public static void main(String[] ar) throws Exception{
    String greeting = "";
    try{
    Hashtable env = new Hashtable();
    //env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
    //env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ws.naming.util.WsnInitCtxFactory");
    //env.put(Context.PROVIDER_URL, "corbaloc:iiop:myhost.mycompany.com:2809/NameServiceCellPersistentRoot");
    env.put(Context.PROVIDER_URL, "iiop://localhost:2809");
    System.out.println("Before creating context ");
    InitialContext initContext = new InitialContext(env);
    System.out.println("Before looking up HelloJavaHome.");
    //Object obj = initContext.lookup("java:comp/env/ejb/HelloJavaHome");
    Object obj = initContext.lookup("ejb/HelloJavaHome");
    System.out.println("After lookup javahome.");
    HelloJavaHome home = (HelloJavaHome) javax.rmi.PortableRemoteObject.narrow(obj, HelloJavaHome.class);
    HelloJava remote = home.create();
    greeting = remote.getGreeting("John");
    catch(Exception e){
    e.printStackTrace();
    System.out.println("Greeting::"+ greeting);
    I did not have any problem if I write and run this client from Websphere studio environment..
    However its giving lot of compilation and runtime errors when I tried to run from command line.
    I could eliminated compilation errors by setting the below jar files in the classpath.
    testclient.jar; (client jar of my EJB)
    j2ee.jar;
    naming.jar;ras.jar;
    wsexception.jar;
    bootstrap.jar;
    namingclient.jar;
    websphere.jar;server.jar;
    ejbcontainer.jar;
    ecutils.jar;
    Now it is throwing runtime error after the statement, "Before looking up HelloJavaHome.", has printed. Here is the stack trace of exception ..
    Exception in thread "main" java.lang.NoClassDefFoundError: com.ibm.CORBA.iiop.GlobalORBFactory
    at com.ibm.ejs.oa.EJSORBImpl.class$(EJSORBImpl.java:44)
    at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:195)
    at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:93)
    at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:65)
    at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:385)
    at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:284)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:369)
    at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:112)
    at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:422)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:143)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at RemoteEJBConn.main(RemoteEJBConn.java:38)
    I appreciate if sombody could help me ASAP fixing this problem.
    Thanks in advance.

    Try using the IBM JVM (theres one shipped with WebSphere in websphere_home\AppServer\java
    Also include idl.jar and ffdc.jar on the classpath

  • How a stand-alone java client to access EJB?

    I have problems to access a ejb.
    ====================================
    client code:
    Properties prop = new Properties();
    prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
              prop.setProperty (Context.PROVIDER_URL,"IIOP://127.0.0.1:1050");
              System.err.println("Attempting to create context...");
              Context init = new InitialContext( prop );
              Object obj = init.lookup("hi_bean");
              hihome home =(hihome)PortableRemoteObject.narrow(obj, hihome.class);
              hi c= home.create();
              System.out.println(c.greeting());
    ====================================================
    in Dos. I have the following command:
    java -Dorg.com.CORBA.ORBInitialHost=127.0.0.1 hiclient
    I already open the EJB application on J2EE server on port 80, but run hiclient
    in dos, it has ClassCastException coming from the code :
    hihome home =(hihome)PortableRemoteObject.narrow(obj, hihome.class);
    dose anyone have any ideas about this?
    Thanks

    Check the JNDI name specified in the xml file.
    Hope this will help
    Ashish Mangla

  • Error while running EJB from java client on JBOSS

    Hi
    As i am new to EJB i have created a helloworld application in ejb which is working fine when i try to call it from servlet but when i try to invoke the same ejb from java client (i.e from diff jvm) on jboss i got the following error:
    javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
         at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1399)
         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.gl.TestClient.main(TestClient.java:39)
    Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)
         at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)
         ... 4 more
    Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:228)
         ... 5 more
    Caused by: java.net.ConnectException: Connection refused
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:519)
         at java.net.Socket.connect(Socket.java:469)
         at java.net.Socket.<init>(Socket.java:366)
         at java.net.Socket.<init>(Socket.java:266)
         at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)
         at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
         ... 5 more
    Following is my code:
    Home Interface:
    package com.gl;
    import javax.ejb.CreateException;
    public interface testHome extends EJBHome {
         String JNDI_NAME = "testBean";
         public     test create()
         throws java.rmi.RemoteException,CreateException;
    Remote Interface:
    package com.gl;
    import java.rmi.RemoteException;
    import javax.ejb.EJBObject;
    public interface test extends EJBObject {
         public String welcomeMessage() throws RemoteException;
    Bean:
    package com.gl;
    import java.rmi.RemoteException;
    import javax.ejb.EJBException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    public class testbean implements SessionBean {
         public void ejbActivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbPassivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbRemove() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void setSessionContext(SessionContext arg0) throws EJBException,
                   RemoteException {
              // TODO Auto-generated method stub
         public void ejbCreate(){}
         public String welcomeMessage(){
              return "Welcome to the World of EJB";
    ejb-jar.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <session>
    <ejb-name>testBean</ejb-name>
    <home>com.gl.testHome</home>
    <remote>com.gl.test</remote>
    <ejb-class>com.gl.testbean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    jboss.xml:
    <?xml version='1.0' ?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
    <jboss>
    <enterprise-beans>
    <entity>
    <ejb-name>testBean</ejb-name>
    <jndi-name>testBean</jndi-name>
    </entity>
    </enterprise-beans>
    </jboss>
    Client code:
    package com.gl;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    public class TestClient {
         public static void main(String[] args) throws Exception{
                   try{
                   /*     Properties props=new Properties();
                        props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                        props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
                        props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
                   Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.jnp.interfaces.NamingContextFactory");
    props.put(Context.PROVIDER_URL, "localhost:1099");
                        System.out.println("Properties ok");
                        //env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
                        //env.put(Context.PROVIDER_URL,"http://localhost:8080");
                        //env.put(Context.SECURITY_PRINCIPAL, "");
                        //env.put(Context.SECURITY_CREDENTIALS, "");
                        Context ctx=new InitialContext(props);
                        System.out.println("context ok");
                        //testHome home = (testHome)ctx.lookup("testBean");
                        Object obj = ctx.lookup ("testBean");
                        System.out.println("ojb = " + obj);
                        testHome ejbHome = (testHome)PortableRemoteObject.narrow(obj,testHome.class);
                   test ejbObject = ejbHome.create();
                   String message = ejbObject.welcomeMessage();
                        System.out.println("home ok");
                        System.out.println("remote ok");
                        System.out.println(message);
                        catch(Exception e){e.printStackTrace();}
    I am able to successfully deployed my ejb on JBOSS but i m getting above error when i am trying to invoke ejb from java client.
    kindly suggest me something to solve this issue.
    Regards
    Gagan
    Edited by: Gagan2914 on Aug 26, 2008 3:28 AM

    Is it a remote lookup? Then maybe this will help:
    [http://wiki.jboss.org/wiki/JBoss42FAQ]
    - Roy

  • 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.

  • Creating a simple java client for a session EJB local interface

    Hi all
    Is it possible to create a simple java client for a session ejb local interface with JDeveloper.
    The problem is that it creates a test client for a remote interface only...
    i.e.
    MySessionEJB sessionEJB = context.lookup("MySessionEJB")
    and once i try to adjust it manually for the local interface...
    MySessionEJBLocal sessionEJB = (MySessionEJBLocal) context.lookup("MySessionEJBLocal") (MySessionEJBLocal - is the name of my local interface)
    it generates the exception:
    javax.naming.NotFoundException: SessionEJBLocal not found
    at...........................(RMIClientContext.java:52)
    There is still no problem with accessing the local interface object from the jsf project where i've added <ejb-local-ref> tag into the web.xml file.
    but i need the possibility of testing the simple java client for the local interface to test business methods wich should return objects without indirect properties
    Thanks in advance.
    Alex.

    Pedja thanks for reply.
    I still dont understand what is wrong with my example.
    The first peace of the code i wrote (getting the reference to the remote interface object) works pretty well, and even more it is produced automatically by JDeveloper, so why we cant get a reference to the local interface object the same way?
    Certanly we should use the local interface for getting access to the resource functioning under the same local jvm and i think it doesnt metter wich app server we really use wls or oas or others
    Thanks. Alex.

  • Java.rmi.RemoteException: CORBA TRANSIENT 0x49421071 - WPS portlet - EJB Jonas

    Hello,
    I'd like to use EJB session working in Jonas 4.3.4 (jdk 1.4) with a portlet in WPS 5.0 (jdk 1.3) throught iiop protol.
    I succeed to initialized the context, then to lookup the jndiName of the EJB but when I try to instanciate (eJBhome.create()) the EJB the following exception occur :
    java.rmi.RemoteException: CORBA TRANSIENT 0x49421071 No; nested exception is:
    org.omg.CORBA.TRANSIENT: GETCONNECTIONKEY_RETURNED_FALSE minor code: 1229066353 completed: No
    Does someone know the meaning of that corba exception ?
    Does someone already succeed to do such communication ?
    Do you know an other protocol that can help me ?
    Here is my code in the WPS portlet:
         Properties env = new Properties();
         env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
         env.put("java.naming.provider.url","iiop://XX.XXX.X.XX:YYYY");
         javax.naming.InitialContext initContext = new javax.naming.InitialContext(env);
         String JNDIName = "BestPracticeServiceHome";
              Object obj = initContext.lookup(JNDIName);
              BestPracticeServiceHome myHome = (BestPracticeServiceHome)PortableRemoteObject.narrow(obj,BestPracticeServiceHome.class);
         //Here occur the exception :
              BestPracticeService myService = myHome.create();
    Note: if I use the WPS 5.0 test environment in RAD 6 everything works.
    Thanks in advance,
    Best Regards,
    J�r�me

    Sorry, I forgot to say, the original SunONE 7 works fine
    without this error.

  • How do I call an ejb from a java client?

    I put ejb classes in a jar file along with java client code and deployed it on my OC4J server. Now I am trying to run the ejb by calling the client code on my OC4J server from the command line but I am not having success. Am I doing this the right way? Should I also deploy my client code? Should the client code also be in a directory on my OC4J server?
    Mike

    Hi. Here is a part of the code for a java client. In this particular case it is also an EJB but it is a Message Driven Bean.
    public class MDBEjbMecomsIFSBean implements MessageDrivenBean,
    MessageListener {
    // context
    private MessageDrivenContext m_ctx = null;
    // properties filename
    private String m_propFile = DEF_PROPFILE;
    // application
    private String m_app;
    // callable function from properties
    // private String m_dsJndiName;
    // private String m_dsType;
    // private String m_dsFunc;
    private int m_connRetryMax;
    private int m_connRetryWait;
    // initial stylesheet transformation file
    private String m_xsltFile;
    // web service operation name
    private String m_operationName;
    // trap emitter members from properties
    private String m_trapMbeanURL;
    private String m_trapObjectName;
    private String m_trapAction;
    private String m_trapAppName;
    private Severity m_trapMax = Severity.CRITICAL;
    private int m_trapAfterDelivery;
    private boolean m_trapStart;
    // jmx members for auto shutdown from properties
    private String m_mdbMbeanURL;
    private String m_mdbMbeanAccount;
    private String m_mdbMbeanPassword;
    private String m_mdbObjectName;
    private String m_mdbAutoShutdown;
    // clob allocator to be used by Oracle jdbc call
    // private CLOB m_clob;
    * Remember the context for this MDB.
    * @param ctx the context for this MDB
    public void setMessageDrivenContext(MessageDrivenContext ctx) {
    logger.log(Level.FINEST, "Setting MessageDrivenContext");
    m_ctx = ctx;
    * ejbCreate() is called when the server wants to create a new instance of this MDB.
    * At this time a connection with the target is established and the callable statement
    public void ejbCreate() {
    readProperties();
    // Connection errors are IGNORED, because it seems that raising Exceptions from here
    // does NOT result in a container managed rollback. Instead the dequeue is commited,
    // resulting in AQ message status 2 (success).
    // By ignoring the fault, another Exception will occurr in onMessage(), from where
    // a propagated exception DOES result in a rollback.
    String logStr = "Started TenneT-MDB-" + m_app;
    logger.log(Level.FINEST, prefixLog(logStr));
    if (m_trapStart)
    notify(Severity.NORMAL, logStr);
    * This method is called whenever a message is sent to the queue associated with this MDB.
    * @param msg assumed to be a javax.jms.TextMessage containting an xml string
    public void onMessage(Message msg) {
    * msg id, timestamp and length are logged at info level
    * msg content is logged at debug level
    String msgText = "uninitialized";
    String msgId = "undefined";
    int msgDeliveryCount = 0;
    // this block retrieves msg info from the jms header
    // errors are logged as info and ignored
    try {
    // get msgid first so any subsequent error can be associated with the msg
    msgId = msg.getJMSMessageID();
    logger.log(Level.FINE, prefixLog("MessageID: " + msgId));
    logger.log(Level.FINE,
    prefixLog("Enq_time : " + msg.getJMSTimestamp()));
    // delivery count can be used to send a critical trap only on the last retry
    if (msg.propertyExists(JMS_X_RCV_TIMESTAMP)) {
    logger.log(Level.FINE,
    prefixLog("Deq_time : " + msg.getIntProperty(JMS_X_RCV_TIMESTAMP)));
    // delivery count can be used to send a critical trap only on the last retry
    if (msg.propertyExists(JMS_X_DELIVERY_COUNT)) {
    msgDeliveryCount = msg.getIntProperty(JMS_X_DELIVERY_COUNT);
    logger.log(Level.FINE,
    prefixLog("DeliveryCnt: " + msgDeliveryCount));
    } catch (Exception e) {
    String errStr =
    "Minor exception in JMSConsumeMDBBean.onMessage() receiving msg \"" +
    msgId + "\": " + e.getMessage();
    logger.log(Level.SEVERE, prefixLog(errStr));
    // next the message content is addressed
    try {
    TextMessage message = (TextMessage)msg;
    msgText = message.getText();
    logger.log(Level.FINE,
    prefixLog("MessageLength: " + msgText.length()));
    logger.log(Level.FINEST, prefixLog("Msg: " + msgText));
    } catch (Exception e) {
    String errStr =
    "Error in JMSConsumeMDBBean.onMessage() retrieving msg \"" +
    msgId + "\": " + e.getMessage();
    logger.log(Level.SEVERE, prefixLog(errStr));
    notify(Severity.CRITICAL, errStr);
    throw new EJBException(errStr);
    // From now we can do intial stylesheet transformation if necessary
    try {
    // Prepare input
    XMLDocument xslInput;
    XMLDocument xmlInput;
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    // Parse XSL
    parser.parse((MDBEjbMecomsIFSBean.class.getResourceAsStream(m_xsltFile)));
    xslInput = parser.getDocument();
    // Parse XML
    parser.parse((Reader)new StringReader(msgText));
    xmlInput = parser.getDocument();
    // Instantiate XSL Processor
    XSLProcessor processor = new XSLProcessor();
    XSLStylesheet stylesheet;
    stylesheet = processor.newXSLStylesheet(xslInput);
    XMLDocumentFragment xmlOutput =
    (XMLDocumentFragment)processor.processXSL(stylesheet,
    xmlInput);
    // Now prepare xml for use with entity bean
    Document xmlDoc = new XMLDocument();
    xmlDoc.appendChild(xmlOutput);
    *// Invoke Entity Bean to perform lookup of destination Web Service*
    Context ctx;
    ctx = new InitialContext();
    EBEjbMecomsIFSLocalHome ebOppIfsLH =
    *(EBEjbMecomsIFSLocalHome)ctx.lookup("java:comp/env/ejb/local/EBEjbopp_ifs");*
    EBEjbMecomsIFSLocal ebOppIfs;
    ebOppIfs = ebOppIfsLH.create();
    *// pass message content to entity bean*
    ebOppIfs.setXMLmessage((Element)xmlDoc.getDocumentElement());
    *// provide correct soap action*
    ebOppIfs.setOperationName(m_operationName);;
    *// do actual work*
    ebOppIfs.doWork();
    } catch (XSLException e) {
    logger.log(Level.INFO,
    prefixLog("XSL Exception during onMessage " +
    e.getMessage()));
    } catch (SAXException e) {
    logger.log(Level.INFO,
    prefixLog("SAX Exception during onMessage " +
    e.getMessage()));
    } catch (CreateException e) {
    logger.log(Level.INFO,
    prefixLog("Create Exception during onMessage " +
    e.getMessage()));
    } catch (NamingException e) {
    logger.log(Level.INFO,
    prefixLog("Naming Exception during onMessage " +
    e.getMessage()));
    } catch (IOException e) {
    logger.log(Level.INFO,
    prefixLog("IO Exception during onMessage " + e.getMessage()));
    private void notify(Severity severity, String message) {
    logger.log(Level.FINEST,
    prefixLog("Started method notify() with severity level " +
    severity));
    try {
    if (m_trapMbeanURL == null || m_trapMbeanURL.equals("")) {
    logger.log(Level.WARNING,
    prefixLog("No MBean URL! Skipping SNMP trap."));
    } else {
    logger.log(Level.INFO,
    prefixLog("Setting up JMX connection with " +
    m_trapMbeanURL));
    ObjectName delegateName = null;
    MBeanServerConnection mbsc = null;
    try {
    JMXServiceURL jmxServiceURL =
    new JMXServiceURL(m_trapMbeanURL);
    JMXConnector connector =
    JMXConnectorFactory.connect(jmxServiceURL);
    mbsc = connector.getMBeanServerConnection();
    delegateName = new ObjectName(m_trapObjectName);
    logger.log(Level.FINEST,
    prefixLog("JMX connection established with " +
    m_trapMbeanURL));
    } catch (Exception ex) {
    logger.log(Level.SEVERE,
    prefixLog("Error while initializing JMX Server connection"),
    ex);
    throw new EJBException("Error while initializing JMX Server connection",
    ex);
    String localHost = null;
    try {
    InetAddress addr = InetAddress.getLocalHost();
    localHost = addr.getCanonicalHostName();
    logger.log(Level.FINEST,
    prefixLog("Localhost=" + localHost));
    } catch (UnknownHostException ex) {
    logger.log(Level.SEVERE, prefixLog(ex.getMessage()), ex);
    throw new EJBException(ex.getMessage(), ex);
    // invoke the trapemitter
    try {
    if (mbsc != null) {
    if (severity.ordinal() > m_trapMax.ordinal()) {
    severity = m_trapMax;
    String severityArg = severityMap.get(severity);
    Object[] arguments =
    { severityArg, message, m_trapAppName, localHost };
    String[] signature =
    { "java.lang.String", "java.lang.String",
    "java.lang.String", "java.lang.String" };
    mbsc.invoke(delegateName, m_trapAction, arguments,
    signature);
    logger.log(Level.INFO,
    prefixLog("TrapEmitter invoked: severity=" +
    severityArg + " - message=" +
    message));
    } else {
    logger.log(Level.SEVERE,
    prefixLog("Error: No MBean server connection established with " +
    m_trapMbeanURL));
    } catch (MBeanException e) {
    logger.log(Level.SEVERE,
    prefixLog("Error occured in invoked method"),
    e);
    } catch (ReflectionException e) {
    logger.log(Level.SEVERE, prefixLog(e.getMessage()),
    e.getCause());
    } catch (IOException e) {
    logger.log(Level.SEVERE,
    prefixLog("A communication problem occurred when talking to the MBean server"),
    e);
    } catch (InstanceNotFoundException e) {
    logger.log(Level.SEVERE,
    prefixLog("The MBean specified is not registered in the MBean server."),
    e);
    } catch (Exception e) {
    logger.log(Level.SEVERE,
    prefixLog("Error in method notify. Handling resumes..."));
    } finally {
    if (severity.equals(Severity.CRITICAL)) {
    stopConsuming();
    private void stopConsuming() {
    logger.log(Level.FINEST, prefixLog("Started method stopConsuming()"));
    if ("true".equals(m_mdbAutoShutdown)) {
    if (m_mdbMbeanURL == null || m_mdbMbeanURL == "") {
    logger.log(Level.WARNING,
    prefixLog("No MDB MBean URL! Skipping stopConsuming()."));
    } else {
    JMXConnector jmxCon = null;
    try {
    Hashtable<String, String> credentials =
    new Hashtable<String, String>();
    credentials.put("login", m_mdbMbeanAccount);
    credentials.put("password", m_mdbMbeanPassword);
    // Properties required to use the OC4J ORMI protocol
    Hashtable env = new Hashtable();
    env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
    "oracle.oc4j.admin.jmx.remote");
    env.put(JMXConnector.CREDENTIALS, credentials);
    JMXServiceURL serviceUrl =
    new JMXServiceURL(m_mdbMbeanURL);
    jmxCon =
    JMXConnectorFactory.newJMXConnector(serviceUrl, env);
    jmxCon.connect();
    MBeanServerConnection mbs =
    jmxCon.getMBeanServerConnection();
    logger.log(Level.FINEST,
    prefixLog("JMX connection established with " +
    m_mdbMbeanURL));
    ObjectName objectName = new ObjectName(m_mdbObjectName);
    MessageDrivenBeanMBeanProxy MDBMBean =
    (MessageDrivenBeanMBeanProxy)MBeanServerInvocationHandler.newProxyInstance(mbs,
    objectName,
    MessageDrivenBeanMBeanProxy.class,
    false);
    MDBMBean.stop();
    logger.log(Level.WARNING,
    prefixLog("Message consumption suspended"));
    } catch (Exception ex) {
    logger.log(Level.SEVERE,
    prefixLog("Error while initializing JMX Server connection"),
    ex);
    throw new EJBException("Error while initializing JMX Server connection",
    ex);
    } else {
    logger.log(Level.WARNING,
    prefixLog("No AutoShutdown. property=false"));
    * Called when the server no longer wants to keep this MDB instance.
    * Closes the connection and statement objects created in <code>ejbCreate</code>.
    public void ejbRemove() {
    try {
    cleanup();
    } catch (Throwable t) {
    logger.log(Level.SEVERE,
    prefixLog("Error in ejbRemove(): " + t.getMessage()));
    /* Cleanup resources cleanly */
    private void cleanup() {
    logger.log(Level.INFO, prefixLog("TenneTMDB.cleanup() called."));
    // m_dsService = null;
    // m_dsCall = null;
    private String prefixLog(String logText) {
    String logPrefix = "%" + m_app + ": ";
    //System.out.println(logPrefix + logText);
    return logPrefix + logText;
    private void logCause(Throwable e, LogLevel logLevel) {
    int i = 0;
    String causeStr;
    Throwable exception = e.getCause();
    while (exception != null) {
    i++;
    causeStr = "Cause " + i + ": " + exception.getMessage();
    switch (logLevel) {
    case INFO:
    logger.log(Level.INFO, prefixLog(causeStr));
    break;
    case WARN:
    logger.log(Level.WARNING, prefixLog(causeStr));
    break;
    case ERROR:
    logger.log(Level.SEVERE, prefixLog(causeStr));
    exception = exception.getCause();
    }

  • Creating multiple stateful session beans from a java client. (EJB 3.0)

    I'm having difficulties with the following:
    To access the ShoppingCartBean, I have to put the following annotation in my standalone java client:
    @EJB
    private static ShoppingCartRemote shoppingCartBean;
    The static must be there, thus only one ShoppingCartBean will exist within my java client. But as the ShoppingCartBean is a stateful session bean, I want to be able to get different beans of the same type.
    What is the correct way to do this in EJB 3.0?

    Great question. Because Home interfaces have been removed for the EJB 3.0 simplified
    API, stateful session bean creation happens as a side-effect of injection. However, the
    same is true of EJB 3.0 business interface lookups. The easiest way to create additional
    stateful session beans is to lookup the same dependency that was declared via your
    @EJB annotation.
    E.g.,
    // Assuming the declaring class is pkg1.ShoppingCartClient.java
    InitialContext ic = new InitialContext();
    ShoppingCartRemote scr1 = (ShoppingCartRemote)
    ic.lookup("java:comp/env/pkg1.ShoppingCartClient/shoppingCartBean");
    Note that the name relative to java:comp/env is the default associated with your
    @EJB annotation since the name() attribute wasn't used. Alternatively, you
    could have used :
    @EJB(name="scb") private static ShoppingCartRemote shoppingCartBean;
    InitialContext ic = new InitialContext();
    ShoppingCartRemote scr1 = (ShoppingCartRemote) ic.lookup("java:comp/env/scb");
    Yet another alternative is to declare the @EJB at the class-level. This just defines
    the dependency without any injection, which is fine if you want to create a bunch of
    them via lookup anyway.
    @EJB(name="scb", beanInterface=ShoppingCartRemote.class)
    public class .... {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to invoke A CORBA-Java Client Application, from Oracle???

    Hi,
    I have a CORBA-Java Client Application, which takes the input parameters from a Oracle table and calls the CORBA Server, passes these parameters to the C++ Server Application and gets the results back thorugh CORBA.
    My problem is, this java application needs to be invoked, when ever there is a new record in the Oracle table.
    I am not sure if i can use Java Stored Procedures in Oracle in this case, because my app is in Sun JVM and i am using BEA WebLogic Enterprise 5.1 for the CORBA.
    Is there any other way by which i can invoke this app, when a new record is updated in the Oracle table?
    Currently, i have just put a TIMER in my java App, to check the oracle table in every few seconds, to see if there is a new reocrd. If it finds a new record it invokes the corresponding class(corba class), or else just keep sending a messsage that no new record is available.
    The problems i am facing in this method are as follows;
    1. Unnecessarily, the application has to keep on running if there is no request coming frequently.
    2. When there is a new record found, the Corba Class is called and the whole process (till it gets the result back from the server) takes about 20 - 30 secs. But within this period, if there is another record coming into Oracle table, my timer class doesnt invoke another corba class....(though i am using multithreading by using the RemidTask method in the timer.schedule.
    (timer.schedule(new RemindTask(),10,5*1000);)
    3. Also, if during the first call, there is some error, then the whole process exits, instead of another process running parallely (when a second new record is found).
    So how does this timer class act like a multithreading process?
    Well, i hope i am not confusing....Please let me know if anyone wants bit more elaboration on this.
    It would be really helpful if someone can suggest some answer to my problem.
    Thanks in advance.

    Thank you very much Keith.
    Though i am really getting a hope of solving this problem, from you answer, i am actually not 100% sure if i understood your reply properly.
    First of all, about
    1. "use the update stored procedure to place the updated record (or unique index) onto an Oracle Application Queue."
    -- Why do i need to put the record in the AQ. (Frankly speaking, at this moment i dont have much idea about AQ, probably i can learn more about it from oracle technet site? Or would u suggest anything else?)
    Then,
    2."Your app then waits on this queue and for each new message, consumes it, gets the data required from the AQ load (e.g the index and or record), and fires off the CORBA class"
    -- How does my application stay in the queue? and gets the data from the queue?
    Of course, as far as i understand, i am going through the same principle...keeping on running a timer class, which keeps on checking the table for a new record, and when it finds, it calls the CORBA class.
    Of course, i feel there should be a difference in running the timer continuosly and staying in queue. However i am totally unaware, how can i make my java app to wait in the queue and waits for a new record?
    Can you please elaborate your answer a bit more, because i dont know about the AQ, that you have mentioned.
    Thank you very much in advance for your time. But please know that it will be of great help to me and hence will be higly appreciated.
    Regards,
    Subhasree.

  • Java client ejb access

    Hi
    Am I correct in thinking that if I require a browser based Java
    client to access an EJB that I have to perform the following ....
    SETUP for the browsers
    1) You need to remove the iiop10.jar file from the
    ...Netscape/Communicator/Program/Java/Classes directory. Renaming
    this
    file is not enough - you must remove it.
    2) You need to copy $ORACLE_HOME/lib/aurora_client.jar
    $ORACLE_HOME/lib/vbjorb.jar and $ORACLE_HOME/lib/vbjapp.jar into
    the
    ...Netscape/Communicator/Program/Java/Classes directory.
    aurora_client.jar is 2.3MB! This effectively means ejb's are
    totally useless in the real world if you want to access them from
    a browser over the internet.
    Somebody please tell me there's an alternative or even better
    it's not true.
    Thanks
    ritchie
    null

    Check the JNDI name specified in the xml file.
    Hope this will help
    Ashish Mangla

Maybe you are looking for

  • Service Master language

    Hi, How to change the service master short text? for exmple italian to english Thanks, senthil S

  • Tried To Installed higher version of Flash, But Shows As previous Version

    Hello, I downloded the 10.2.159 version of Flash. I am usuing A Linux pc. I copied the libflashplayer.so files to /usr/lib/mozilla/plugins, however, I restarted my pc and when I go to about:plugins, the version still shows as 10.0. Also, when I go to

  • BEx Analyzer is Slow to Load

    Please can you tell me what happens when the BEx Analyzer loads for the first time? Excel seems to load quickly but the BEx Analyzer component can take over 30 seconds! Is there anything that can be done to improve the start up time of BEx Analyzer o

  • Deliver Related (Project delivery)  Billing

    Is it possible to do delivery related (project delivery) billing in PS. Our enterprise uses PS for the manufacturing and procurement process, but there is compelling business / statutory requirement to do delivery related billing. Currently we call t

  • Extract Assets plugin producing BAD color JPGs.

    I am using latest version of Photoshop CC 2014. If I use the Adobe Extract plugin to extract various assets from my PS master file, the resulting JPGs are significantly oversaturated. If I use "Save for Web" instead, embed profile checked and save to