Results 1 to 16 of 16
  1. #1
    deepakthomas is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default Applet embedded in html code not able to communicate with DB

    For a test project that I am doing, I have a Japplet embedded in a piece of HTML code. The applet has a form which takes some user input through a text box. The data captured needs to be updated into a MySQL table.

    - The applet is displayed properly when the html page is opened in a browser.
    - The codes throws no error on submitting the user entered info.
    - But the table is not getting updated with the data.

    Code used to embed the applet in the html page is as shown below.
    **********************
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
    <applet code="OBSPackage.UserHome" archive="OBSLibrary.jar" width="1500" height="600"></applet>
    </body>
    </html>
    **********************

    The code inside the applet that updates the data into the table is as shown below.
    **********************
    int rs1=d.putData("insert into reg(uname,address,phno,email)values('"+name+"','"+ address+"','"+ph+"','"+email+"')");
    int rs2=d.putData("insert into login(username,password)values('"+username+"','"+p ass+"')");
    JOptionPane.showMessageDialog(this,"Registered Successfully");
    **********************
    NOTE: The data insertion is working properly when the applet is run independently in the applet viewer. The issue is only when it is accessed through a browser.

    What can i do to resolve the situation? I am using Netbeans.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,085
    Rep Power
    20

    Default Re: Applet embedded in html code not able to communicate with DB

    Please use [code] tags [/code] when posting code.
    Most people won't bother with unformatted code.

    Please show your JDBC code.

    Where is your MySQL database?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    deepakthomas is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default Re: Applet embedded in html code not able to communicate with DB

    Quote Originally Posted by Tolls View Post
    Please use [code] tags [/code] when posting code.
    Most people won't bother with unformatted code.

    Please show your JDBC code.

    Where is your MySQL database?

    Thanks Casper for the swift response and the etiquette suggestions.

    - Here is my jdbc code
    Java Code:
    public DBcon() {
            try {
                Class.forName("com.mysql.jdbc.Driver");
                Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db", "root", "deepak");
                st = con.createStatement();
            } catch (Exception e) {
                System.out.println("Error" + e);
            }
        }
    - I am using Netbeans to create the applets. The MySQL DB is in the same machine, in the default location (programfiles/mysql/data). The netbeans project is saved in 'My Documents'. I am able to access the DB when I run the applet through appletviewer, but not when called through a browser.

    Thanks again for your time!

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,085
    Rep Power
    20

    Default Re: Applet embedded in html code not able to communicate with DB

    "Casper"?
    I see no ghost, friendly or otherwise.
    :)

    I'm going to guess at security restrictions.
    Get that connection code to throw a runtime exception in that catch block and see what happens.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    deepakthomas is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default Re: Applet embedded in html code not able to communicate with DB

    My Mistake 'Friendly ghost' !!

    I have already enabled an exception clause as you see from the code i posted. This process is executed without any error when i run on applet viewer.
    On browser also it is getting executed without throwing any exception.

    Did I get your suggestion wrong??

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,085
    Rep Power
    20

    Default Re: Applet embedded in html code not able to communicate with DB

    Applet viewer does not have security restrictions, there is no sandbox, so you will not get any access problems with it.
    It cannot be used to check permissions are correctly set.

    Change that catch block to:
    Java Code:
    } catch (Exception e) {
       throw new RuntimeException("All gone wrong");
    }
    I don't know, for an applet, where sysout goes to, but the above will register quite clearly if there is an exception.

    I'm not saying this is the problem, but it's nice to rule things out.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,404
    Rep Power
    20

    Default Re: Applet embedded in html code not able to communicate with DB

    Quote Originally Posted by Tolls View Post
    I don't know, for an applet, where sysout goes to
    It goes to the browser's Java console. For recent versions, the Windows setting for whether the console opens when an Applet is launched is to be made from the Java control panel. Don't know what the Linux/MacOS equivalent would be.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #8
    deepakthomas is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default Re: Applet embedded in html code not able to communicate with DB

    Quote Originally Posted by Tolls View Post
    Applet viewer does not have security restrictions, there is no sandbox, so you will not get any access problems with it.
    It cannot be used to check permissions are correctly set.

    Change that catch block to:
    Java Code:
    } catch (Exception e) {
       throw new RuntimeException("All gone wrong");
    }
    I don't know, for an applet, where sysout goes to, but the above will register quite clearly if there is an exception.

    I'm not saying this is the problem, but it's nice to rule things out.

    I did embed that throw statement and enabled the console as well. Below is the output copied from the console.

    Java Code:
    Java Plug-in 10.7.2.11
    Using JRE version 1.7.0_07-b11 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\szachari
    ----------------------------------------------------
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    q:   hide console
    r:   reload policy configuration
    s:   dump system and deployment properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    ----------------------------------------------------
    cache: Initialize resource manager: com.sun.deploy.cache.ResourceProviderImpl@98b13b
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
    security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
    security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
    security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
    security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
    security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
    security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
    basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@d5b111
    basic: Plugin2ClassLoader.addURL parent called for http://localhost:8080/OBSWeb/OBSLibrary.jar
    security: Blacklist revocation check is enabled
    security: Trusted libraries list check is enabled
    network: Cache entry found [url: http://localhost:8080/OBSWeb/OBSLibrary.jar, version: null] prevalidated=false/0
    cache: Resource http://localhost:8080/OBSWeb/OBSLibrary.jar has expired.
    network: Connecting http://localhost:8080/OBSWeb/OBSLibrary.jar.pack.gz with proxy=DIRECT
    network: Connecting http://localhost:8080/ with proxy=DIRECT
    network: Connecting http://localhost:8080/OBSWeb/OBSLibrary.jar with proxy=DIRECT
    network: ResponseCode for http://localhost:8080/OBSWeb/OBSLibrary.jar : 200
    network: Encoding for http://localhost:8080/OBSWeb/OBSLibrary.jar : null
    network: Disconnect connection to http://localhost:8080/OBSWeb/OBSLibrary.jar
    CacheEntry[http://localhost:8080/OBSWeb/OBSLibrary.jar]: updateAvailable=true,lastModified=Thu Oct 04 16:36:14 IST 2012,length=157898
    network: Connecting http://localhost:8080/OBSWeb/OBSLibrary.jar with proxy=DIRECT
    network: Downloading resource: http://localhost:8080/OBSWeb/OBSLibrary.jar
    	Content-Length: 157,996
    	Content-Encoding: null
    network: Wrote URL http://localhost:8080/OBSWeb/OBSLibrary.jar to File C:\Documents and Settings\szachari\Local Settings\Application Data\Sun\Java\Deployment\cache\6.0\53\326206b5-309a84d9-temp
    security: Trusted libraries list file not found
    cache: Replacing MemoryCache entry (cnt=0) for http://localhost:8080/OBSWeb/OBSLibrary.jarwas=com.sun.deploy.cache.CacheEntry (12545731) now=com.sun.deploy.cache.CacheEntry (59518)
    security: Accessing keys and certificate in Mozilla user profile: null
    security: Loading Deployment certificates from C:\Documents and Settings\szachari\Application Data\Sun\Java\Deployment\security\trusted.certs
    security: Loaded Deployment certificates from C:\Documents and Settings\szachari\Application Data\Sun\Java\Deployment\security\trusted.certs
    security: Loading certificates from Deployment session certificate store
    security: Loaded certificates from Deployment session certificate store
    security: Validate the certificate chain using CertPath API
    security: Loading Root CA certificates from C:\Program Files\Java\jre7\lib\security\cacerts
    security: Loaded Root CA certificates from C:\Program Files\Java\jre7\lib\security\cacerts
    security: Obtain certificate collection in Root CA certificate store
    security: Obtain certificate collection in Root CA certificate store
    security: Obtain certificate collection in Root CA certificate store
    security: Obtain certificate collection in Root CA certificate store
    Ignored exception: java.security.cert.CertificateException: Your security configuration will not allow granting permission to self signed certificates
    basic: Dialog type is not candidate for embedding
    security: Certificate revocation enabled. Disable security validation optimizations.
    network: CleanupThread used 6756339 us
    security: Validate the certificate chain using CertPath API
    java.security.cert.CertificateException: Your security configuration will not allow granting permission to self signed certificates
    	at com.sun.deploy.security.TrustDecider.validateChain(Unknown Source)
    	at com.sun.deploy.security.TrustDecider.isAllPermissionGranted(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.isTrustedByTrustDecider(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.getPermissions(Unknown Source)
    	at java.security.SecureClassLoader.getProtectionDomain(Unknown Source)
    	at java.security.SecureClassLoader.defineClass(Unknown Source)
    	at java.net.URLClassLoader.defineClass(Unknown Source)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.access$100(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    network: Cache entry not found [url: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar, version: null]
    network: Connecting http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar with proxy=DIRECT
    network: Connecting http://localhost:8080/ with proxy=DIRECT
    java.io.FileNotFoundException: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar
    	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    	at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
    	at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
    	at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
    	at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
    	at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
    	at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
    	at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
    	at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
    	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)
    	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader$4.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Unknown Source)
    	at Database.DBcon.<init>(DBcon.java:23)
    	at OBSPackage.Test.<init>(Test.java:12)
    	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 com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$200(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(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)
    network: Cache entry not found [url: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar, version: null]
    network: Connecting http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar with proxy=DIRECT
    network: Cache entry not found [url: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar, version: null]
    network: Connecting http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar with proxy=DIRECT
    java.io.FileNotFoundException: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar
    	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    	at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
    	at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
    	at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
    	at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
    	at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
    	at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
    	at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
    	at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
    	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)
    	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader$4.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Unknown Source)
    	at Database.DBcon.<init>(DBcon.java:23)
    	at OBSPackage.Test.<init>(Test.java:12)
    	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 com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$200(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(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)
    network: Cache entry not found [url: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar, version: null]
    network: Connecting http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.18-bin.jar with proxy=DIRECT
    network: Cache entry not found [url: http://localhost:8080/OBSWeb/, version: null]
    network: Cache entry not found [url: http://localhost:8080/OBSWeb/com/mysql/jdbc/Driver.class, version: null]
    network: Connecting http://localhost:8080/OBSWeb/com/mysql/jdbc/Driver.class with proxy=DIRECT
    basic: exception: java.lang.reflect.InvocationTargetException.
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    	at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.runOnEDTAndWait(Unknown Source)
    	at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.instantiateApplet(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.reflect.InvocationTargetException
    	at com.sun.deploy.uitoolkit.impl.awt.OldPluginAWTUtil.invokeAndWait(Unknown Source)
    	... 5 more
    Caused by: java.lang.RuntimeException: All gone wrong
    	at Database.DBcon.<init>(DBcon.java:27)
    	at OBSPackage.Test.<init>(Test.java:12)
    	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 com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$200(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(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)
    Ignored exception: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    basic: Dialog type is not candidate for embedding
    basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@d5b111
    basic: Loading Java Applet Failed...
    security: Reset deny session certificate store

  9. #9
    deepakthomas is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default Re: Applet embedded in html code not able to communicate with DB

    @DarrylBurke
    Thanks much ! That helped.

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,085
    Rep Power
    20

    Default Re: Applet embedded in html code not able to communicate with DB

    Several things (and a mistake from me):
    java.security.cert.CertificateException: Your security configuration will not allow granting permission to self signed certificates

    Pretty self explanatory...your self signed certificate had no effect on the security permissions for your applet.

    java.io.FileNotFoundException: http://localhost:8080/OBSWeb/lib/mys...5.1.18-bin.jar
    Your driver jar file is not on your server.

    Finally my one, where I made a boo boo on the exception by forgetting to include the causing exception:
    Java Code:
    } catch (Exception e) {
       throw new RuntimeException("All gone wrong", e);
    }
    That should tell you the ultimate cause of the exception (apologies).
    Though I expect it's an Exception about not being able to find the driver.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    deepakthomas is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default Re: Applet embedded in html code not able to communicate with DB

    Quote Originally Posted by Tolls View Post
    Several things (and a mistake from me):
    java.security.cert.CertificateException: Your security configuration will not allow granting permission to self signed certificates

    Pretty self explanatory...your self signed certificate had no effect on the security permissions for your applet.

    java.io.FileNotFoundException: http://localhost:8080/OBSWeb/lib/mys...5.1.18-bin.jar
    Your driver jar file is not on your server.

    Finally my one, where I made a boo boo on the exception by forgetting to include the causing exception:
    Java Code:
    } catch (Exception e) {
       throw new RuntimeException("All gone wrong", e);
    }
    That should tell you the ultimate cause of the exception (apologies).
    Though I expect it's an Exception about not being able to find the driver.
    I changed the security configuration and the certificate issue is now resolved.
    But the file not found error is still coming up as shown below. What can I do about that?

    Java Code:
    network: Cache entry not found [url: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.22-bin.jar, version: null]
    network: Connecting http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.22-bin.jar with proxy=DIRECT
    network: Cache entry not found [url: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.22-bin.jar, version: null]
    network: Connecting http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.22-bin.jar with proxy=DIRECT
    java.io.FileNotFoundException: http://localhost:8080/OBSWeb/lib/mysql-connector-java-5.1.22-bin.jar

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,085
    Rep Power
    20

    Default Re: Applet embedded in html code not able to communicate with DB

    Well, is that where the jar file is located on your server?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  13. #13
    deepakthomas is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default Re: Applet embedded in html code not able to communicate with DB

    Yes, thats where it is !

  14. #14
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,085
    Rep Power
    20

    Default Re: Applet embedded in html code not able to communicate with DB

    I'm afraid you might have to prove it, because that error is disagreeing with you.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  15. #15
    deepakthomas is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default Re: Applet embedded in html code not able to communicate with DB

    Quote Originally Posted by Tolls View Post
    I'm afraid you might have to prove it, because that error is disagreeing with you.
    My index.jsp is at "C:\Documents and Settings\szachari\Desktop\OBSWeb\web" and it come up fine when i run it from netbeans. the browser url comes up as "http://localhost:8080/OBSWeb/index.jsp"

    I have the "mysql-connector-java-5.1.22-bin.jar" file also inside the same folder at the physical location "C:\Documents and Settings\szachari\Desktop\OBSWeb\lib". But unfortunately this is not recognized!

    Have even added the classpath correct. Attached is the screenshot.

    Applet embedded in html code not able to communicate with DB-classpath.jpg

  16. #16
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,085
    Rep Power
    20

    Default Re: Applet embedded in html code not able to communicate with DB

    You need to find where the web app is installed.
    That's your IDE project workspace.
    The path to that jar is relative to the webapp, not your project.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. My Applet is giving error with I communicate with servlet.
    By ganesh.gothi@gmail.com in forum Java Applets
    Replies: 3
    Last Post: 05-30-2012, 06:13 PM
  2. Interaction with embedded java applet
    By veggieCoder in forum New To Java
    Replies: 10
    Last Post: 01-12-2012, 07:20 PM
  3. Replies: 12
    Last Post: 07-25-2011, 03:25 PM
  4. Embedded applet in jsp its not working.
    By charmi in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 06-17-2011, 11:22 AM
  5. Replies: 1
    Last Post: 07-06-2007, 05:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •