How call session bean from Client side

Hi
calling session bean from client side it gives Lookup erroe, it gives JNDI error
how we know session bean is working. in Admin tree bean statis is reb Flaf, and ID is "Down" how we activate it..
null

If you can make a connection using sess_sh, then you know that you have configured your database and listener properly. If it is not working, read the manuals that you can download from technet. They are pretty good, and if you follow the directions, you should see success.
Good Luck!
Brad

Similar Messages

  • Problem when calling session bean from main.

    Hi everyone
    I get the following error when calling a session bean from main(String args[]).
    Sep 3, 2008 9:11:13 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
    WARNING: ACC003: Application threw an exception.
    java.lang.NullPointerException
    at databasetest.Main.main(Main.java:26)
    Here is my code beneath.
    I'm using netbeans and glassfish application server.
    Everything is in the same project, called DatabaseTest, I also have deployed the application before running the client.
    I'm running the client as follows, right click on the DatabaseTest-app-client and select run.
    The client:
    package databasetest;
    import com.test.UsersFacadeRemote;
    import javax.ejb.EJB;
    import com.test.Users;
    public class Main {
        @EJB
        private static UsersFacadeRemote usersFacade;
        public static void main(String[] args) {
            Users users = new Users(12, 34);
            usersFacade.create(users);
    }The remote facade I'm calling:
    package com.test;
    import java.util.List;
    import javax.ejb.Remote;
    @Remote
    public interface UsersFacadeRemote {
        void create(Users users);
        void edit(Users users);
        void remove(Users users);
        Users find(Object id);
        List<Users> findAll();
    }The stateless bean:
    package com.test;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless
    public class UsersFacade implements UsersFacadeRemote {
        @PersistenceContext
        private EntityManager em;
        public void create(Users users) {
            em.persist(users);
        public void edit(Users users) {
            em.merge(users);
        public void remove(Users users) {
            em.remove(em.merge(users));
        public Users find(Object id) {
            return em.find(com.test.Users.class, id);
        public List<Users> findAll() {
            return em.createQuery("select object(o) from Users as o").getResultList();
    }

    looks like you're banging your head against the same brick wall as [I have done|http://forums.sun.com/thread.jspa?forumID=13&threadID=5317110] and [others have in the past|http://forums.sun.com/thread.jspa?forumID=136&threadID=5259913] if that's any consolation.
    Funny thing is, mine did actually work in the debugger but not when running!
    Strange thing that.
    I did initially interest someone from the developers but they couldn't really help, ended up saying : try instantiating your beans the EJB 2.1 way and see where that gets you. Yes that works but they promised us "hey no more dopey xml deployment descriptors just some cool annotations" didn't they?
    I've got the feeling were' missing something really obvious!
    Edited by: sebthebike on 03-Sep-2008 12:21

  • Exception while i m looking up my session bean from Client

    hi,
    actully i try to make a simple session bean ok
    first i make a seession bean and make his deployment discriptor
    and put all thing a jar file and deployee this file on Server its successfuly
    loaded and deploed.
    ok the problem is when i make a client bean and try to run it. it give me this exception
    javax.naming.NoInitialContextException:
    Need to specify class name in environment or system property, or as an applet parameter,
    or in an application resource file: java.naming.factory.initial      
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:643)      
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)      
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:283)      
    at javax.naming.InitialContext.lookup(InitialContext.java:350)      
    at HelloClient.main(HelloClient.java:15)
    Process Exit...
    i where i right the machine name where my appserver is runing. inside lookup method
    client bean code is
    =====================
    import java.rmi.*;
    import javax.naming.*;
    import java.util.*;
    import HASSSAN.*;
    public class HelloClient {
         public static void main(String arg[]) {
         try {
              javax.naming.Context ctx =
              new javax.naming.InitialContext(System.getProperties());
              Object obj = ctx.lookup("HelloBean");
              HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
              Hello hello =home.create();
              System.out.println(hello.sayHello());
              hello.remove();
              System.out.println("Success");
         }catch(Exception e) {
              e.printStackTrace();
    }

    Two hints:
    Need to specify class name in environment or system
    property, or as an applet parameter,
              javax.naming.Context ctx = new javax.naming.InitialContext(System.getProperties());This means you need to check what you're putting on your command line in the way of "-D" settings.
    or in an application resource file:You can get this from the methodology jgongo mentions.

  • How to load images from client side when the swf is hosted on a server without uplaoding it to server?

    I'm trying to build a online image resize tool.
    problem i face are:
    1. I build a button that allow user to browse the file. Once
    file is selected, it doesnt show full path.
    2. lets say if it shows fullpath, but i try to load it into a
    movieclip, and it doesnt work because the swf file is located at
    the server and not the client's place.
    3. as far as i know, flash can only load images which is
    located in the same server or internet.
    4. if i use php, asp, cgi.. it can only allow me to 1st
    upload the image then resize later, but this is not wat i want.
    5. I need to 1st resize then upload later, because if i have
    100 and more photos taken from digicam, it's going to be very slow
    and heavy.
    What i have tested:
    1. upload "image3.jpg" into the same directory as the
    "viewer.swf", and it works.
    2. do not upload the swf to the server, but run locally from
    the user's computer and open "image3.jpg" and it works.
    3. upload the swf to the server and open "image3.jpg" from
    the user's computer and IT DOESN"T WORK!
    please help me out.
    Thanks~!

    use this php code.
    for flash php image prosses.
    flash file
    import flash.display.BitmapData;
    shaF.onPress = function() {
    output();
    function output() {
    snap = new BitmapData(mc._width, mc._height);
    snap.draw(mc);
    var pixels:Array = new Array();
    var w:Number = snap.width;
    var h:Number = snap.height;
    for (var a = 0; a<=w; a++) {
    for (var b = 0; b<=h; b++) {
    var tmp = snap.getPixel(a, b).toString(16);
    pixels.push(tmp);
    var output:LoadVars = new LoadVars();
    output.img = pixels.toString();
    output.height = h;
    output.width = w;
    output.send("show.php", "output", "POST");
    stop();
    PHP file (show.php)
    <?php
    $data = explode(",", $_POST['img']);
    $width = $_POST['width'];
    $height = $_POST['height'];
    $image=imagecreatetruecolor( $width ,$height );
    $background = imagecolorallocate( $image ,0 , 0 , 0 );
    //Copy pixels
    $i = 0;
    for($x=0; $x<=$width; $x++){
    for($y=0; $y<=$height; $y++){
    $int = hexdec($data[$i++]);
    $color = imagecolorallocate ($image, 0xFF & ($int
    >> 0x10), 0xFF & ($int >> 0x8), 0xFF & $int);
    imagesetpixel ( $image , $x , $y , $color );
    //$font = imageloadfont('arial.ttf');
    $font = 'arial.ttf';
    // $text_color = imagecolorallocate($image, 233, 14, 91);
    $black = imagecolorallocate($image, 0, 0, 0);
    //imagestring($image, $font, 5, 5, "A Simple Text String",
    $text_color);
    imagettftext($image, 12, 0, 10, 20, $black, $font, "A Simple
    Text String");
    //Output image and clean
    //header("Content-Type: image/png");
    imagepng($image,"finoy.png");
    imagedestroy( $image );
    ?>
    <html>
    <body>
    <img src="finoy.png" width="159" height="159" />
    </body>
    </html>

  • Error when Calling Session Bean from BPEL .

    Please Help ? Has anyone experienced this before
    Oracle BPEL Process Manager Full Cycle
    An unexpected error has occurred while executing your request. This is most likely related to a defect in the Oracle BPEL Process Manager product. We apologize you can post the error to the OTN forum and we will get back to you as soon as possible.
    Attachments:
    Build Information:
    Oracle BPEL Server version 10.1.2.0.0
    Build: 1545
    Build time: Sun Jun 26 02:17:28 PDT 2005
    Build type: release
    Source tag: BPELPM_10_1_2_release_branch
    Exception Message:
    [java.lang.Exception]
    Failed to create "ejb/collaxa/system/ServerBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/ServerBean not found
         at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:164)
         at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:333)
         at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:120)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at com.oracle.bpel.client.util.BeanRegistry.lookupServerBean(BeanRegistry.java:95)
         at com.oracle.bpel.client.Server.getServerBean(Server.java:463)
         at com.oracle.bpel.client.Server.isDomainListingEnabled(Server.java:419)
         at _displayInstance._jspService(_displayInstance.java:78)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:220)
         at com.collaxa.cube.fe.DomainFilter.doFilter(DomainFilter.java:152)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    Exception Trace:
    java.lang.Exception: Failed to create "ejb/collaxa/system/ServerBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/ServerBean not found
         at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:164)
         at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:333)
         at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:120)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at com.oracle.bpel.client.util.BeanRegistry.lookupServerBean(BeanRegistry.java:95)
         at com.oracle.bpel.client.Server.getServerBean(Server.java:463)
         at com.oracle.bpel.client.Server.isDomainListingEnabled(Server.java:419)
         at _displayInstance._jspService(_displayInstance.java:78)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:220)
         at com.collaxa.cube.fe.DomainFilter.doFilter(DomainFilter.java:152)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
         at com.oracle.bpel.client.util.BeanRegistry.lookupServerBean(BeanRegistry.java:109)
         at com.oracle.bpel.client.Server.getServerBean(Server.java:463)
         at com.oracle.bpel.client.Server.isDomainListingEnabled(Server.java:419)
         at displayInstance.jspService(_displayInstance.java:78)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:220)
         at com.collaxa.cube.fe.DomainFilter.doFilter(DomainFilter.java:152)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)

    The build you are using is one of our nightly build.
    You should try it by using BPEL PM offical release build.
    -John

  • How to run expdp from client ?

    Hi All,
    I tried searching google and forums for my issue but to no avail > How to run expdp from client side ....like in my laptop.
    Because currently our PROD database server has no space for expdp dump file. So I want it directed to my laptop which has an extenal USB of 1TB harddisk...via client EXPDP
    import data using impdp command
    Posted on: 08-May-2012 11:36, by user: 841731 -- Relevance: 53% -- Show all results within this thread
    below command is correct or not? if it is not correct could you please send me the correct command. impdp user/pass@databasename schemas=sourceschemaname remap_schema=sourceschemaname:destinationschemaname ...
    System generated Index names different on target database after expdp/impdp
    Posted on: 30-May-2012 11:58, by user: 895124 -- Relevance: 43% -- Show all results within this thread
    After performing expdp/impdp to move data from one database (A) to another (B), the system name generated indexes has different ...
    [ETL] TTS vs expdp/impdp vs ctas (dblink
    Posted on: 08-May-2012 21:10, by user: 869578 -- Relevance: 39% -- Show all results within this thread
    (table : 500 giga, index : 500 giga), how much faster is TTS (transportable tablespace) over expdp/impdp, and over ctas (dblink) ? As you know, the speed of etl depends on the hardware capacity. (io ...
    Oracle Client
    Posted on: 21-Jun-2012 22:47, by user: Sh**** -- Relevance: 32% -- Show all results within this thread
    Hi Guys, Please can you guys elaborate the difference between Oracle Client and Oracle Instant Client. Also, please can you advise from where I can download the Oracle normal ...
    Oracle 10g Client
    Posted on: 05-Jun-2012 10:11, by user: dzm -- Relevance: 26% -- Show all results within this thread
    to search at oracle site and this forum, but i wasn't able to find a link to download the oracle 10g client. I really need especificaly the 10g version. Anybody know the link or another way to download ...
    9i client to access 11g database
    Posted on: 22-Jun-2012 07:31, by user: kkrm333 -- Relevance: 24% -- Show all results within this thread
    Hi, Can i access a 11g database using 9i client? Thanks,
    SQLplus in Oracle Client
    Posted on: 14-Jun-2012 00:36, by user: Tim B. -- Relevance: 24% -- Show all results within this thread
    Hi, I tried to install an 11g oracle client in linux. As I've compared the files with the files when you install using the oracle instant ...
    Re: Information on Oracle Client 11202-1.1.4-6
    Posted on: 05-Jun-2012 03:33, by user: 898763 -- Relevance: 23% -- Show all results within this thread
    Actually thats the client requirement
    Analysing the performance of a single client
    Posted on: 28-Mar-2012 02:05, by user: 880172 -- Relevance: 23% -- Show all results within this thread
    timeouts even on some of the simplest queries. I want to try and get some data about how just this one client is performing and what it’s doing, but everything Google has thrown up so far is orientated around ...
    to make client connection as sys
    Posted on: 12-Jun-2012 22:04, by user: user11221081 -- Relevance: 23% -- Show all results within this thread
    Dear gurus can i connect to my server from my client machine with sysdba without giving sys password i have connected in different ways as sys@abc ...Thanks a lot.

    Though you can initiate the binary from your client side but for the file creation, there is no other way but to store it on the server side. So your best bet would be to get some space free on the server side of yours.
    Aman....

  • Call session bean in message driven bean

    Is it a best practice calling a session bean every time arrive a message in a message driven bean?
    Regards
    Message was edited by:
    gionnyDeep

    Why not?
    You can call Session Bean from a Message Driven Bean as long as your J2EE Server is able to handle the messages.

  • How can i lookup a session bean from the client side

    how can i lookup a session bean from the client side...........i am using sun appserver..............
    this is my code.................[B]
    private final static String JNDI_NAME="ejb/LmsBean";
    private static String url="ldap://localhost:4848";
    Hashtable h=new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    h.put(Context.PROVIDER_URL,url);
    System.out.println("Before Loading Context in Delegate");
    Context ctx=new InitialContext(h);
    System.out.println("Loaded Context in Delegate");
    Object obj=ctx.lookup(JNDI_NAME);
    System.out.println("Loaded Object in Delegate");
    System.out.println("Before Loading Home in Delegate");
    LmsHome home = (LmsHome )PortableRemoteObject.narrow(obj,com.parx.lms.controller.LmsHome.class);
    System.out.println("Loaded Home in Delegate");
    lms = home.create();
    System.out.println("Loaded remote in Delegate");
    [B]and i got the exception........
    Inside Client before calling delegate
    Before Loading Context in Delegate
    javax.naming.CommunicationException: Request: 1 cancelled
    javax.naming.CommunicationException: Request: 1 cancelled
    at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:60)
    at com.sun.jndi.ldap.Connection.readReply(Connection.java:405)
    at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:340)
    at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:171)
    at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2640)
    at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:290)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193
    at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.ja
    va:136)
    at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.jav
    a:66)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    62)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    at com.parx.lms.lmsdelegate.LmsDelegate.getController(LmsDelegate.java:3
    0)
    at com.parx.lms.lmsdelegate.LmsDelegate.addUserDelegate(LmsDelegate.java
    :50)
    at com.parx.lms.client.consoleClient.Client.main(Unknown Source)
    pls go tru the exception and pls help.........

    That url string should be having the server name or ip instead of localhost.

  • Accessing the same stateful session bean from multiple clients in a clustered environment

    I am trying to access the same stateful session bean from multiple
              clients. I also want this bean to have failover support so we want to
              deploy it in a cluster. The following description is how we have tried
              to solve this problem, but it does not seem to be working. Any
              insight would be greatly appreciated!
              I have set up a cluster of three servers. I deployed a stateful
              session bean with in memory replication across the cluster. A client
              obtains a reference to an instance of one of these beans to handle a
              request. Subsequent requests will have to use the same bean and could
              come from various clients. So after using the bean the first client
              stores the handle to the bean (actually the replica aware stub) to be
              used by other clients to be able to obtain the bean. When another
              client retrieves the handle gets the replica aware stub and makes a
              call to the bean the request seems to unpredictably go to any of the
              three servers rather than the primary server hosting that bean. If the
              call goes to the primary server everything seems to work fine the
              session data is available and it gets backed up on the secondary
              server. If it happens to go to the secondary server a bean that has
              the correct session data services the request but gives the error
              <Failed to update the secondary copy of a stateful session bean from
              home:ejb20-statefulSession-TraderHome>. Then any subsequent requests
              to the primary server will not reflect changes made on the secondary
              and vice versa. If the request happens to go to the third server that
              is not hosting an instance of that bean then the client receives an
              error that the bean was not available. From my understanding I thought
              the replica aware stub would know which server is the primary host for
              that bean and send the request there.
              Thanks in advance,
              Justin
              

              If 'allow-concurrent-call' does exactly what you need, then you don't have a problem,
              do you?
              Except of course if you switch ejb containers. Oh well.
              Mike
              "FBenvadi" <[email protected]> wrote:
              >I've got the same problem.
              >I understand from you that concurrent access to a stateful session bean
              >is
              >not allowed but there is a
              >token is weblogic-ejb-jar.xml that is called 'allow-concurrent-call'
              >that
              >does exactly what I need.
              >What you mean 'you'll get a surprise when you go to production' ?
              >I need to understand becouse I can still change the design.
              >Thanks Francesco
              >[email protected]
              >
              >"Mike Reiche" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Get the fix immediately from BEA and test it. It would be a shame to
              >wait
              >until
              >> December only to get a fix - that doesn't work.
              >>
              >> As for stateful session bean use - just remember that concurrent access
              >to
              >a stateful
              >> session bean is not allowed. Things will work fine until you go to
              >production
              >> and encounter some real load - then you will get a surprise.
              >>
              >> Mike
              >>
              >> [email protected] (Justin Meyer) wrote:
              >> >I just heard back from WebLogic Tech Support and they have confirmed
              >> >that this is a bug. Here is their reply:
              >> >
              >> >There is some problem in failover of stateful session beans when its
              >> >run from a java client.However, it is fixed now.
              >> >
              >> >The fix will be in SP2 which will be out by december.
              >> >
              >> >
              >> >Mike,
              >> >Thanks for your reply. I do infact believe we are correctly using
              >a
              >> >stateful session bean however it may have been misleading from my
              >> >description of the problem. We are not accessing the bean
              >> >concurrently from 2 different clients. The second client will only
              >> >come into play if the first client fails. In this case we want to
              >be
              >> >able to reacquire the handle to our stateful session bean and call
              >it
              >> >from the secondary client.
              >> >
              >> >
              >> >Justin
              >> >
              >> >"Mike Reiche" <[email protected]> wrote in message
              >news:<[email protected]>...
              >> >> You should be using an entity bean, not a stateful session bean
              >for
              >> >this application.
              >> >>
              >> >> A stateful session bean is intended to be keep state (stateful)
              >for
              >> >the duration
              >> >> of a client's session (session).
              >> >>
              >> >> It is not meant to be shared by different clients - in fact, if
              >you
              >> >attempt to
              >> >> access the same stateful session bean concurrently - it will throw
              >> >an exception.
              >> >>
              >> >> We did your little trick (storing/retrieving handle) with a stateful
              >> >session bean
              >> >> on WLS 5.1 - and it did work properly - not as you describe. Our
              >sfsb's
              >> >were not
              >> >> replicated as yours are.
              >> >>
              >> >> Mike
              >> >>
              >> >> [email protected] (Justin Meyer) wrote:
              >> >> >I am trying to access the same stateful session bean from multiple
              >> >> >clients. I also want this bean to have failover support so we want
              >> >to
              >> >> >deploy it in a cluster. The following description is how we have
              >tried
              >> >> >to solve this problem, but it does not seem to be working. Any
              >> >> >insight would be greatly appreciated!
              >> >> >
              >> >> >I have set up a cluster of three servers. I deployed a stateful
              >> >> >session bean with in memory replication across the cluster. A client
              >> >> >obtains a reference to an instance of one of these beans to handle
              >> >a
              >> >> >request. Subsequent requests will have to use the same bean and
              >could
              >> >> >come from various clients. So after using the bean the first client
              >> >> >stores the handle to the bean (actually the replica aware stub)
              >to
              >> >be
              >> >> >used by other clients to be able to obtain the bean. When another
              >> >> >client retrieves the handle gets the replica aware stub and makes
              >> >a
              >> >> >call to the bean the request seems to unpredictably go to any of
              >the
              >> >> >three servers rather than the primary server hosting that bean.
              >If
              >> >the
              >> >> >call goes to the primary server everything seems to work fine the
              >> >> >session data is available and it gets backed up on the secondary
              >> >> >server. If it happens to go to the secondary server a bean that
              >has
              >> >> >the correct session data services the request but gives the error
              >> >> ><Failed to update the secondary copy of a stateful session bean
              >from
              >> >> >home:ejb20-statefulSession-TraderHome>. Then any subsequent requests
              >> >> >to the primary server will not reflect changes made on the secondary
              >> >> >and vice versa. If the request happens to go to the third server
              >that
              >> >> >is not hosting an instance of that bean then the client receives
              >an
              >> >> >error that the bean was not available. From my understanding I
              >thought
              >> >> >the replica aware stub would know which server is the primary host
              >> >for
              >> >> >that bean and send the request there.
              >> >> >
              >> >> >Thanks in advance,
              >> >> >Justin
              >>
              >
              >
              

  • How can i look up a EJB residing in different machine from client side?

    hai ,
    How can i look up a EJB residing in different machine from client side?
    this is my code...........i don't know what should i use as Initial Context Factory...................i am using a sun appserver 8............
    package com.parx.lms.lmsdelegate;
    import com.parx.lms.exception.LMSException;
    import javax.naming.Context;
    import javax .ejb.CreateException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import java.rmi.RemoteException;
    import com.parx.lms.controller.*;
    import com.parx.lms.vo.UserVo;
    import com.parx.lms.exception.BusinessException;
    import java.util.Hashtable;
    import java.lang.*;
    public class LmsDelegate{
    private final static String JNDI_NAME="LmsBean";
    private static String url="http://localhost:4848";
    public static Lms lms = null;
    public void getController() throws CreateException,
    NamingException,RemoteException{
    if(lms == null){
    Hashtable h=new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY," ********what should i use here???????*************************");
    h.put(Context.PROVIDER_URL,url);
    System.out.println("Before Loading Context in Delegate");
    Context ctx=new InitialContext(h);
    System.out.println("Loaded Context in Delegate");
    Object obj=ctx.lookup(JNDI_NAME);
    System.out.println("Loaded Object in Delegate");
    System.out.println("Before Loading Home in Delegate");
    LmsHome home = (LmsHome )PortableRemoteObject.narrow(obj,com.parx.lms.controller.LmsHome.class);
    System.out.println("Loaded Home in Delegate");
    lms = home.create();
    System.out.println("Loaded remote in Delegate");
    public void addUserDelegate(UserVo vo) throws BusinessException{
    try{
    getController();
    System.out.println("Before calling the addUser of Session");
    lms.addUser(vo);
    }catch(CreateException e){
    System.out.println("Create Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    }catch(NamingException e){
    System.out.println("Naming Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    catch(RemoteException e){
    System.out.println("Remote Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    }catch(LMSException e){
    System.out.println("duplicate user name--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    pls help me..........

    h.put(Context.INITIAL_CONTEXT_FACTORY," ********what should i use here???????*************************")
    Each app server provides their own jndi factory class. For ex for weblogic it is weblogic.jndi.WLInitialContextFactory. SInce you are using sun app server, check if there are any examples to find out or the docs.
    private static String url="http://localhost:4848
    Since the client is in a different machine the localhost is not going to work here. provide the url or the machine name of the system in which ur sunapp server is running. In addition u will need to have the stubs of the remote interfaces in ur client machine.

  • How can i load file into database from client-side to server-side

    i want to upload file from client-side to server-side, i use the following code to load blob into database.
    if the file is in the server-side, it can work, but if it in the client-side, it said that the system cannot find the file. i think it only will search the file is in the server-side or not, it will not search the client-side.
    how can i solve it without upload the file to the server first, then load it into database??
    try
    ResultSet rset = null;
    PreparedStatement pstmt =
    conn.prepareStatement ("insert into docs values (? , EMPTY_BLOB())");
    pstmt.setInt (1, docId);
    pstmt.execute ();
    // Open the destination blob:
    pstmt.setInt (1, docId);
    rset = pstmt.executeQuery (
    "SELECT content FROM docs WHERE id = ? FOR UPDATE");
    BLOB dest_lob = null;
    if (rset.next()) {
    dest_lob = ((OracleResultSet)rset).getBLOB (1);
    // Declare a file handler for the input file
    File binaryFile = new File (fileName);
    FileInputStream istream = new FileInputStream (binaryFile);
    // Create an OutputStram object to write the BLOB as a stream
    OutputStream ostream = dest_lob.getBinaryOutputStream();
    // Create a tempory buffer
    byte[] buffer = new byte[1024];
    int length = 0;
    // Use the read() method to read the file to the byte
    // array buffer, then use the write() method to write it to
    // the BLOB.
    while ((length = istream.read(buffer)) != -1)
    ostream.write(buffer, 0, length);
    pstmt.close();
    // Close all streams and file handles:
    istream.close();
    ostream.flush();
    ostream.close();
    //dest_lob.close();
    // Commit the transaction:
    conn.commit();
    conn.close();
    } catch (SQLException e) {

    Hi,
    Without some more details of the configuration, its difficult to know
    what's happening here. For example, what do you mean by client side
    and server side, and where are you running the upload Java application?
    If you always run the application on the database server system, but can't
    open the file on a different machine, then it sounds like a file protection
    problem that isn't really connected with the database at all. That is to
    say, if the new FileInputStream (binaryFile) statement fails, then its not
    really a database problem, but a file protection issue. On the other hand,
    I can't explain what's happening if you run the program on the same machine
    as the document file (client machine), but you can't write the data to the
    server, assuming the JDBC connection string is set correctly to connect to
    the appropriate database server.
    If you can provide some more information, we'll try to help.
    Simon
    null

  • How to use KeyChain API from client-side HTML scripting in Safari on iPad?

    I have a requirement where I need to add client-side scripting in an HTML page to be supported by Safari on iPad that creates a private / public key pair and that creates a CSR (Certificate Signing Request) in PKCS#10 or SPKAC format that can be sent to a certification authority server using form HTTP/POST that will then return the generated certificate.
    I initially thought that I could simply use the HTML 5 tag <keygen> which can do exactly what I need, but unfortunately this tag is not at all supported on mobile Apple devices like iPad or iPhone, so I have to look for another solution.
    I have noticed that the KeyChain tool should be available on iPad using the documented API, but I have no idea based on the documentation whether the API can be called from client-side HTML scripting on iPad.
    Question : is it technically possible using the functionalities and API's exposed on an iPad to implement what I just described in HTML client-side scripting? If so, do you have some links with useful information that can help me on my way?

    I have a requirement where I need to add client-side scripting in an HTML page to be supported by Safari on iPad that creates a private / public key pair and that creates a CSR (Certificate Signing Request) in PKCS#10 or SPKAC format that can be sent to a certification authority server using form HTTP/POST that will then return the generated certificate.
    I initially thought that I could simply use the HTML 5 tag <keygen> which can do exactly what I need, but unfortunately this tag is not at all supported on mobile Apple devices like iPad or iPhone, so I have to look for another solution.
    I have noticed that the KeyChain tool should be available on iPad using the documented API, but I have no idea based on the documentation whether the API can be called from client-side HTML scripting on iPad.
    Question : is it technically possible using the functionalities and API's exposed on an iPad to implement what I just described in HTML client-side scripting? If so, do you have some links with useful information that can help me on my way?

  • How can I set the value to a session bean from backing bean

    Hi Experts,
    How can I set the value to a session bean from backing bean where I have created getter and setter
    methods for that variable.
    Basically I am using ADFUtils class where I am able to get the value from session bean
    using following expression
    String claimType =
    (String)ADFUtil.invokeEL("#{ClaimValueObj.getClaimType}");
    Thanks
    Gayaz

    Gayaz,
    Wrong Post !!
    Post in JDeveloper and ADF
    Thanks
    --Anil                                                                                                                                                                                                                               

  • How to call session bean's method in JSP

    Hi All,
    I am working on a JSF web application by using sun studio creator.
    The first page have a button, the onClick javascript is as following, which bring up a alert box showing user login name.
    In JSP file, how can I call session bean's setUserName(String name) function (which I would like to store this UserName). So the following pages can use this information.
    If I can not do it this way, is there any other way to do it?
    Thanks in advance.
    var net = new ActiveXObject("wscript.network");
    alert(net.UserName);
    In managed-beans.xml
    <managed-bean>
    <managed-bean-name>BasicInfo</managed-bean-name>
    <managed-bean-class>treepractice.BasicInfo</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

    You can find more information/details/examples at their own website.
    On the other hand, do you realize that that ActiveX stuff is IE proprietary? And that it is a browser configuration whether to allow them or not? And that this configuration is in IE7 defaulted to an (annoying) warning box before execution which is just bad for the user experience?
    With other words, forget that ActiveX garbage. Alternatives are Applets (not recommended) or Java Web Start (recommended).

  • Trying to call stateless session bean from MDB

    Folks,
    Am working on RAD and WAS 8.
    I have an MDB. And a stateless session bean (AOBean under EJB project).
    While the listener listens to the messages from queue, it also tries to persist to db. I want to achieve this via a method of AOBean (through instantiating session bean or by injection).
    I have been sucessful by invoking a method from AOBean class -  that method just returns a string (without any objects being passed)
    Problem:
    I am getting IllegalStateException when I try to invoke a method of AOBean class, that has an object as a parameter
    For eg:
    MDB
    @EJB(name="ejb/TransactionMgrAOBean", mappedName="ejb/TransactionMgrAOBean")
    ITransactionMgrAO tranAO;
        public void onMessage(Message message) {
         TextMessage textMessage = (TextMessage) message;
         boolean status = false;
      try {
       TransactionVO tranVO =  getTransactionVO();//Here building the object to be passed to session bean
       String status1  = tranAO.getVersion(tranVO);
      }catch(Exception e){
    AOBean
    @Stateless
    @Remote({ ITransactionMgrAO.class })
    @WebService
    public class TransactionMgrAOBean {
    public String getVersion(TransactionVO tranVO) throws Exception{
      try{
    //business logic 
      } catch(Exception e){
      throw e;
      return true;
    TransactionVO implements Serializable has also inner static classes that are not Serializable.
    EXCEPTION: At runtime we are getting exception saying that the inner classes are not serialized.
    REASON why we are invoking session bean from MDB? We found that if we invoke any service from AOBean the transaction management was successful. We are using sessionContext.setRollBackonly when an exception occurs. Tranasactions are not rolled back when any db exception occurs if we invoke business logic methods from Model layer of another NON-EJB package.
    Hope I have provided enough information!

    My concret problem is that I want to call an ejb session contained in an ejb project from a session bean in a different web project. When I include the code in my web session bean I get the error adjunted:
    - Code:
    @EJB
    private UserRemote userSessionBean;
    - Error:
    Exception Details: javax.naming.NameNotFoundException
    pac.UserRemote#pac.UserRemote not found
    Possible Source of Error:
    Class Name: com.sun.enterprise.naming.TransientContext
    File Name: TransientContext.java
    Method Name: doLookup
    Line Number: 216
    Any suggestion?

Maybe you are looking for