Calling applet methods in forms - Problem

I have an applet method wich creates a modal dialogue to retrieve user pin. This method is called from a form button. When the user is finished entering PIN, and the dialogue is supposed to close, it hangs. When using a button in an applet frame, this works fine, but apparently it doesent when I use my form button. Anybody have a workaround or solution to my problem?

i guess the problem is that you can't do anything in the applet outside the dialog if it is modal and visible.
Propably you should not make your dialog modal and just let it set a boolean variable when it is finished and keep the rest of the applet waiting for an answer with domething like:
while(dialogstillopen)
boolean dummy=false;

Similar Messages

  • Call applet methods from Javascript

    Hello,
    If I call applet method like :
    function callbackFunc(){
        var pp = appletID.getData();
        alert(pp);
    It works only if applet is deployed with <APPLET> tag or with javascript.
    If applet is deployed using <Object> and <embed> tags, in browser console the error is :
    TypeError: appletID.getData is not a function
    I couldn't find why is that behaviour. What do I do wrong?
    Thanks

    Hi Paul,
    (1)Seems to be your Java Runtime Environment path is still setted for JRE 1.3.0_01 and not for 1.3.1. So pelase go to the
    Control Panel-->java plugin 1.3.1-->Advanced. Here you set the Java Runtime Environment to the JRE 1.3.1 version. Its better to remove the older version before installing the new version on JRE.
    (2)<OBJECT> tag won't work for Netscape. You can only use <APPLET> or <EMBED> tag for Netscape.
    Hope this will help you.
    Anil
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • Problem calling applet method using IE

    I've searched through the forum and can't seem to find anything that can help me fix this. I'm trying to call an applet's method using Javascript. This is working fine under Netscape, but not IE. Everything I've read seems to indicate that I'm doing this right, but I'm getting "Object doesn't support this property or method" when I try to call the applet method from IE.
    In this example method, I'm trying to call the applet's countChars method, which should return the length of the string you pass into it. Works under Netscape 6.2, but not IE 6.0
    Here's my applet code:
    import java.lang.String;
    public class test extends java.applet.Applet {
    public static int countChars(String s) {
    return s.length();
    And my HTML
    <HTML>
    <HEAD>
    <script language="Javascript">
    function refreshApplet()
    /*     i = document.forms.myForm.TestApplet.countChars();
         document.forms.myForm.output.value=i; */
         document.forms.myForm.output.value=document.applets["TestApplet"].countChars(document.forms.myForm.input.value);
    </script>
    </HEAD>
    <BODY>
    <APPLET CODE = "test.class" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" scriptable="true">
    </APPLET>
    <br>
    <form name="myForm">
    <input type="text" name="input">
    <input type="button" value="click me" onClick="refreshApplet();">
    <hr>
    <input type="text" name="output">
    </form>
    </BODY>
    </HTML>
    Thanks in advance!
    Craig Drabik
    Sr. Programmer/Analyst
    University at Buffalo

    I have very similar problem, my applet works OK using Netscape (6.2 and 7.0), but with IE 6.0 It only works with windows XP;
    The reported error is "Object doesn't support this property or method"
    Can someone please help me to solve this problem.
    Cheers
    Horus
    This is my code:
    - I call the applet using javaScript and input the method setData with two strings.
    function graphic()
         var dataZenith;
         var dataManual;
         initVariables();
         dataZenith = graphicZENith(); //Call other Javascript functions
         dataManual = graphicManual(); //Call other Javascript functions
         document.AppletOne.setData(dataZenith,dataManual);
    I run the applet with this HTML code:
    <applet NAME="AppletOne" code="Appl.class" width="450" height="450"
    MAYSCRIPT></applet>
    //Applet code/////////////
    import java.awt.*;
    import java.awt.geom.*;
    import java.applet.*;
    import java.util.*;
    public class Appl extends Applet {
         private int [] myArray1 = new int [156];     
         private int [] myArray2 = new int [156];
         private boolean flag = false;
         // maxDataYAxesNumber es usado para dividir el eje de las Y
    public void init()
              setFont(new Font("SansSerif", Font.BOLD, 12));
              setBackground (Color.white);
              setSize(getSize());     
    // Get data and put in an array
    public void setData(String data1, String data2)
              final String DELIMITER = ",";
              final StringTokenizer theTokens1 =
                   new StringTokenizer(data1, DELIMITER);     
              final StringTokenizer theTokens2 =
                   new StringTokenizer(data2, DELIMITER);
              try
                        String dataX = data1;
                        for (int i = 0; i < 156; i++)
                        myArray1[i] = Integer.parseInt(theTokens1.nextToken().trim());
                        myArray2[i] = Integer.parseInt(theTokens2.nextToken().trim());
              catch (NumberFormatException e) {};
              flag = true; //I get the data OK
              repaint();
    public void paint (Graphics g){
    Graphics2D g2d = (Graphics2D)g;
    setData(data1, data2) ;
    if (flag == true)
                   //Call other functions to process the graphic
    else g2d.drawString(" Sorry I can get Data", 100,80);          

  • CALLING A REPORT FROM FORMS (PROBLEM)

    MY PROBLEM IS THE NEXT:
    I CREATED A MASTER-DETAIL REPORT CALLING 'ASUNTOS'WITH THE NEXT QUERY:
    SELECT ABOGADOS.APELLIDO_P,ABOGADOS.APELLIDO_M,ABOGADOS.NOMBRES,
    ASUNTOS.EXP_INT,ASUNTOS.MATERIA,ASUNTOS.GERENCIA,
    ASUNTOS.EMPRESA,ASUNTOS.RECLAMA,ASUNTOS.PESOS,
    ASUNTOS.DOLARES
    FROM ABOGADOS,ASUNTOS
    WHERE ABOGADOS.FICHA = ASUNTOS.F_ABOG
    AND ASUNTOS.F_ABOG = :ABOGADO ;
    -- ABOGADO = PARAMETER.
    THIS REPORT WORKS FINE THE PROBLEM IS WHEN I TRY CALL THIS REPORT FROM FORM I'VE USE A BUTTON(WHEN_BUTTON_PRESSED) WITH THE NEXT CODE:
    DECLARE
    LISTA PARAMLIST := GET_PARAMETER_LIST('ABOG');
    BEGIN
    IF ID_NULL(LISTA) THEN
    LISTA := CREATE_PARAMETER_LIST('ABOG');
    ADD_PARAMETER(LISTA,'DESTYPE',TEXT_PARAMETER,'PRINTER');
    ADD_PARAMETER(LISTA,'DESNAME',TEXT_PARAMETER,'LPT2');
    ADD_PARAMETER(LISTA,'ABOGADO',TEXT_PARAMETER,TO_CHAR(:ASUNTOS.F_ABOG));
    -- ADD_PARAMETER(LISTA,'PARAMFORM',TEXT_PARAMETER,'YES');
    END IF;
    RUN_PRODUCT(REPORTS,'ASUNTOS',SYNCHRONOUS,RUNTIME,FILESYSTEM,LISTA,NULL);
    END;
    BUT THE REPORT NOTHING DISPLAY.
    THERE ARE SOMETHING WRONG WITH THE CODE IN THE BUTTON

    Roberto,
    Does your report work when it is not called from Forms?
    try the following:
    [TOOLS_HOME]\BIN\RWRUN60 module=ASUNTOS destype=screen userid=<username>/<password>@<tns> ABOGADO=<some_valid_code>
    where TOOLS_HOME is the directory where Reports is installed.
    I can see nothing wrong with your code.
    Maybe some error in the query?
    Also, I would check for the existence of multiple ASUNTOS report definitions. Maybe Forms is calling an older one.
    Hope this helps,
    Pedro das Neves
    ([email protected])

  • Call Applet method from JavaScript, tiny test program works... SOMETIMES!?

    I have an embedded Applet in a web page, and I am trying to directly call a method in that Applet from the same page, using JavaScript.
    Here is the complete Applet:
    import java.applet.Applet;
    public class Test extends Applet {
      public String test() {
        return "test() method return value";
    }Here is the complete web page:
    <HTML>
    <HEAD><TITLE>Applet Invocation test</TITLE></HEAD>
    <BODY>
    <APPLET CODE="Test" WIDTH=10 HEIGHT=10 NAME="test"></APPLET>
    <HR>
    <SCRIPT>
    document.write( "JavaScript is working<br>" );
    document.write( document.test.test() );
    </SCRIPT>
    </BODY>
    </HTML>Is there anything wrong with this? Because it works about 15% of the time, displaying an <HR>, "JavaScript is working", and then "test() method return value" on the next line.
    The other 85% of the time, it just gets to "JavaScript is working", then I get a JavaScript error "Object does not support this property or method" for the line: document.write( document.test.test() );
    Now here's another weird quirk... I can get it to work ALL the time, if I delay the execution of the Applet method. For example, if the first line after <SCRIPT> is alert( "alert" ); then the user gets a little dialog box with "alert" message in it, and when they hit OK execution continues, and the applet method call ALWAYS works. (On a side note, if I make the Applet test() method static, it NEVER works. Why is this?)
    So it seems to me, that when it is failing, it is because the Applet is not completely loaded into the browser yet. My question is, how can I get around this?? Is there a way to instruct JavaScript to wait until the Applet is finished loading before attempting to call any methods on it?
    PS I am using Windows ME and IE 6

    Thanks for the reply, I appreciate it. I have another question, if you don't mind... here is what my new test web page looks like:
    <HTML>
    <HEAD>
    <TITLE>Applet Invocation test</TITLE>
    <SCRIPT>
    function testFunc()
      document.write( document.test.test() );
    </SCRIPT>
    </HEAD>
    <BODY onLoad="testFunc()">
    <APPLET CODE="Test" WIDTH=10 HEIGHT=10 NAME="test">
    </APPLET>
    <HR>
    </BODY>
    </HTML>What happens is: the page loads, I see a 10x10 grey applet box, and a <HR>... then a split second later, onLoad is fired, and everything on the page so far is REPLACED with the output of testFunc(), so the ONLY thing on the page after this all completes is "test() method return value"
    Why is a single document.write() statement CLEARING the page before outputting? I don't understand. If calling a document.write() from an onLoad event wipes out everything on the page, this is not extremely helpful solution.

  • Call applet method with arguments from JavaScript

    I have an applet with a method doSomething(int a, String b, double c), I want get a,b,c from threee text fields put into an HTML page, and pass them to the applet method. I've a very poor knowledge in JavaScript, how can I pass correctly the arguments without raise a CastException? It seems to me that JavaScript doesn't have int, String, double.....

    Hi!
    You can verify before you send the parameters to the applet
    Something like that:
    var result = parseInt (a);
    if (result =NaN)
    alert("Sorry not Int");
    return false;
    and after that you can send the parammeters to the applet that way:
    document.yourApplet.Your_function_from_applet(result,..)
    hope this help!
    adina

  • Call applet method with javascript

    my html - code:
    <APPLET NAME="Mail" ... ... ></APPLET>
    <form action="javascript:document.applets("Mail").test("Execute JAVA Applet Function")">
    <input type="submit" value="Execute Applet Function">
    </form>
    my applet code:
    public void test(String t)
    {System.out.println("executing test()");
    teststr = t;
    repaint();
    in the paint() method i draw the teststr with Graphics.drawString - but nothing happens...
    any suggestions?
    thx

    Directly calling a Java Applet's public method from within
    JavaScript is made possible by LiveConnect which is not implemented by Internet Explorer as of yet. LiveConnect is only available on Netscape navigator at this time.

  • Can javascript call applet methods in explorer??

    Is it possible to call the start() and stop() methods of an applet in explorer 5? I know how to do it using netscape, document.appletname.start(); and that works, but I just get errors in explorer. Any suggestions?

    The code I used was:
    document.appletname.stop(); or
    document.applets["appletname"].stop();
    Neither worked, I just got this error:
    "Object doesn't support this property or method"
    but I know the applet has a stop() method because I wrote it!

  • Call Applet method from C++. Possible ?

    Hi,
    For all the guru's of JNI and applets...
    I have a (C++) ATL object and an applet in an HTML page in IE 6.0
    Is it possible to invoke a public method of the applet from the ATL object ? ( without involving any Javascript / liveconnect )?
    If so how?
    Basically I'm searching for a workaround to a bug
    http://developer.java.sun.com/developer/bugParade/bugs/4838960.html
    As per the bug evaluation it is caused due to "Pumping messages while
    JavaScript->Java call is being executed"
    Thus I want to somehow send the info directly to java and bypass the Javascript->Java call.
    desparate.....
    TIA
    mqs

    Hi,
    For all the guru's of JNI and applets...
    I have a (C++) ATL object and an applet in an HTML
    page in IE 6.0
    Is it possible to invoke a public method of the applet
    from the ATL object ? ( without involving any
    Javascript / liveconnect )?
    If so how?Yes it is. You create the JVM (a method of the jni)
    ,and then you run the method of the applet on the jvm.
    For the details
    there is a book about the Java Native interface free
    of charge in the sun's website.
    >
    Basically I'm searching for a workaround to a bug
    http://developer.java.sun.com/developer/bugParade/bugs/
    838960.html
    As per the bug evaluation it is caused due to
    "Pumping messages while
    JavaScript->Java call is being executed"
    Thus I want to somehow send the info directly to java
    and bypass the Javascript->Java call.
    desparate.....
    TIA
    mqs

  • Applet fails to call Javascript methods

    I'm trying to implement round-trip javascript to Java to Javascript using LiveConnect, and having a lot of trouble in Firefox. It works perfectly in IE 6. In Firefox, I can successfully call a method of an applet, and get a return value. I have not been able to get the applet to call a Javascript method. I have tried using both the call and eval methods of the JSObject with no luck. Below is my code. Any suggestions would be appreciated.
    Thanks.
    import java.applet.Applet;
    import java.awt.*;
    import netscape.javascript.*;
    public class test extends Applet {
         String message="Hello Universe!";
         JSObject proxy;
         public void paint(Graphics g) {
              g.drawString(message, 20, 20);
         // pass in ref to JS object on which to call method
         public Boolean handshake(JSObject jso) {
              proxy = jso;
              // try just calling straight eval
              proxy.eval("alert('eval')");
              // set up args object to pass to js method
              Object[] args = new Object[1];
              args[0] = "handshake";
              // call method of js object 2 different ways
              proxy.call("callback", args);
              proxy.eval("o.callback('eval')");
              return true;
         // update java display to show JS to J communication
         public void setMessage(String message) {
              this.message = message;
              repaint();
    <html>
    <head>
         <script>
              // js object to receive calls from applet
              function obj() {};
              obj.prototype = new Object();
              obj.prototype.callback = function(arg) {
                   alert("callback: " + arg);
              function doit() {
                   var a = gebi("myApplet");
                   a.setMessage("Goodbye World!");
                   o = new obj();
                   // test that js method works (it does)
                   o.callback("local");
                   // call applet method which should call back to js method
                   var there = a.handshake(o);
                   // show return value from applet method call
                   alert("there: " + there);
              window.onload = doit;
         </script>
    </head>
    <body>
         <applet
              id="myApplet"
              code="test"
              width="400"
              height="50"
              mayscript="mayscript">
         </applet>
    </body>
    </html>Results:
    In both IE and Firefox, the string shown by the applet switches to "goodbye world", the local call to the callback function works, and the call to handshake returns true.
    That's all that works in Firefox.
    In IE, the various calls to the callback method, and to the alert method of the Javascript all work.
    The results are the same whether I run the HTML page as a local file, or through IIS.
    I have also noticed that Firefox seems to hang up, crash, and just have a lot of problems dealing with this code.
    Finally, I am running all of this on XP professional SP1 with J2SE 1.5.0_04-b05 and Firefox 1.07

    Hi,
    Thanks for all your replies. Does this work on Java 5 too? Could you please share the complete code snippet which makes it work? I tried working on yours but no success.
    Regards,
    Alok

  • Can't add list element when calling a method from another class

    I am trying to call a method in another class, which contains code listmodel.addElement("text"); to add an element into a list component made in that class.
    I've put in System.out.println("passed"); in the method just to make sure if the method was being called properly and it displays normally.
    I can change variables in the other class by calling the method with no problem. The only thing I can't do is get listmodel.addElement("text"); to add a new element in the list component by doing it this way.
    I've called that method within it's class and it added the element with no problem. Does Java have limitations about what kind of code it can run from other classes? And if that's the case I'd really like to know just why.

    There were no errors, just the element doesnt get added to the list by doing it this way
    class showpanel extends JPanel implements ActionListener, MouseMotionListener {
           framepanel fp = new framepanel();
           --omitted--
         public void actionPerformed(ActionEvent e){
                  if(e.getSource() == button1){
                       fp.addLayer();
    /*is in a different class file*/
    class framepanel extends JPanel implements ActionListener{
            --omitted--
         public void addLayer(){
              listmodel.addElement("Layer"+numLayer);
              numLayer++;
    }

  • Problem accessing applet methods since 1.4.2_06

    Hello,
    I'm working with ie 6.0
    I'm accessing applet methods from javascript
    My applets were working fine until I installed the JRE 1.4.2_06 (I tested them with JRE 1.4.2_05 and it worked)
    Now, when I call an applet method from javascript, I have a javascript exception, as if the applet is not loaded, but I think it is : I can see it in the traces in the java console !
    I didn't modify the code, just the JRE.
    It doesn't work with jre 1.5 too
    Here a simple sample code that doesn't work with JRE 1.4.2_06 :
    APPLET :
    import java.applet.Applet;
    public class Test extends Applet
         public void test() {
              System.err.println("test");
    HTML :
    <html>
    <body>
    <script language="JavaScript">
         function myTest() {
              document.myform.test.test();
    </script>
    <form name="myform">
    <OBJECT NAME="test" WIDTH=500 HEIGHT=120 CLASSID="CLSID:8AD9C840-044E-11d1-B3E9-00805F499D93">
    <PARAM NAME="code" value="Test.class">
    <PARAM NAME="scripting" value="true">
    </OBJECT>
         <input type="button" value="test !!" onclick="myTest()">
    </form>
    </body>
    </html>
    If you have any suggestion ...
    Thanks

    It should work, what if you try the following:
    html file:
    <html>
    <body>
    <script language="JavaScript">
    function myTest() {
    try{
         document.myform.test.test();
    }catch(e){
         alert(e.description);
    function myTest1() {
    try{
         document.getElementById("test").test();
    }catch(e){
         alert(e.description);
    </script>
    <form name="myform">
    <OBJECT NAME="test" id="test" WIDTH=500 HEIGHT=120 CLASSID="CLSID:8AD9C840-044E-11d1-B3E9-00805F499D93">
    <PARAM NAME="code" value="Test.class">
    <PARAM NAME="scripting" value="true">
    </OBJECT>
    <input type="button" value="test !!" onclick="myTest()"><br>
    <input type="button" value="test with getelementbyID!!" onclick="myTest1()"><br>
    </form>
    </body>
    </html>
    applet:
    import java.applet.Applet;
    public class Test extends Applet{
    public void test() {
         System.err.println("test");
    public void init(){
         System.out.println("this is init");
    When you open the page it should say "this is init" in the java console
    if the test button doesn't work try the getElementById way.

  • Call to Applet Method from JavaScript Failed.

    I Am calling a method from a javascript function from within a web page.
    The page is loaded into a frame. The parent window of the frame has stored a reference to the applet which defines the methods. Note I am treating the reterence to the applet as a global variable. So that I can reference it methods as I navigate from one page to another.
    I have JavaScript objects defined, and I am passing them as parameters to the applet's methods. In java, the JavaScript objects are refererenced as JSObject. When I call a java method passing a JavaScript
    Object I get the following exception. Note Iam using j2sdk1.4.2_01 on a Windows 2000 Professional System. This problem start occurring after the recent Microsoft Worm/Virus a fix was loaded on my system which resulted in the following bug. Could someone please help me.
    java.lang.NullPointerException
         at sun.plugin.javascript.ocx.JSObject.setIExplorerAppletContext(Unknown Source)
         at sun.plugin.com.DispatchImpl.convertParams(Unknown Source)
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
    java.lang.Exception: java.lang.NullPointerException
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)

    A little code snippet would help. I use JSObjects from Java 1.4 no problem and do have all the latest updates. I also have JavaScript calling Java code as well - also with no problem.

  • I have a basic applet method timing problem with Firefox (and Chrome), not IE nor Opera. Works if JavaScript issues windows.alert() prior, fails otherwise.

    I have an applet method, which is invoked from a JavaScript function, that is triggered by the window.onload event. The problem seems to center in the loading of the applet and its methods.
    If I step through the 3 applet acceptance prompts (I chose to use a down-level Java), the applet method is never invoked, nor is an exception raised. How this happens is beyond my understanding.
    As additional information, the Init(), start(), and "desired" Java methods all use the synchronized keyword. This is an attempt to minimize the exposure to a multi-thread environment.
    If I issue a message from JavaScript (via window.alert()) PRIOR to invoking the method, I can get the desired results in special circumstances:
    1) When the alert is presented, Firefox also prompts, SIMULTANEOUSLY, to block/continue the applet (the first of the 3 applet acceptance prompts). I can accept that these are separate threads.
    2a) If I walk through the 3 applet acceptance prompts FIRST, and then hit the OK button on the alert message SECOND, I get the desired results, my applet method executes, and all is well (other than the fact that I would prefer not to have the alert in place at all).
    2b) If I hit the OK button on the alert message FIRST, and then walk through the 3 applet acceptance prompts SECOND, I get the same results as when the page loads WITHOUT the alert, which is the applet method is never invoked, nor is an exception raised. Weird, huh?
    The above problem only occurs when the browser and the applet's URL are loaded for the first time.
    Subsequent invocations (after the page & applet has been loaded initially) do not have the failing symptoms.
    It is my understanding that IE and Firefox (and Chrome and Opera, for that matter) each use the same implementation of JavaScript provided by Microsoft. Please correct me if this information is inaccurate.
    The failing page and it's applet are proprietary; I cannot provide the Internet URL, nor the Java or JavaScript source, to aid in your analysis.

    I can speak to the source code, but have no access to it.
    The current process/thread that invokes an applet method must check to see that the applet is not currently being loaded by another process/thread. If it is being loaded, the current process/thread should block until the load is complete, THEN attempt to invoke the applet method.
    Please forward my concern to a knowledgable developer. The nature of the problem, once identified, can be addressed in a very straightforward manner.

  • Problem calling a method in a servlet witch returns remote ejb

    Hi, I have a problem combining servlets ands ejbs, I expose my problem :
    What I have :
    1 . I have a User table into a SGBD with two attributes login and pass.
    2 . I have a UserBean linked to User table with a remote interface
    3 . I have a stateless UserSessionBean with a remote interface
    4 . I have a UserServlet linked to a jsp page which allows me to add users
    5 . I use Jboss
    What is working ?
    1 - I have a method newUser implemented in my UserSessionBean :
    public class UserSessionBean implements SessionBean {
      private SessionContext sessionContext;
      private UserRemoteHome userRemoteHome;
      public void ejbCreate() throws CreateException {
      // Initialize UserRemoteHome
      // Method to add a new user
      public UserRemote newUser(String login, String password) {
            UserRemote newUser = null;
            try {
                newUser = userRemoteHome.create(login, password);
            } catch (RemoteException ex) {
                System.err.println("Error: " + ex);
            } catch (CreateException ex) {
                System.err.println("Error: " + ex);
            return newUser;
    }2 - When I test this method with a simple client it works perfectly :
    public class TestEJB {
        public static void main(String[] args) {
            Context initialCtx;
            try {
                // Create JNDI context
                // Context initialization
                // Narrow UserSessionHome
                // Create UserSession
                UserSession session = sessionHome.create();
                // Test create
                UserRemote newUser = session.newUser("pierre", "hemici");
                if (newUser != null) {
                    System.out.println(newUser.printMe());
            } catch (Exception e) {
                System.err.println("Error: " + e);
                e.printStackTrace();
    Result : I got the newUser printed on STDOUT and I check in the User table (in the SGBD) if the new user has been created.
    What I want ?
    I want to call the newUser method from the UserServlet and use the RemoteUser returned by the method.
    What I do ?
    The jsp :
    1 - I have a jsp page where a get information about the new user to create
    2 - I put the login parameter and the password parameter into the request
    3 - I call the UserServlet when the button "add" is pressed on the jsp page.
    The Servlet :
    1 - I have a method doInsert which call the newUser method :
    public class UserServlet extends HttpServlet {
        private static final String CONTENT_TYPE = "text/html";
        // EJB Context
        InitialContext ejbCtx;
        // Session bean
        UserSession userSession;
        public void init() throws ServletException {
            try {
                // Open JNDI context (the same as TestClient context)
                // Get UserSession Home
                // Create UserSession
                userSession = userSessionHome.create();
            } catch (NamingException ex) {
                System.out.println("Error: " + ex);
            } catch (RemoteException ex) {
                System.out.println("Error: " + ex);
            } catch (CreateException ex) {
                System.out.println("Error: " + ex);
        protected void service(HttpServletRequest req, HttpServletResponse resp) throws
                ServletException, IOException {
         * Does insertion of the new user in the database.
        public void doInsert(HttpServletRequest req, HttpServletResponse resp) throws
                ServletException, IOException {
            try {
                // Get parameters to create the newUser
                String login = req.getParameter("login");
                String password = req.getParameter("password");
               // Create the newUser
                System.out.println("Calling newUser before");
                UserRemote user = userSession.newUser(login, password);
                System.out.println("Calling newUser after");
            } catch (Exception e) {
        // Clean up resources
        public void destroy() {
    Result :
    When I run my jsp page and click on the "add" button, I got the message "Calling newUser before" printed in STDOUT and the error message :
    ERROR [[userservlet]] Servlet.service() for servlet userservlet threw exception
    javax.servlet.ServletException: loader constraints violated when linking javax/ejb/Handle class
         at noumea.user.UserServlet.service(UserServlet.java:112)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Thread.java:534)
    Constat :
    I checked into my SGBD and the new user has been created.
    The error appears only when the method return Remote ejbs, if I return simples objects (Strings, int..) it works.
    What can I do to resolve this problem ?
    Thank you.

    "Why do you want to servlet to gain access to another EJB through the stateless session bean. Why cant the servlet call it directly ?"
    Because I want to access to the informations included in the entity bean UserBean (which is remote).
    You said that it is a bad design, but how can I access to my UserBean ejbs from the session bean if I don't do that ?
    For example I want a List of all users to be seen in a jsp page :
    1 - I call the method getUserList which returnsan ArrayList of UserRemote.
    2 - I iterate over the ArrayList to get the users parameters to be seen.
    As the other example (newUser), when I do
    ArrayList users = (ArrayList) userSession.getUserList(); with the simple client it works, but in the servlet I got the same error.
    But, if I call directly the findAll method (as you'are saying) in the servlet
    ArrayList users = (ArrayList) userRemoteHome.findAll(); it works...
    I think that if my servlet calls directly entity ejbs, I don't need UserSession bean anymore. Is that right ?
    I precise that my design is this :
    jsp -> servlet -> session bean -> entity bean -> sgbd
    Is that a bad design ? Do I need the session bean anymore ?
    Thank you.

Maybe you are looking for

  • Ftree package in Forms 9i

    In 6i you only have the ability to check if a tree element was selected or deselectd. You cannot check for right mouse click to set a popup menu. You cannot check fo BOTH selected/deselected and double mouse click. Very sad implementation. Has the ft

  • CS3/JS: Code to import x-tagged text into Indesign

    Hi All, Normally we import text as X-Tag using Em Software plugin manually. We developed a script for auto-pagination in Indesign. But we couldn't find any JS code to import X-tagged text anywhere. So we used word file to import but facing lot of iss

  • Legend behavior when switching between plots in graph.

    I am trying to plot two plots on a single XY graph. The user should be able to switch between the individual plots as well as showing them together. I do not use the Plot.Visible property but instead change Plot.Color to transparent to make sure the

  • ADCS add user to group

    Hi Experts, OIM is giving response as "Group does not exist in target system" for add user to group task. But this group is available in AD. Can any one help me to solve it. Process which we followed is defining Group DN using custom adapter (prepare

  • OWB Design Repository Tables

    Hi All, Is there any document from where I can get a decent insight into the OWB design repository tables and their functions. Being a bit more specific, while working in OWB 10gR1 I have experienced situations where a mapping suddenly shows a null p