Returning local references from an EJB

Hi,
Is it possible to return a local object reference (of bean X) from the business method of another entity bean(Y)?
Thanks in advance,
Albert.

Hey Nikola,
Thanks for the reply.
That is what looked so obvious to me too. My EJB is only using the local interfaces. Actually, here i am trying to use bean managed relationships. The EJB just doesn't seem to be getting deployed. Whenever i change all the references type of the specific local object to "Object" class, deployment goes thru successfully. My problem is compounded by the fact that oracle doesn't even give out any sensible error message. So i was wondering whether returning of the reference is allowed.
Thanks,
Albert.

Similar Messages

  • Returning VI reference from control object reference

    Dear All
    I was wondering if there is anything that acts like inverse of "To more specific class" ? I mean it returns the VI reference from a reference to one of its control object? I think it is like moving upward in the hierarchy!!
    Is there any way to implement that?
    Best ragards
    Afshin
    Solved!
    Go to Solution.

    The property OWNER allows you to climb up the tree.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Local references and EJBs in separate jars

    Hi
    I have trouble in getting local references when the EJBs are built in separate jar files. I am using the <ejb-link> in the <local-ejb-ref>. But I could not get reference to the EJB's local reference.
    Please let me know if there is any documentation that tells about getting local references and having the EJBs in separate jar files.
    Thanks

    Greetings,
    Hi
    I have trouble in getting local references when the
    EJBs are built in separate jar files. I am using theThere are a number of reasons why this may be happening and without more specific information it is difficult to say which you are encountering... In any case, the fact that your beans are in separate jars is not, by itself, the issue. It is worth noting, however, that Local references may only be used when both components (referencer and referencee) are co-located within the same VM instance and perhaps this little fact may shed some light on your problem??
    <ejb-link> in the <local-ejb-ref>. But I could not get<ejb-link> should point to the actual JNDI binding name, sans root nomenclature (java:comp/env/), but with full sub-context (ejb/myapp/.../MyLocalBean), of the referenced bean.
    reference to the EJB's local reference.Perhaps it goes without saying (but just to be sure :)... of course, your referenced bean must actually have Local interfaces associated with it.
    Please let me know if there is any documentation
    that tells about getting local references and having
    the EJBs in separate jar files.Both the J2EE tutorial and the EJB 2.0 spec. have the relevant information. :) However, I've already listed the requirements above: supplied local interfaces, co-located components, and correct link reference.
    I hope this helps.
    ThanksRegards,
    Tony "Vee Schade" Cook

  • How can I get a reference to the Local interface of a EJB 3 session?

    Hi,
    How can I get a reference to the Local interface of a EJB 3 session?
    My session implements both the local and remote interfaces, so in my client, when I look up the remote interface using the following code, I did get a reference
              processor = (IItemProcessorRemote)initialContext.lookup(IItemProcessorRemote.class.getName());but if I also look up the local interface in th eclient using this:
    processorLocal =(IItemProcessor)initialContext.lookup(IItemProcessor.class.getName());I got errors like the following, do you know why? Thanks a lot!
    Exception in thread "main" javax.naming.NameNotFoundException: sessions.IItemProcessor not found
         at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:203)
         at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:175)
         at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
         at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:116)
         at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)

    BTW, findItemByTitle(String title) is a business method in my ItemProcessor session bean.
    public String findItemByTitle(String title) {
              AuctionItem item;
              String result = null;
              try {
                   Query query = entityManager
                             .createNativeQuery("SELECT i from AuctionItem i WHERE i.title LIKE : aTitle");
                   query.setParameter("aTitle", title);
                   item = (AuctionItem) query.getSingleResult();
                   result = item.toString();
              } catch (EntityNotFoundException notFound) {
              } catch (NonUniqueResultException nonUnique) {
              return result;
         }

  • EJB 3.0 local lookup from POJO in WLS Cluster

    Hello,
    I'm developing on JDeveloper Studio Edition Version 11.1.2.3.0 and deploying to a WebLogic 10.3.5 Cluster.
    I have developed an EJB 3.0 stateless session bean and I need to invoke it from a POJO within the same EAR, specifically an ADF EntityImpl Class.
    Up to this point, I've only invoked EJBs using injection via an @EJB annotation, and have never done a full lookup.
    Could somebody please provide a verbose instruction on how to obtain invoke an EJB 3.0 SLSB via local interface from a POJO when running on a WLS cluster?
    As I see it I have two problems to solve.
    1) Obtaining a reference to the initial context in a cluster.
    2) Using that to get a reference to the local interface of the bean, which I don't think is on the global JNDI tree.
    Many thanks.
    Edited by: user576183 on Dec 5, 2012 4:16 PM

    Re: Unable to lookup in InitialContext a Local EJB in Weblogic 10.3.5 (EJB 3.0)

  • Returning more than one value/object from an EJB method

    Hi,
    I have the follong method in the remote interface of my EJB:
    void createSomeObject( MyObject obj1, List returnList1, Map returnMap1);
    Since i want to return a List (returnList1) and a Map(returnMap1) from my EJB method "createSomeObjects", i am passing these as parameters thinking they will be passed by reference and the client(servlet) gets the changes the EJB made to these objects.
    But it doesn't seem to be working, the EJB is filling the List and Map objects and the servlet doesn't get it (pass by value problem).
    My understading is that, all parameters to an EJBs are passed by value(because they are remote calls, the RMI thing), let me know if this right.
    Is there any workaround apart from the following alternative?
    Alternatives:
    1. Wrap "List list1" and "Map map1" in another model and return this instead of passing them as parameters.
    Thanks
    Vasu

    My understading is that, all parameters to an EJBs
    are passed by value(because they are remote calls,
    the RMI thing), let me know if this right.Yes, that is correct - which you should know from your introduction to J2EE reading.
    Is there any workaround apart from the following
    alternative?
    Alternatives:
    1. Wrap "List list1" and "Map map1" in another model
    and return this instead of passing them as
    parameters.No.

  • Ejb-link is still required when using local references?

    Hi!
    In BEA's link (http://e-docs.bea.com/wls/docs81/ejb/DDreference-ejb-jar.html#1114738) there is the following comment for weblogic-ejb-jar.xml element 'jndi-name':
    "Assigning a JNDI name to a bean is not recommended. Global JNDI names generate heavy multicast traffic during clustered server startup. See Using EJB Links for the better practice."
    Since we're using local references (local-jndi-name) to access our ejbs instead of remote references, is this still recommendation still pertinent?
    Thanks
    Christianne

    It is enough if you add the ejb-ref & ejb-link in the session bean. The
    session will look up relative to java:comp/env
    The following doc shows an example of accessing an ejb from a web app using
    ejb-link.
    http://e-docs.bea.com/wls/docs81/webapp/components.html#146848
    --Sathish
    <Christianne Carvalho> wrote in message news:[email protected]..
    I'm not getting very well how the ejb-link is used. In my case I have
    entity beans that are referenced in session beans.
    In my entity beans I have the following XDoclet tag.
    * @ejb.bean
    * name="ProductDescription"
    * display-name="ProductDescription"
    * jndi-name="ejb/ProductDescription"
    * local-jndi-name="ejb/ProductDescriptionLocal"
    * view-type="local"
    * type="CMP"
    In my session bean I'm currently getting the reference for the entity bean
    using the following code:
    productDescriptionLocalHome=(ProductDescriptionLocalHome)
    lookupLocalHome(ProductDescriptionLocalHome.JNDI_NAME);
    If I add the following XDoclet tag to my session bean, in ejb-jar.xml a
    <ejb-link> is created inside <ejb-local_ref> tag.
    * @ejb.ejb-ref ejb-name="ProductDescription" view-type="local"
    Considering the info above:
    1) In the entity bean, is there any extra tag to define the ejb-link or is
    the ejb-link only defined in the session bean?
    2) Re session bean, only adding the @ejb-ref xdoclet tag is enough for
    using the ejb-link or do I also have to change my lookup? If I do, what do
    I have to search for in the lookup?
    Thanks!

  • Challenge: call local ejb from remote ejb on weblogic 9.2

    Hi ALL,
    How do I call to local ejb from remote ejb object. The jar file is deployed on weblogic server 9.2, if you want get it http://geocities.yahoo.com.br/lindembe/BEAProject.jar and the source code are http://geocities.yahoo.com.br/lindembe/BEAProject.zip. It is a sample app with two ejb that works so good on JBOSS, JOnAS, but BEA Weblogic.....
    The complete problem you watch http://forum.java.sun.com/thread.jspa?threadID=768718&messageID=4387570#4387570
    or
    http://forums.bea.com/bea/message.jspa?messageID=600043148&tstart=0

    Your code in SigemFacadeBean should just do:
    InitialContext ctx = new InitialContext();
    when you lookup the local EJB. (This will work on all app servers. There's no need to put an app-server specific intial context factory in your code.)
    Also, you can remove the jndi-name setting for the local ejb from your weblogic-ejb-jar.xml. jndi-name is only applied to remote ejbs.
    -- Rob
    WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • Return proxy instances from EJB

    Is weblogic able to return proxy instances from EJBs?
    <BR>
    I am using the session-facade pattern with DTO/Value-Object being passed between
    facade and client(s). To handle different "levels of loading", I want to have
    one DTO for an entity, but then restrict the available properties by wrapping
    in an interface using java.lang.reflect.Proxy.
    <BR>
    Should this work? It doesn't. For example (from my session bean):<P><PRE>
    return new MyDTO();
    </PRE>works fine; however, the stubs generated by weblogic.ejbc have trouble unmarshalling
    the return if I do:<P><PRE>
    return Proxy.newProxyInstance(
    MyInterface.class.getClassLoader(),
    new Class[] { MyClass.class },
    new MyPassThruHandler( new MyDTO() )
    </PRE> returning various errors.
    <BR>
    Is this valid to do from weblogic? If not, I am mystified as to how not.
    <BR>
    Thanks,<P>
    Steve
    <BR>
    P.S., I am using WL61sp3.

    Hi all,
    Finally, I solve the problem. That is my misstake, i had a interface declared as private variable in the my concreteClass (inhert from AbstractClass)... now i declare as transient, let the interface variable don't to be serialize.
    Now everything fine...:-) thanks for help anyway.
    But just wonder why it don't throw any exception ???
    Gordon

  • EJB library reference from Web Dynpro

    Hi,
    1. I have got a WD DC that references an EJB DC and an external library DC (ext_ims_lib_depl) on the same server
    2. I have specified the ejb20 DC under SAP-JEE_1 as a used DC on both the DCs for design time, deploy time and runtime.
    3. But after deploying the WD DC and trying to invoke the call to the EJB DC I get the exception below.
    4. It’ evident that the classloader cannot pick up the ejb20.jar and my question is how do I resolve the reference, I tried adding sap.com/ejb20 under Webdynpro references but it does not seem to do the trick.
    Exception----
    Processing HTTP request to servlet [dispatcher] finished with error. The error is: java.lang.NoClassDefFoundError: javax/ejb/EJBHome
    Loader Info -
    ClassLoader name: [library: test.comapplext_ims_lib_depl]
    Parent loader name: [Frame ClassLoader]
    No references !
    Resources:
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\commons-collections-2.1.1.jar
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\test.comapplj2ee_ims.jar
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\cglib-2.1.3.jar
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\commons-logging-1.0.4.jar
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\dom4j-1.6.1.jar
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\ant-antlr-1.6.5.jar
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\ims_beans.jar
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\ehcache- 1.2.3.jar
       C:\usr\sap\VDW\JC00\j2ee\cluster\server0\bin\ext\test.comapplext_ims_lib_depl\hibernate3.jar
    Loading model: {parent,local,references}
    The error occurred while trying to load "com.test.za.securityRiskManagement.service.EventHandlerHome".
    at com.sap.engine.frame.core.load.ReferencedLoader.loadClass(ReferencedLoader.java:401)
    at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at com.test.za.securityRiskManagement.bean.EventCommandBean.executeCreateEvent(EventCommandBean.java :205)
    at com.test.event.view.EventRegistrationView.onActionSubmit(EventRegistrationView.java:143)
    at com.test.event.view.wdp.InternalEventRegistrationView.wdInvokeEventHandler(InternalEventRegistrationView.java :150)
    at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
    at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
    at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent (WindowPhaseModel.java:420)
    at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
    at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java :335)
    at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
    at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:299)
    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:752)
    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:705)
    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)
    at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:154)
    at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent (DispatcherServlet.java:62)
    at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java :266)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
    at com.sap.engine.services.httpserver.server.Client.handle (Client.java:95)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java :33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged (Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Thanks.

    Hi Maksim,
    Below is an extract of my dcdef file:
      <dependency>
           <dc-ref>
               <name>ejb20</name>
              <vendor>sap.com</vendor>
          </dc-ref>
          <pp-ref>default</pp-ref>
          <at-build-time/>
          <at-runtime qualifier="strong"/>
      </dependency>
    It looks exactly like what you send except for the runtime qualifier.
    Thanks.

  • Local Session Bean calling another local Session Bean in EJB 3.0

    Hi,
    In EJB 3.0, I am trying to do JNDI lookup of a local sesion bean from another session bean's helper class.
    I am not using @EJB injection mechanism here, as call to the local session bean is made in a helper class. Helper classes do not support resource injection.
    Following are the EJB class definitions used in my project. Call to "EJB3Local" made from "EJB1" fails as the "EJB2" helper class is calling "EJB1Local"
    @Stateless
    @EJBs({@EJB(name="EJB2Local", beanInterface=EJB2Local.class),
    @EJB(name="EJB3Local", beanInterface=EJB3Local.class)})
    public class EJB1 implements EJB1Remote, EJB1Local{
    public void findEJB3Local(){
    //1. JNDI lookup for EJB3Local ----
    //2. EJB3Local.someFunction()
    @Stateless
    @EJB(name="EJB1Local", beanInterface=EJB1Local.class)
    public class EJB2 implements EJB2Remote, EJB2Local{
    public void findEJB1Local(){
    //1. JNDI lookup EJB1Local
    // 2. Call EJB1Local.findEJB1Local method
    @Stateless
    public class EJB3 implements EJB3Remote, EJB3Local{
    public void someFunction(){}
    A remote call to EJB2.findEJB1Local() will invoke EJb1Local.findEJB3Local method and the call fails with "java:comp/env/EJB3Local" not found in EJB1Local.
    Has anybody encountered an issue like this issue with local interface calling another local interface?
    Thanks,
    Mohan

    To refer a Ejb from another Ejb include <ejb-ref> element
    in ejb-jar.xml
    <session>
    <ejb-name>SessionBeanA</ejb-name>
    <ejb-ref>
    <ejb-ref-name>SessionBeanB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.ejb.SessionBeanBHome</home>
    <remote>com.ejb.SessionBeanB</remote>
    </ejb-ref>
    </session>
    Include a <reference-descriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>SessionBeanA</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>SessionBeanB</ejb-ref-name>
    <jndi-name>com.ejb.SessionBeanBHome</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    In SessionBeanA Bean class refer to SessionBeanB with
    a remote reference to SessionBeanB.
    InitialContext initialContext=new InitialContext();
    SessionBeanBHome sessionBeanBHome=(SessionBeanBHome)
    initialContext.lookup("com.ejb.SessionBeanBHome");
    SessionBeanB sessionBeanB=sessionBeanBHome.findByPrimaryKey(primarykey);
    sessionBeanB.update();
    sessionBeanB.getAll();
    thanks,
    Deepak

  • Calling from an EJB into a JSF Backing Bean

    Hello all,
    I'm looking for some help in making calls from an EJB into a Backing Bean (the converse is fairly straightforward). My basic question is: what is regarded as the best way to do this?
    However, for anybody who's interested, I'll describe what I've been trying...
    Here's my situation (I'm working with OC4J 10.1.3.2). I have a simple application-scoped backing bean:
       public class BackingBean implements SimpleInterface, Serializable {
           private String greeting = "Hello, World";
           private SessionEJBRemote blBeanRemote = null;
           public BackingBean() {
               // get hold of EJB
               // [ ... code to obtain EJB's remote interface snipped ... ]
               // set the callback with the EJB       
               try {
                   blBeanRemote.setCallback(this);
               } catch (Exception ex) {
                   ex.printStackTrace();
           // methods to manipulate the greeting string
           public String getGreeting() {
               return greeting;
           public void setGreeting(String greeting) {
               this.greeting = greeting;
       }SimpleInterface, which my Backing Bean implements is, well, a simple interface:
       public interface SimpleInterface {
           public void setGreeting(String greeting);
       }And my EJB is also pretty straightforward:
       @Stateful(name="SessionEJB")
       public class SessionEJBBean implements SessionEJBRemote, SessionEJBLocal {
           private SimpleInterface callback = null;
           public void setCallback(SimpleInterface callback) {
               this.callback = callback;
               callback.setGreeting("Goodbye, World");
       }Now, by using SimpleInterface, my intention was to ensure a one-way dependency: i.e. the JSF-level code would depend on the EJB-level code, but not vice versa.
    However, my experimentation has shown that when I make the call to blBeanRemote.setCallback, the parameter appears to be passed by value rather than by reference. This means firstly that, at runtime, by EJB needs to have access to my backing bean class and secondly, that the call to callback.setGreeting has no effect.
    Can anybody suggest how to work around this? Is it possible to pass the backing bean by reference? Is there a better way to achieve this callback? I appreciate that these questions might be more general Java/AppServer queries rather than JSF-specific ones - but hopefully this is something that all you JSF experts have encountered before.
    (Incidentally, I realise that what I'm doing in this example is pointless - what I'm building towards is using the ICEFaces framework to have the EJBs prod a backing bean which will in turn cause a user's browser to rerender.)
    Many thanks - any help very much appreciated!
    Alistair.

    Hi Raymond - yes, you've pretty much got that spot on: an event occurs (say receipt of a JMS message - which is spontaneous, as far as the users are concerned). As a result of that event, the client's view (in their browser) needs to be re-rendered.
    ICEFaces uses the AJAX technique to allow server-pushes, and rather than refreshing the whole page it uses "Direct-to-DOM" rendering to maninpulate the page components. If you've not come across it, and you're interested, then there are some pretty interesting demos here: http://www.icefaces.org/main/demos/ - the "chat" feature of the Auction Monitor demo (if you open it up in two browsers) is the nearest to the effect I'm looking for.
    The Auction Monitor demo uses a number of session-scoped beans, each implementing the ICEFaces "Renderable" interface, and each of which registers itself with an application-scoped bean. The application-scoped bean can thus iterate through each of the session-scoped beans and cause the corresponding browser to refresh.
    Unfortunately, in the Auction Monitor demo, the entry point is always from a browser - albeit the result is then mirrored across all connected browsers. I haven't found any examples of this processing being driven by an external event, hence my experimentation in this area!

  • Need to delete local references in unknown calling context

    Hi,
    I was looking for the need to delete local references and came across this documentation,
    What does unknown caller context mean? and how does it cause local references to remain allocated in reference table although the native function returns?
    http://java.sun.com/docs/books/jni/html/refs.html
    5.2.1 Freeing Local References
    You want to write a utility function that is called from unknown contexts. The MyNewString example shown in Section 4.3 illustrates the use of Delete-LocalRef to delete promptly local references in a utility function. Otherwise there will be two local references that remains allocated after each call to the MyNewString function.

    how does it cause local references to remain allocated in reference table although the native function returns?Because it doesn't return to the JVM where it gets deallocated, it returns to the unknown caller context, i.e. some other piece of native code in your JNI layer. So the references remain until the unknown caller context returns to the JVM.

  • How to return a char [][] from c++ to java with JNI

    hi , i am new to JNI and i am having some troubles with a special task :
    in fact i am supposed to treat some data stored in a char[100][100] value and then return the result to java , the result is the sam value bur modified i mean a char [100][100] variable too...
    i saw that we can rely on
    JNIEXPORT jobjectArray JNICALL Java_JNITest_newArray (JNIEnv *env, jclass, jint size )
    jobjectArray joa = ... );  // what in my case ?;
    jsize len1 = (jsize)env->GetArrayLength(joa);
    for (int i=0; i<l en1; i++)
    jintArray colonne = (jintArray)env->GetObjectArrayElement(joa, i);
    jsize len2 = (jsize)env->GetArrayLength(colonne);
    jint *element = env->GetIntArrayElements(colonne, 0);
    for(int j=0; j<len2; j++)
           jint res = element[j];
                 // process some treatment here
            // how now to return the result to java : joa modified !!
    [/code]
    may be some errors present in this piece of code ...but i rely on your help to have the solution!! please i am really desperated !                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    You know that any JNI function for an array handles or creats only one-dimensional array. But if you know Java array structure then with these functions you can create Java arrays of any dimensions.
    A Java multi-dimensional array is a set of nested one-dimensional arrays (consider dimensions from left to right). I give you only schema of this process. Let create the array of your type (for example, char [2][3]):
    1) create one-dimensional object array "[C"[/b] of size two for the first dimension (and assign it to some variable of type jobjectArray) ;
    2) create two three-dimentional char arrays and assign these local references to each element of the array created in prev. step;
    3) fill each array created in (2) with your data (characters);
    4) return to Java code the reference created in the step (1) and do not delete local references created in steps (1) and (2).

  • Trouble in communicating with another EJB from an EJB

    I have created a stateless session bean, and inside this bean I have methods that calls methods in another stateless session bean (called myEJB, for example). When I run the code, it kept giving me the "noClassDefFoundError":
    java.rmi.RemoteException: Error in ejbCreate:; nested exception is:
         java.lang.NoClassDefFoundError: com.mybean.myEJBHome
    Someone suggested to me that this is because they aren't remote objects, so I created local interfaces for "myEJB". When I run the code again (by binding to the Local interface now), I got this error:
    javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: Unable to resolve
    'app/ejb/mybeans.jar#myEJB/local-home' Resolved: 'app/ejb/ Unresolved:'mybeans.jar#myEJB' ;
    remaining name 'mybeans.jar#myEJB/local-home']; Link Remaining Name:
    'java:app/ejb/mybeans.jar#myEJB/local-home'
    Any ideas??
    Thanks

    To refer a Ejb from another Ejb include <ejb-ref> in ejb-jar.xml
    <session>
    <ejb-name>EjbA</ejb-name>
    <ejb-ref>
    <ejb-ref-name>Ejb2</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.ejb.Ejb2Home</home>
    <remote>com.ejb.Ejb2</remote>
    </ejb-ref>
    <session>
    Include a <reference-discriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>EjbA</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>Ejb2</ejb-ref-name>
    <jndi-name>protocol://<Ejb2host>:<PortNumber>/com.ejb.Ejb2Home</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    Example <jndi-name>:http://localhost:7001/com.ejb.Ejb2Home
    In EjbA bean class refer to Ejb2 method with a reference to Ejb2 remote interface.
    InitialContext initialContext = new InitialContext();
    Ejb2Home ejb2Home = (Ejb2Home)initialContext.lookup("protocol://<Ejb2host>:<PortNumber>/com.ejb.Ejb2Home");

Maybe you are looking for