Jar working : through JNLP not working-Collection of common programming errors

I have created a java SE application that uses the mysql database using mysql java connector.I have hosted the apache and mysql server on ubuntu.

I have my .jar file on the apache server and also the jnlp,

When I simply download the jar file and run it, it seems to work, but, when I am trying to use it through jnlp the first view comes up then when I enter my username and password and click the login button it just stops there

Here is my JNLP file



    
        MyProject
        abd
        
        
    
    
        
        
    
    
    

Please let me know what it the error. On the server I have 80 8080 and 3306 ports as public ports.

as I said I can update the database using the jarfile that I downloaded from the server but when I try to run the file through JNLP I freezes.

I saw the exception in java console it says

Exception in thread “AWT-EventQueue-0” java.lang.ExceptionInInitializerError at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:286) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at MyProject.database.connect(database.java:27)

Caused by: java.security.AccessControlException: access denied (“java.util.PropertyPermission” “file.encoding” “read”) at java.security.AccessControlContext.checkPermission(Unknown Source)

I cant figure out what the problem is? do I need some port open for JNLP or anything.

Any help appreciated.

Thanks

  1. Three things that come to mind:

    1. You need to sign the jar for javawebstart to allow access to sockets.
    2. You are obviously trying to connect to a mysql DB, it is unclear from your description where this db is and if connection to the host is allowed.
    3. did you bundle the mydql driver in your jar ? or is it referenced somehow ?
  2. do I need some port open for JNLP or anything.

    Only if you’ve configured JNLP to use a non-standard port.

    It is hard to remotely diagnose what is going on here. You probably need to figure out at what point the freeze is occurring. Is it during the JNLP application download phase? While the JVM is loading your classes? During application initialization? In the last case, can you identify where the application is freezing; e.g. by taking a thread dump?

    The ExceptionInInitializerError exception is a good start. Somewhere in that stack trace there should be another “cause” exception that should give you a big clue as to what the real problem is.

    (My guess is that some firewall somewhere is blocking access on port 3360. Can you connect to the database from the client machine using the command line SQL tool, or is that blocked too?

    On second thoughts, the signing issue is a more plausible explanation, especially if the SQL tool works.)

    There are many tutorials on the web on how to sign a JAR file. For example:

    • http://docs.oracle.com/javase/tutorial/deployment/jar/signing.html

Originally posted 2013-11-09 19:43:04.