EJB object factory

 

Declare the factory class as a startup class. In the main() method, create a new initial context and bind a new instance of the factory class into the jndi tree under an agreed on name. Youi client code should look for the factory calss under the agreed on name.
Hope that helps.
Narendra Pasuparthy wrote:
Hi Eduardo,
Thanks for looking into my problem, I have been trying to do this thing for
the last 2 weeks and you help comes as a new sign of life to me.
Anyway i understand the problem better now, but i am still far away from
having to solve it. you say something about adding the object factory to the
JNDI tree
What you can do is add your object factory to the jndi tree. Your >bean
could look it up, etc.How can i do this, i presume that when you say jndi tree you ae referring to
the JNDI tree provided by the weblogic server; right?
If you can shed more light on how i can add my object factory to the JNDI
tree and how i can look it up i would appreciate your help.
Looking forward to hearing form you soon.
Bye,
Naren
From: [email protected] (Eduardo Ceballos)
To: narendra <[email protected]>
Subject: Re: EJB object factory
Date: Mon, 21 Aug 2000 08:42:34 -0700
MIME-Version: 1.0
Received: from [63.96.160.4] by hotmail.com (3.2) with ESMTP id
MHotMailBB6A99B0002AD820F39D3F60A0049AF50; Mon Aug 21 08:45:56 2000
Received: from san-francisco.beasys.com (san-francisco.beasys.com
[192.168.9.10])by beamail.beasys.com (8.9.1b+Sun/8.9.1) with ESMTP id
IAA08176for <[email protected]>; Mon, 21 Aug 2000 08:45:54 -0700 (PDT)
Received: from ashbury.weblogic.com (ashbury.beasys.com [172.17.8.3])by
san-francisco.beasys.com (8.9.1b+Sun/8.9.1) with ESMTP id IAA13707for
<[email protected]>; Mon, 21 Aug 2000 08:46:05 -0700 (PDT)
Received: from weblogic.com ([192.168.11.197]) by ashbury.weblogic.com
(Post.Office MTA v3.5.3 release 223 ID# 0-53833U200L200S0V35)
with ESMTP id com for <[email protected]>; Mon, 21 Aug 2000
09:03:01 -0700
From [email protected] Mon Aug 21 08:47:42 2000
Message-ID: <[email protected]>
X-Mailer: Mozilla 4.73 [en] (WinNT; I)
X-Accept-Language: en
Newsgroups: weblogic.developer.interest.rmi-iiop
References: <[email protected]>
There is no provision for a generic object factory in the public api, and
none is supported.
What you can do is add your object factory to the jndi tree. Your bean
could look it up, etc. I would urge you to
make sure that there are appropriate acls on the factory, for obvious
security reasons.
narendra wrote:
My problem is that i want to invoke a service running on another APPserver form an EJB bean,
the other app server provides some client APIwhich i can use and invokethe service. Due to the
security restriction in EJB container i was not able to do this, theapproach i am thinking
about is establishing an object factory to create an object of theother app server client
class and use that from the bean.
the weblogic server seems to handle,"javax.sql.DataSource,""javax.jms.QueueConnectionFactory,"
"javax.jms.TopicConnectionFactory" or "java.net.URL" how can it supportgeneric object factories, since I
have a obect factory that does not construct any of the objects usingthe weblogic supported object
factory.
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

Similar Messages

  • EJB Home Factory question

    I have a doubt about implementing EJB Home Factory design pattern ( a form of Service Locator pattern)
    in an application running on Weblogic clustered environment. A colleague of mine told me that because this pattern is singleton based( which is true - no doubt about that), it will not be supported by the container
    beacause server instances are being run on different JVMs. I think what he says is wrong but want to be sure. Please tell me if it is OK to implement this pattern in this type of environment and if yes/no, why.
    Thanks
    Vlad

    Yes, you can implement it, but your colleague is correct: it won't work quite the way you think it will.
    A "Singleton" in the WLS server (we'll get to clusters in a minute) is only unique inside it's ClassLoader (not JVM). The way WLS works is that it allocates/creates ClassLoaders for each major type of deployment: EAR, EJB, and WAR. Fortunately, they are "nested" (in the order given), so if you have a SIngleton in the EAR ClassLoader, it will be the only instance of that class for the EJBs and WARs in that EAR. SImilarly, if you've deployed only a WAR, the Singleton will only be unique for that WAR, not the entire server.
    With clusters, WLS is not "aware" of the Singleton as it is not a distributed object. So the instance(s) will not propagate between the nodes. So if you've deployed an EAR with a Singleton, the number of Singletons in the system will be n, where n is the number of nodes. If you have the same Singleton class in two different EARs, then it's obvious that there will be 2*n instances of the Singleton.
    Now, given the pitfalls and caveats, yes, it is an effective pattern to reduce the number of JNDI lookups and caching of the HomeHandle implementations for EJBs.

  • Changing a method in an EJB object without recompiling EJB-Clients

    Hi!
    I have 4 Web (JSP) applications using the same EJBs., deployed to a BEA Weblogic application server.I want to know if there is a way to change the code in a method in one of my EJB objects (no interface change) without recompiling and redeploying my EJB-clients and Web apps.
    Regards,
    Per - Chr.

    Hello,
    I have 4 Web (JSP) applications using the same EJBs.,
    deployed to a BEA Weblogic application server.I want
    to know if there is a way to change the code in a
    method in one of my EJB objects (no interface change)
    without recompiling and redeploying my EJB-clients and
    Web apps.You can change the EJB's without recompiling the clients as long as the interfaces and the classes used by both the EJB's and clients are not changed.
    For example, if you don't change the interfaces but change the exception implementation thrown by a method of the bean, then you have to recompile the clients with the new version of the exception class.
    Kexkey

  • 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 in getting handle to EJB Object

    Hi All,
    I am getting following exception when i try to get handle on my ejb object.
    My Client Program:
    import synch.*;
    import javax.naming.*;
    import java.rmi.*;
    import javax.rmi.*;
    import javax.ejb.*;
    import java.io.*;
    public class SearlizeClient
         public static void main(String[] args) throws Exception
              Context ic = new InitialContext();
                   Object o = ic.lookup("NameBean"); // replace with YOUR JNDI name for the bean
                   NameHome nameHome = (NameHome) PortableRemoteObject.narrow(o, NameHome.class);
                   synch.Name obj1 = nameHome.create();
                   obj1.setName("Balaji");
                   Handle myHandle= obj1.getHandle();// Getting exception at this place
                   FileOutputStream out = new FileOutputStream("MyHandle.txt");
                   ObjectOutputStream s = new ObjectOutputStream(out);
                   s.writeObject(obj1);
                   s.flush();
                   out.close();
    I got following excetion when i try to get handle on EJBObject
    Dec 6, 2005 11:20:19 AM com.sun.corba.se.impl.encoding.CDRInputStream_1_0 read_value
    WARNING: "IOP00810257: (MARSHAL) Could not find class"
    org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
    at com.sun.corba.se.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemExcep
    tion.java:7756)
    at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1013
    at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:879)
    at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_
    1_0.java:873)
    at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_
    1_0.java:863)
    at com.sun.corba.se.impl.encoding.CDRInputStream.read_abstract_interface(CDRInputStream.java
    :269)
    at synch._Name_Stub.getHandle(Unknown Source)
    at SearlizeClient.main(SearlizeClient.java:20)
    Caused by: java.lang.ClassNotFoundException
    ... 7 more
    Exception in thread "main" java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested excepti
    on is:
    org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
    at com.sun.corba.se.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:197)
    at javax.rmi.CORBA.Util.mapSystemException(Util.java:67)
    at synch._Name_Stub.getHandle(Unknown Source)
    at SearlizeClient.main(SearlizeClient.java:20)
    Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
    at com.sun.corba.se.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemExcep
    tion.java:7756)
    at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1013
    at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:879)
    at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_
    1_0.java:873)
    at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_
    1_0.java:863)
    at com.sun.corba.se.impl.encoding.CDRInputStream.read_abstract_interface(CDRInputStream.java
    :269)
    at synch._Name_Stub.getHandle(Unknown Source)
    ... 1 more
    Caused by: java.lang.ClassNotFoundException
    ... 7 more
    Enviroment: This bean is hosted on Sun J2ee Appserver 8.0 and normal client prg is working fine .. But it is failing in getting handle
    Please suggest,
    Thanks in advance

    The only way is to create your own equivalent of HttpSessionContext.
    Its simple enough, just create a class that implements HttpSessionListener (responds to session creation, and destruction)
    You can get the sessions as they are created, and keep a global reference to them, and manipulate it as much as you like. In your case you would probably want to index the sessions by userId rather than sessionId for easy access.
    Good luck,
    evnafets

  • Transaction & non-EJB objects (helper)

    hi i have a question about transactional behavior of non-EJB objects. i'm
              using
              weblogic 6.0 sp1 with ejb 2.0.
              say i have a session bean which starts a container managed transaction. and
              it calls
              out to helper class A(non-EJB), and that helper class A get a connection and
              update
              some tables. after A returns, session bean calls helper class B(non-EJB) in
              the
              same transaction. B is supposed to update some other tables but it throw an
              user
              exception. would the transaction in the session bean be rolled back? would
              it
              also roll back the changes made by helper class A?
              thanks for any help,
              z
              

    Thanks Rob!
              "Rob Woollen" <[email protected]> wrote in message
              news:[email protected]...
              > Ziqiang Xu wrote:
              >
              > > hi i have a question about transactional behavior of non-EJB objects.
              i'm
              > > using
              > > weblogic 6.0 sp1 with ejb 2.0.
              > >
              > > say i have a session bean which starts a container managed transaction.
              and
              > > it calls
              > > out to helper class A(non-EJB), and that helper class A get a connection
              and
              > > update
              > > some tables.
              >
              > You must get the JDBC connection from a TxDataSource.
              >
              > > after A returns, session bean calls helper class B(non-EJB) in
              > > the
              > > same transaction. B is supposed to update some other tables but it
              throw an
              > > user
              > > exception. would the transaction in the session bean be rolled back?
              >
              > Merely throwing an exception from a helper class will not rollback the
              > transaction.
              >
              > Within an EJB, the best way to rollback a tx is to use the
              > EJBContext.setRollbackOnly method.
              >
              > So you could do something like this:
              >
              > session_bean_method() {
              >
              > try {
              > B.foo();
              > } catch (MyException e) {
              > ctx.setRollbackOnly();
              > throw e;
              > }
              >
              > }
              >
              > > would
              > > it
              > > also roll back the changes made by helper class A?
              > >
              >
              > If they are all within a single transaction, then yes. As I mentioned
              before,
              > make sure that you use a TxDataSource for all of your JDBC Connections.
              >
              > -- Rob
              >
              > >
              > > thanks for any help,
              > >
              > > z
              >
              

  • List of EJB object published in database

    how is it possible to list of EJB object published in database ?
    I'm using Oracle 8.1.7.
    Thanks

    Enterprise Manager --> DBA Pack --> Connect to JServer

  • One EJB object accessed by two clients.

    One client access a EJB object another client access the same EJB
    object, when the first client releases the ejb object, then second
    client loses data or gets null.
    Any body knows what is happening?
    Thanks

    hey,
    is this with StatefulSession Bean. I too am experiencing the same problem. When two users are trying to access the same bean the same time, one is returing null. This being a UserSession Bean, one user is getting the session object as null..
    Can anyone answer this problem....
    cheers,
    prasad.

  • Help me! About look up EJB object.

    I have deployed the ejb object on local PE 9(Sun Java System Application Server Platform Edition 9).
    When I use the following code to have a test, I will get a correct result.
    The classpath include (appserv-rt.jar) ect.
    public static void main(String[] args) {
         try{
              Properties props = System.getProperties();
              Context ctx = new InitialContext(props);
              Hello h = (Hello) ctx.lookup("java:comp/env/ejb/test/Hello");
              Hello h = (Hello) ctx.lookup("ejb/test/Hello");
              System.out.println(h.sayHello());
         }catch(Exception e){
              e.printStackTrace();
    The first question is that the real host ever is the localhost, whether I set the any host (props.put(Context.PROVIDER_URL,"iiop://192.46.57.78:3700");).
    Why?
    When I use the following code to have a test, I will get a incorrect result.
    public static void main(String[] args) {
         try{
              Properties props = System.getProperties();
              props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
              props.put(Context.PROVIDER_URL,"iiop://localhost:3700");
              Context ctx = new InitialContext(props);
              Hello h = (Hello) ctx.lookup("java:comp/env/ejb/test/Hello");
              Hello h = (Hello) ctx.lookup("ejb/test/Hello");
              System.out.println(h.sayHello());
         }catch(Exception e){
              e.printStackTrace();
    The exception is :
    javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
         at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)
         at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
         at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
         at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at tests.HelloTest.main(HelloTest.java:30)
    Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
         at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
         at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
         ... 4 more
    Why?
    Please help me!
    Thanks!

    Sorry!
    Above:
    Hello h = (Hello) ctx.lookup("java:comp/env/ejb/test/Hello");
    The above (Hello h = (Hello) ctx.lookup("java:comp/env/ejb/test/Hello");) have deleted in right code.

  • EJB Object

    What is EJB Object. What are the Uses.

    An EJBObject is the client side object that represents the Remote view of an session or entity bean. The client can use this object to invoke business methods on the ejb. EJB is a component model, so it makes a clear distinction between the cilent-side view of an object and the objects that are managed by the container. Clients do not hold direct references to the bean instances. This allows the container to interpose on all invocations and to better manage the life cycle of the bean instances.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Storing/Recalling of EJB Objects

    Hi
    I have a servlet that accepts a XMLDocument in the doPost method.In this XML I have the following nodes:
    EJBName, EJBMethod, Parameter1,...
    The Servlet has already done the JNDI lookup and creation of my EJB's (quite a lot of them).
    I would now like to store the EJB object in some sort of array and extract the correct one depending upon the values received in the XML Doc.
    Example...
    WizIsisIMEIHome wizIsisIMEIHome = (WizIsisIMEIHome)ctx.lookup("WizIsisIMEI");
    wizIsisIMEI = wizIsisIMEIHome.create();
    I would now like to put this object into the array with a reference name: ie IsisEJB.
    If I now receives the following data in the XMLDoc, I would like to do the following:
    Lookup EJB object by reference (IsisEJB).
    Build up the following statement:
    EJBName .EJBMethod(param1, ...);
    XMLDocument outXMLDoc = wizIsisIMEI.getLastIMEIXML( msisdn, imei, retMessage, retCode );
    I can do this with a CASE/SWITCH but this will be cumbersome/ugly with 90 EJB's!
    Any ideas/samples will be appreciated
    Tks
    Andre

    I would now like to put this object into the array
    with a reference name: ie IsisEJB.Use a HashMap, with the EJB name as the key. When handling an incoming request, acquire the Remote (or Local) interface from the Map using the specified EJBName from your request.
    Then use the Reflection API to acquire a Method object representing the remote method you want to call and invoke it.
    .P.

  • [SOLVED] Eagerly Fetch sequence-value in EJB-object

    I've defined my EJB-object PERSON to use the DB-sequence PERSONS_SEQ, but the Sequence is only called when the data is persisted using the persistEntity-method.
    Could somebody point me out how I can eagerly fetch the PERSON.personId attribute when the create()-method is called on the PersonsIterator?

    I wasn't able to set it declaratively on the EJB bean and I'm not sure if it's possible because I couldn't find any info on the API-doc's.
    I've created my own custom method to create a new object instead of using the pre-configured methods 'create, execute, setCurrentRowWithKey', which are available through using ADF.
    Using my own create-method I've added a custom method that gets the next sequence value using the createNativeQuery()-method which is available in the EntityManager. I've created a blog about the solution and the case I was working out.

  • Can't see EJB objects in Application Navigator after migration

    Hello
    I can't see any objects in Application Navigator after migration from previous version of JDeveloper (9.2.0.5), in System Navigator view I can see all sources. Has somebody any idea what the reason is?
    Tom

    In the application navigator you should see one node per EJB, when you stand on it you'll see the various source files in the structure window.

  • Converting EJB Object into XML

    All:
    Suppose I have an EJB that is named MyDog, it has attributes as follows:
    name
    breed
    weight
    age
    Is there a way to convert this Object into an XML document? Something like:
    <?xml version=\"1.0\" ?>
    <MyDog>
    <name>Bubba</name>
    <breed>Australian Shepherd</breed>
    <weight>65 lbs</weight>
    <age>6 years old</age>
    </MyDog>
    I can't find any information on doing this - any ideas, links, etc? There has to be a way to do this, but I can't find it. I'm welcome to any ideas out there!

    check JAXB - might be usefull for you: http://java.sun.com/xml/jaxb/index.html

  • [9.2 Cluster] Incompatible ejb objects (BEA-000124)

    Hello,
              I am trying to deploy my ear file in a 9.2 cluster with two managed servers.
              However, when the managed servers download the cluster JNDI tree I receive error BEA-000124 (The object ... in the JNDI tree is clusterable but is incompatible ...).
              I already tried to delete the EJB-Cache and the staged ear file but this did not help. I have no idea where this incompatible version could come from...
              Any help would be appreciated!
              Kai

    First off, I would make sure you have the application targeted at the cluster. That'll ensure the same application is deployed to every cluster member.
              Then, redeploying the app should be sufficient.
              -- Rob
              WLS Blog http://dev2dev.bea.com/blog/rwoollen/

Maybe you are looking for

  • Ao anexar arq. .pdf em e-mail aparece anexado cmd.exe com 250 kb

    Qualquer arquivo .pdf ao se anexar através da tela "Escrever e-mail", ao terminar o carregamento aparece como cmd.exe com 250kb. Outros tipos de arquivos são aceitos normalmente. Os plug-ins da Adobe estão atualizados e o SO é Win 7. Já foi scaneado

  • Break the SELECT statement.

    Hi, My requirement is to break the Select statement and get the fields in where clause in one internal table. For eg: Select VBELN                       POSNR                       MATNR  from VBAP into wa_vbap where VBELN = '0000000001'             

  • My ipad screen turned green and pink

    my ipad screen turd green and pink help me plssssss. i restart my ipad2 it dosen't work

  • Java.lang.UnsatisfiedLinkError: no ocijdbc8 in shared library path

    Hello i am getting this unsatisfied error whenever i use servlet & in my servlet i am using JDBC for connecting to Oracle. i need to know the solution for this please do let me know . Also do i need to know the JDBC re-alm set-up in Tomcat server. ja

  • Portion of my library is blank and iphoto is very slow

    Someone was working in my library. I came back and I see blank frames in my library (in the area she was working) and iPhoto is operating very slowly. I did not lose the pictures; they are under the frame and I can call them out to the edit box; but