Connecting to a DB from an Applet

Hi, I'm new to Java so I apologise if this question seems a bit basic.
I want to display some DB contents in an applet using a web browser, but according to my Java 'bible', you cant use the JDBC-ODBC bridge driver from within an applet.
How can I overcome this problem ? It must be pretty simple because surely there are millions of web pages on the net that display DB contents from within Java applets. Or have i got it completely wrong ?
Thanks for your help.

Hi !
One way to do it is to use Servlets.
Like this:
Applet <-> Servlet <-> db
The applet talks to the servlet, then the servlet talks to the db and gets the information and then sends the info back to the applet...
Hope it helps...

Similar Messages

  • JDBC connection to derby from an applet

    I'm doing the JDBC tutorial at java.sun.com
    Everything runs fine from the Netbeans IDE. I'm not sure whether the applet is supposed to work inside the IDE or not, I figure that's meant for the web.
    Within Netbeans, the following URL works:
    String url = "jdbc:derby:C:\\Documents and Settings\\HP_Administrator\\.netbeans-derby\\helpme";
    When I load a webpage with the applet, I get:
    java.SQLException: No suitable driver found for jdbc:derby:C:\Documents and Settings\HP_Administrator\.netbeans-derby\helpme.
    Now, I know it found the driver Class, otherwise I would have gotten Class Not Found -- so I assume its just not making the connect to the database from the applet.
    I have tried many formats for the url --
    String url = "jdbc:derby://localhost:1527/C:\\Documents and Settings\\HP_Administrator\\.netbeans-derby\\helpme";
    String url = "jdbc:derby://localhost:1527/helpme";
    String url = "jdbc:derby:helpme";
    Nothing I've tried has worked. Can someone point me in the right direction please?
    Everything is running on the same machine.

    "No suitable driver" is an error message which can indicate an improper URL. And in your case, you will want to avoid including any reference to the C: drive in your url. The format for the url can also depend upon the database you are using. So for example an mysql url would begin with
    jdbc:mysql://localhost:3306
    String url = "jdbc:derby://localhost:1527/helpme";This suggestions that you may be using a database server called derby which utilizes port 1527 and that your particular database is called helpme.
    In any case you will want to look at documentation for your particular database software ( MSAccess, MySQL, Oracle etc ) to determine how to construct the url.

  • Using POST from an applet

    Hi,
    I need to connect to a URL from my applet and have the results show up in a new browser window. I have to use POST method since I need to submit a lot of parameters with the request. If I could have used GET method instead, this could have easily been accomplished using showDocument method. Even though applets can connect to a URL using POST, I could not locate any information on how to display the results in a new browser window. Anyone know how this can be accomplished?

    To POST data to servlet :
    - get data in applet by using getText() or getSelectedItem ...
    - Open connection by URL class
    - Open outputStream by BufferedWriter class
    - Using write(String) to write data then close the tream
    - to Receive data from servlet : getInputStream by BufferedReader class and then using readLine() to read data .
    - Notice : you must make a protocol for your Applet and Servlet able to interface with it other
    Good luck !

  • How do i make http connection  from an applet to  a servlet

    i am not able to make a http connection from the applet to servlet
    my code for servlet is as follows
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class newDatabaseServlet extends HttpServlet {
    //      Connection con;
    // Statement stmt;
         public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
              resp.setContentType("text/content");
              System.out.println("megha");
              String mthd[] = req.getParameterValues("event");
              System.out.println(mthd.length);
              System.out.println(mthd);
              System.out.println(req.getQueryString());
              // System.out.println("megha");
    PrintWriter fw = new PrintWriter(new FileOutputStream(new File("e:/JRun/servers/default/default-app/mycontent.txt")));
    String s = "this text comes from servlet";
    fw.print(s);
    fw.flush();
              if(mthd[0].equalsIgnoreCase("callEditor")) {
                   openEditor(req,resp);
    public void openEditor(HttpServletRequest req, HttpServletResponse resp) {
         /* try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
         con = DriverManager.getConnection("jdbc:oracle:thin:@pc6:1521:oradba","test","test");
         catch(Exception e) {
              e.printStackTrace();
              try {
                   resp.sendRedirect("/RunApp1.html");
              catch(IOException e) {
                   e.printStackTrace();
    /*try {
         Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("jdbc:oracle:thin:@pc6:1521:oradba","test","test");
         catch(Exception e) {
         e.printStackTrace();
         resp.setContentType("text/html");
         PrintWriter output = resp.getWriter();
         try {
    stmt = con.createStatement();
    String strContent = "select * from edTable where newsid = 2";
    ResultSet rs = stmt.executeQuery(strContent);
    if(rs.next()) {
                   String newsText = rs.getString(2);
    /* StringBuffer buf = new StringBuffer();
                   buf.append("<B>servlet</B>");
                   try {
                   resp.sendRedirect("RunApp");
              catch(IOException e) {
                   e.printStackTrace();
    //               output.println(buf.toString());
    //          output.close();
    my code for applet is
    import javax.swing.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import java.awt.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    public class EdApplet extends JApplet {
    public void init() {
         Container c;
         c = getContentPane();
    JPanel but = new JPanel();
    c.add(but,BorderLayout.NORTH);
    final JEditorPane je = new JEditorPane();
    JScrollPane jsp = new JScrollPane(je);
    HTMLEditorKit ht = new HTMLEditorKit();
    je.setEditorKit(ht);
    je.setEditable(true);
    HTMLDocument mdoc = (HTMLDocument)ht.createDefaultDocument();
    StyleSheet mcontext =mdoc.getStyleSheet();
    je.setDocument(mdoc);
    c.add(jsp,BorderLayout.CENTER);
    JPanel bot = new JPanel();
    c.add(bot,BorderLayout.SOUTH);
    JButton save = new JButton("save");
    but.add(save);
    String str = getInitialText();
         je.setText(str);
         String servletUrl="http://pc7:8100/servlet/newDatabaseServlet";
    try{
                   URL servletURL = new URL(servletUrl);
                   URLConnection servletConnection = servletURL.openConnection();
              servletConnection.setRequestProperty("event","saveText");
              servletConnection.setDoOutput(true);
              servletConnection.setUseCaches(false);
         catch(Exception e) {
    //          je.setText(e.printStackTrace());
         ActionListener lst = new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
                   String save = je.getText();
                   saveText(save,je);
         save.addActionListener(lst);
    //je.setText("<B>this</B>");
    //URLConnection servletConnection = null;
    /* try {
              String servletUrl="http://pc7:8100/servlet/newDatabaseServlet";
              URL myUrl = new URL(servletUrl);
              servletConnection = myUrl.openConnection();
              servletConnection.setDoOutput(true);
              servletConnection.setUseCaches(false);
         /*     BufferedReader br = new BufferedReader(new InputStreamReader(servletConnection.getInputStream()));
    String t = br.readLine();
    je.setText(t);
         catch(Exception e) {
              e.printStackTrace();
    /* ActionListener lst = new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
                   BufferedReader br = new BufferedReader(new InputStreamReader(servletConnection.getInputStream()));
                   String t = br.readLine();
    je.setText(t);
    click.addActionListener(lst);
    /*void String changeText(UrlConnection con) {
    BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream));
    String t = br.readLine();
    return t;
    public String getInitialText()
         //String me = null;
         URLConnection textConnection = null;
         StringBuffer sb = new StringBuffer();
         try {
                   String textUrl="http://pc7:8100/mycontent.txt";
                   URL myUrl = new URL(textUrl);
                   textConnection = myUrl.openConnection();
                   textConnection.setDoInput(true);
                   textConnection.setUseCaches(false);
                   BufferedReader br = new BufferedReader(new InputStreamReader(textConnection.getInputStream()));
                   // me = (String)servletConnection.getContent();
                   String s = null;
                   while((s = br.readLine())!=null) {
                        sb.append(s);
              catch(Exception e) {
                             e.printStackTrace();
                   return sb.toString();
         public void saveText(String saveStr,JEditorPane je) {
              //String saveStr = je.getText();
              //String servletUrl="http://pc7:8100/servlet/newDatabaseServlet?event='saveText'&newsid='2'";
              //String servletGet="http://pc7:8100/servlet/newDatabaseServlet";
              String servletUrl="http://pc7:8100/servlet/newDatabaseServlet";
              //String servletUrl = servletGet + "?"
              //     + URLEncoder.encode("event") + "="
         // + URLEncoder.encode("saveText");
    //     je.setText(servletUrl);
              try {
              URL servletURL = new URL(servletUrl);
              URLConnection servletConnection = servletURL.openConnection();
         //     servletConnection.setRequestProperty("event","saveText");
         servletConnection.setRequestProperty(
         "User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
              //System.out.println("from applet");
              servletConnection.setDoOutput(true);
              servletConnection.setUseCaches(false);
              //Propertiew prop = new Properties();
         //     prop.put("event","saveText");
              PrintStream out = new PrintStream(servletConnection.getOutputStream());
    out.println("event");
    out.close();
         catch(IOException e) {
              je.setText(e.toString());
    kindly tell me what is the error
    what is the best method of doing this
    thanking u in anticipation
    megha sood

    omg O_o
    We cannot debug your code, but:
    Did you try the servlet directly from your browser? Does it work?
    Best regards from Germany,
    r.v.

  • How to connect to the mysql database using applet from remote PC

    Hii All..
    I am also facing a problem.
    My web server and mysql server are running on the same PC.
    when i connect to the database from the same PC.
    Its connection but when i am trying to connect to the database from the different PC its giving error and not finding the driver "com.mysql.jdbc.Driver" because this is there on the server PC and applet runs on the client side..
    So to load the deriver on the client side so that it can run the applet to make the database connection on the remote PC.
    Thanks
    Uttam

    You are missing the library on the client.
    It must be moved to the client.
    Just like any other library that an applet requires.
    And that has nothing to do with JDBC.
    There are certainly way(s) to do it. Perhaps a forum that addresses applets, web usage or guis would provide an answer.

  • Activate a Midlet from an Applet

    Hi,
    I am trying to activate a Midlet from an Applet? Is this possible in any of the latest J2ME releases?
    Using SATSA I am able to send APDU commands from the Midlet to the Applet and start a scenario where my Applet and Midlet exchange information.
    Is this available in the opposite direction. I want that my Applet, when triggered by an event, be able to Activate\Wake Up the Midlet.
    I am a newbie to J2ME and after researching the web, still couldn't find an answer. Thanks for your help.
    Bye.

    You can communicate with servlet from an applet, using URL connection, and then send POST/GET methods through HTTP protocol, here is a code snippet,
    // applet side, this method will send a POST method to the servlet and then get url openstream to read a
    // returned object from the servlet, params should be in the form param1=value&param2=value etc...
    public Object getObjectFromServlet(String servletName,String params) {
        Object object = null;
        try {
          URL url = new URL(codeBase,
                            contextRoot + servletName + params);
          URLConnection con = url.openConnection();
          con.setUseCaches(false);
          InputStream in = con.getInputStream();
          ObjectInputStream result = new ObjectInputStream(in);
          object = result.readObject();
          result.close();
          in.close();
        catch (ClassNotFoundException ex) {
          System.err.println("ClassNotFoundException caught:" + ex.getMessage());
        catch (MalformedURLException ex) {
          System.err.println("MalformedURLException caught:" + ex.getMessage());
        catch (IOException ex) {
          System.out.println("IOException caught:" + ex.getMessage());
        return object;
    //servlet side
    public void doPost(HttpServletRequest request, HttpServletResponse response){
          //Extract all the necessary supplied parameters from the request object and configurations.
           String param1 = request.getParameter("param1");
           String param2 = request.getParameter("param2");
      try {
            ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
            out.writeObject(object);
            out.close();
          catch (IOException ioe) {
            System.err.println("IOException caught:" + ioe.getMessage());
    }

  • Opening a socket from an applet

    I tried to open a socket from an applet to a server on a remote computer and I've got a refusal message.
    When I try it on a server in the local machine, it works.
    What could be the problem ?
    P.S. : when I open the socket from an application in the Java environment, to the same remote server it works ok.

    this is part of the security system built into java and Applets
    unless you sign an Applet it cannot do many "dangerous" things, like..
    access the loacl file system
    connect to any server except the server that it came from

  • Calling a WebService from Java Applet

    Hi all,
    In my application I have 3 projects:
    1. server - for all the business logic.
    2. view - for web app.
    3. swing - for applet.
    In the view project I wrote a WS, and I want to call it from my applet. So I created a WS using the Jdev (10.1.3.2) wizard in the view project (I tested it and it worked fine), and in the swing project I created a proxy for this WS, tested it and it worked fine. Then I created a JAR containing the swing project with the WS proxy classes, opened the Applet and find out that I have some classes missing, so I started adding all the relevant Jars and ended with a ~13MB JAR containing all the swing project jars that in the class path for a simple Applet.
    I know that I'm missing something but I dont know what. Do I really need all those Jars. Is there a simple way to call to a WS via Applet?
    This is the list of all the Jars:
    activation.jar
    commons-logging-api.jar
    commons-logging.jar
    ejb.jar
    http_client.jar
    jaxb-api.jar
    jaxb-impl.jar
    jaxen.jar
    jaxr-api.jar
    jaxrpc-api.jar
    jazncore.jar
    jdom.jar
    jms.jar
    jta.jar
    mail.jar
    mdds.jar
    oc4jclient.jar
    ojdl2.jar
    ojmisc.jar
    ojpse.jar
    oraclepki.jar
    orajaxr.jar
    orasaaj.jar
    orawsdl.jar
    orawsrm.jar
    osdt_cert.jar
    osdt_core.jar
    osdt_saml.jar
    osdt_wss.jar
    osdt_xmlsec.jar
    relaxngDatatype.jar
    saaj-api.jar
    saaj-impl.jar_old
    servlet.jar
    wsclient.jar
    wsdl.jar
    wssecurity.jar
    wsserver.jar
    xdb.jar
    xml.jar
    xmlparserv2.jar
    xsdlib.jar
    By the way at the end of all this annoying process I got the next exception:
    [failed to localize] typemapping.nested.exception.initialization(javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found)
         at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService.java:282)
         at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(BasicService.java:244)
         at com.tm.view.ws.misc.runtime.WSMisc_Service_SerializerRegistry.getRegistry(WSMisc_Service_SerializerRegistry.java:26)
         at com.tm.view.ws.misc.runtime.WSMisc_Service_Impl.<init>(WSMisc_Service_Impl.java:26)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:92)
         at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryImpl.java:121)
         at com.tm.view.ws.misc.WSMiscSoap12HttpPortClient.<init>(WSMiscSoap12HttpPortClient.java:20)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at client.base.connectivity.ClientRequestAgent.runWS(ClientRequestAgent.java:135)
         at client.base.connectivity.ClientRequestAgent.run(ClientRequestAgent.java:44)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Shachar

    Try this:
    1. open the webService data controll in the Data Controls section and drag the method from the webService onto the method call activity in your task flow. This will overwrite the current method property (the one which pints to your bean, make a copy of this entry if you can't reproduce it by hand). This too will create an entry in the pageDef of the method call activity.
    2. reenter (or paste) the original value in the method property, so that it again points to your bean. The entry in the pageDef will remain!
    3. now in the bean method you can access the method via its binding like you access any other method from the binding:
    // GET A METHOD FROM PAGEDEF AND EXECUTE IT
    // get the binding container
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    // get an Action or MethodAction
    OperationBinding method = bindings.getOperationBinding("YourMethodActionNAME");
    if (method == null)
    // handle method not found error...
    // if there are parameters to set...
    Map paramsMap = method.getParamsMap();
    paramsMap.put("param","value")  ;    
    // execute the method
    method.execute();
    List errors = method.getErrors();
    if (!errors.isEmpty())
       // handle errors here errors is a list of exceptions!
    // no error resume normal workTimo

  • Problem in passing vector from an applet to servlet

    Hi,
    I m facing problem in reading an object in the servlet (that i send from an applet). I have used BufferedInputStream ... The servlet reads the object but it takes about 30 seconds to do this ... If i don't use BufferedInputStream, it gives an "error reading inputstream header" ... if i use it, it take 30 seconds ... i m using netscape ent. server 4.0 ...
    Servlet code is as follows :
    try {
    InputStream in = req.getInputStream();
    inputFromApplet = new ObjectInputStream(new BufferedInputStream(in));
    saveVector = (Vector)inputFromApplet.readObject();
    I don't understand why it takes so long ... is there any other way ? Please help on this ... you may email me on [email protected]
    Thanks in advance..

    When you send a Vector through a stream, it must not only pass the Vector itself, but all the objects that the Vector refers to, all the objects that those objects refer to, and so on. Combine all this data with a slow internet connection, and passing what may seem like a small Vector could take minutes or hours.
    Are you sure you're passing a very small amount of data over a fast connection?

  • Calling EJB from an applet in 9iAS Release 2?

    Hello!
    In 9iAS Release 1 it is not so easy to call an EJB from an applet. First the applet needs special privileges and then the applet starts only once. The cause of problem is the implementation of ormi.
    Will 9iAS Rel. 2 support Applets calling EJBs?

    Jeff,
    I am also trying to make an applet client for an EJB deployed to OC4J.
    I modified the java2.policy file as you suggested, but when I tried to run my applet, I
    got the following error:
    java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.util.PropertyPermission tunneling.shortcut read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at java.lang.Boolean.getBoolean(Unknown Source)
         at com.evermind.server.rmi.RMIInitialContextFactory.<clinit>(RMIInitialContextFactory.java:34)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at its.fnd.ejb.EJBHomeFinder.getHomeObject(Unknown Source)
         at its.fnd.flight.ejb.EJBFlightFactory.<init>(Unknown Source)
         at its.fnd.flight.FlightFactory.<init>(FlightFactory.java:97)
         at EJBApplet.jbInit(EJBApplet.java:47)
         at EJBApplet.init(EJBApplet.java:36)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    I am using OC4J (stand-alone) version 9.0.2.0.0 on Solaris 7 and Microsoft Internet Explorer
    5.0 with the java 1.3.1 plug-in.
    Here is the applet code that I use to lookup the EJB home interface:
    Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
    props.put(Context.PROVIDER_URL,"ormi://host:6666/app");
    props.put(Context.SECURITY_PRINCIPAL,"admin");
    props.put(Context.SECURITY_CREDENTIALS,"password");
    Context ctxt = new InitialContext(props);
    Object homeObj = ctxt.lookup("my_bean");
    MyBeanHome home = PortableRemoteObject.narrow(homeObj, MyBeanHome.class);
    The HTML page with the <applet> tag is a static HTML page that is part of OC4J's default
    web application. The applet class file is located in a subdirectory of the default-web-app
    directory. Here is the HTML page...
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <TITLE>
    HTML Test Page
    </TITLE>
    </HEAD>
    <BODY>
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="580" height="450" name="EJBApplet" align="middle" alt="Loading EJBApplet ...">
    <param name="java_code" value="EJBApplet">
    <param name="java_codebase" value="/tests">
    <param name="java_archive" value="xerces.jar,ejb.jar,oc4j.jar,jaas.jar"/>
    <param name="java_type" value="application/x-java-applet;version=1.3">
    <param name="java_scriptable" value="true">
    <table cellpadding="1" bgcolor="#FFFFFF" width="580" height="450">
    <tr><td>
    This is a place for an APPLET.<br>Your browser doesn't support the correct applet java plug-in.<br><br>You can install the correct plug-in from here.<br><a target='_blank' onClick='javascript:self.window.close()' href="/classes/3rdparty/j2re-win-plug-in.exe">Click here to install plug-in.</a><br><br>Or if you have an Internet connection you can install the correct plug-in from here.<br><a target='_blank' onClick='javascript:self.window.close()' href="http://java.sun.com/products/plugin/1.3/plugin-install.html">Click here to install plug-in from Internet.</a><br><br>You can call your System Administrator for assistance.</td></tr>
    </table>
    </object>
    </BODY>
    </HTML>
    I have searched the Internet, and the documentation, and tried several, different things,
    but I can't get it to work.
    Any and all help will be greatly appreciated.
    Thanks,
    Sofia.

  • HowTo talk to a Session bean from an Applet sample app. problem

    Hi!
    When I push the "Call EJB" button in the sample application I get the following exception:
    2005.02.20. 15:49:27 com.evermind.server.rmi.RMIClient createRemoteInvocationHandlerFactory
    WARNING: com.evermind.server.ejb.EJBRemoteInvocationHandlerFactory
    java.lang.ClassNotFoundException: com.evermind.server.ejb.EJBRemoteInvocationHandlerFactory
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.evermind.server.rmi.RMIClient.createRemoteInvocationHandlerFactory(RMIClient.java:427)
         at com.evermind.server.rmi.RMIClient.initHandlerFactories(RMIClient.java:415)
         at com.evermind.server.rmi.RMIClient.<init>(RMIClient.java:61)
         at com.evermind.server.rmi.RMIClient.getInstance(RMIClient.java:464)
         at com.evermind.server.rmi.RMIInitialContext.<clinit>(RMIInitialContext.java:48)
         at oracle.j2ee.rmi.RMIInitialContextFactory.getInitialContext(RMIInitialContextFactory.java:58)
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at oracle.otnsamples.EJBCaller.getInitialContext(Unknown Source)
         at oracle.otnsamples.EJBCaller.callEjb(Unknown Source)
         at oracle.otnsamples.EJBCaller.access$000(Unknown Source)
         at oracle.otnsamples.EJBCaller$2.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 43 more
    javax.naming.NamingException: Lookup error: java.net.ConnectException: Connection refused: connect; nested exception is:
         java.net.ConnectException: Connection refused: connect [Root exception is java.net.ConnectException: Connection refused: connect]
         at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:183)
         at javax.naming.InitialContext.lookup(Unknown Source)
         at oracle.otnsamples.EJBCaller.callEjb(Unknown Source)
         at oracle.otnsamples.EJBCaller.access$000(Unknown Source)
         at oracle.otnsamples.EJBCaller$2.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at com.evermind.server.rmi.RMIClientConnection.connect(RMIClientConnection.java:394)
         at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:80)
         at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:250)
         at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:154)
         ... 26 more
    javax.naming.NamingException: Lookup error: java.net.ConnectException: Connection refused: connect; nested exception is:
         java.net.ConnectException: Connection refused: connect [Root exception is java.net.ConnectException: Connection refused: connect]
         at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:183)
         at javax.naming.InitialContext.lookup(Unknown Source)
         at oracle.otnsamples.EJBCaller.callEjb(Unknown Source)
         at oracle.otnsamples.EJBCaller.access$000(Unknown Source)
         at oracle.otnsamples.EJBCaller$2.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at com.evermind.server.rmi.RMIClientConnection.connect(RMIClientConnection.java:394)
         at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:80)
         at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:250)
         at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:154)
         ... 26 more
    Thanks!

    Refer to the following link for a list of tutorials that will guide you through the steps you have queried about: http://www.oracle.com/technology/tech/java/ejb30.html
    Also, if you are attempting to call a session bean from your applet code you may run into firewall issues depending on your corporate infrastructure. RMI does not run over the ever popular port 80 and therefore is not always open on company firewalls. If you run into trouble you may have to use HTTP Tunneling. A better alternative maybe to call your session bean as a web service which is provided to you by default in the EJB 3.0 spec.

  • Passing input parameters from an applet to a JSP page

    Hello all,
    Yes, its one of these questions which I have tried to find a solution from the already large number of postings but with no luck. I'm still a novice to Java/JSP so bear with me.
    Consider this scenario.
    1. An applet which has two input boxes (say First name and surname). 2. These parameters will be passed to a JSP page (so the applet will call a JSP page).
    3. The JSP will have have the necessary logic (or actually a JavaBean will) to connect to a database and add a new record with these parameters (first name and surname).
    I also need to consider editing/updating the record in the database. So a JSP page will connect to the database, retrieving the required record from the database and then display the parameters back in an applet in two input boxes (first name and surname) to be edited and saved again.
    I have been able to develop a similar application using simple HTML forms to add and update records in a database so I'm not worried about the database connectivity simply the issue of passing parameters from the applet to the JSP page and vice versa (for edit/update).
    Once i've managed to do this with input boxes, I can experiment with the other input types radios, checkboxes, select etc.
    Many thanks in advance,
    Assad

    create an URL object with u'r specified link of the java class and send the parameters..write trhis action in any buttonclick event in u'r applet.

  • Create a new file on server from an applet

    Hello!
    I 'm trying to create a text file on server from an applet, i have permissions to write on server and i'm running in apache, my code is
    public void write () {
    try{
    URL url = new URL("http://localhost/bnm/hello.txt");
    URLConnection urlcon = url.openConnection();
    urlcon.setDoOutput(true);
    urlcon.setUseCaches(true);
    PrintWriter pt = new PrintWriter
    (new OutputStreamWriter (urlcon.getOutputStream()));
    String str = new String(URLEncoder.encode("this is output applet ")) ;
    pt.print(str);
    pt.flush();
    catch(Exception e)
    e.printStackTrace();
    The result is nothing, the file isn�t created, but the code don't throw exceptions.
    Ah! in other example, i can read a file of server fro m the applet, the problem is to write
    Anybody, knows the matter??
    Excuse my poor english :P
    Thanks for all.

    I had the same needs and didn't know whether this was possible, due to applets security restriction. So I searched the Web and found some contradictory information. I will explain what I think is the situation, to give you an answer, but also so that other people can tell me whether I understood correctly.
    1) Unless you sign it, an applet cannot write files directly, either client-side or server-side. All what it can do to access a file server-side (except .jar files ?) is opening a http connection, which allows only to retrieve data. When I try to run code such as yours, I get this exception :
    java.net.UnknownServiceException: protocol doesn't support output
         at java.net.URLConnection.getOutputStream(URLConnection.java:679)
    2) As Ares_Man points out, what it can do is opening a http connection not directly with the file you want, but with a server-side script (JSP, PHP, CGI,...) which will be allowed to write files on the server. You can use POST or GET parameters to pass to the script what you are going to write.
    This simple code worked for me (it executed the script toto.php):
              try{
                   URL toto=new URL(getCodeBase(),"toto.php");
                   InputStream f=toto.openStream();
                   f.close();
              catch(Exception e){
                   e.printStackTrace();
    Probably it's a good idea to do a URLConnection.setCache(false) though, to be sure that the script toto.php will be executed.
    3) I don't know how you can pass serialized objects as parameters. So if more than text informations are to be written, I would tend to make the script store them into a database instead of files. That way, you could pass any SQL query as parameter, maybe along with a password parameter for security. I don't know whether this is secure enough.

  • Saving to the Server from an Applet

    Hi all, I've posted a message similar to this before, but didn't get too far. I need to get an applet to be able to open a new browser window and display a web page containing two images from the applet, and several strings from the applet. I need the user to be able to save the images to their hard drive, and I need to be able to use them in email forms from the web page. I assume I would have to somehow save the images and a text file from the applet to the server. I have sucessfully converted my objects of type Image to .gif files (with help from these forums) now all I need to do is find some way to save them or somehow get them onto the web page. I have looked into using a servlet, and using sockets, with little sucess either way. With sockets I keep getting IOExceptions and it says Connection refused. Here's the code I'm using for sockets.
    Socket socket;
    try {
         socket = new Socket(getCodeBase().getHost(), 8080);
    }catch(UnknownHostException u)
      {socket = null; System.out.println("Socket failed"); }
    catch(IOException i)
      {socket = null; System.out.println("IO Failed"); i.printStackTrace(); }I didn't get very far with Servlets, as for some reason I can't find very much help on them on the web. Any help is greatly appreciated.

    smg123: Well, I've tried modding my policy file on my local machine, I simply gave All Permissions to the directy that contains the applet on my local machine, with no luck. Not sure about signing the applet, if I understand it correctly it seems like that's a bit overkill making the user accept it and such, when all it really needs to do is server side.
    FelipeGaucho: I've looked at the servlet tutorial before, but I'll give it another shot. I can't ditch the applet approach entirely though, there's a ton of work put into the applet already.
    JohanUP: I've tried a bunch of different port numbers, all with the same results.
    Thanks for the tips guys, keep em coming :)

  • Looking up JMS Server from an applet

    Hi!!
    I am trying to lookup a JMS server via an applet using Oracle9i
    Application Server. It's giving Security Access Exception. Can
    anybody help.

    hi,
    if the security exception is coming from the applet side, then you should consider the following:
    Normally for an applet to run in any web server, the database and theweb server should reside in the same machine to avoid a security exception being thrown. If you have the web server residing in different machine than the database then you can either use signed applet or you can use oracle connection manager to make it as a medium between the web server and the database. The connection manager will have to be installed in the same machine where the database resides. For more information on applet security with oracle products, please refer to oracle connection manager reference guide.
    If the security issue is thrown from the JMS side, then you might conside granting your user Advance queing and some java security permissions.
    hope this helps.

Maybe you are looking for

  • Bizarre plug-in behaviour

    Hi all I recently installed Logic etc. on a nice shiny new Mac. Booting up Logic for the first time (and many times subsequently) the Audio Unit Manager (AUM) tells me about various incompatible plug-ins (a few freebies from magazines, no great loss,

  • Maximum open item % and no of days open item in credit management

    Hi Can any body explain how  works " Maximum open item % and no of days open item " after checked in ova8  with examples.in credit management. regards

  • Full screen flash video stutters 15 fps on MacOS X 10.6.4 on MacBook Pro Core i5 (2010)

    Full screen flash video stutters at 15 fps on MacOS X 10.6.4 on my MacBook Pro Core i5 (2010).Regardless of whether I have activated Intel or NVIDIA graphics using gfxCardStatus. Has anyone else seen this?

  • XI - webMethods Adapter

    Looking for pros and cons on XI <> webMethods integration using wM's XI Adapter. This Adapter, per webMethods product info, can be directly installed in XI's Adapter Framework and can process XI messages between XI and webMethods integration server (

  • VL01N Post Goods issue error

    Hi Gurus, In ECC 6.0 version in VL01N t.c. when i press "Post Goods Issue" button i confront following error; Fld selectn for mvmt type 601 / acct 621000 differs for Settlement period (003) Message no. M7093 Diagnosis Comparison of the field selectio