Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default Probelms with the ConnectorJ and exported JAR

    Hi, I am using the connectorj to access a mysql database, which works fine as long as I run the application in eclipse. But if I export it as a runnable Jar I get the following error:

    Null data: com.mysql.jdbc.LocalizedErrorMessages
    Null data: com.mysql.jdbc.LocalizedErrorMessages_en
    Exception in thread "doDealHandThread" java.lang.ExceptionInInitializerError
    at com.mysql.jdbc.Util.stackTraceToString(Util.java:3 53)
    at com.mysql.jdbc.Util.<clinit>(Util.java:118)
    at com.mysql.jdbc.NonRegisteringDriver.parseURL(NonRe gisteringDriver.java:712)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:280)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    ...
    Caused by: java.lang.RuntimeException: Can't load resource bundle due to underlying exception java.util.MissingResourceException: Can't find bundle for base name com.mysql.jdbc.LocalizedErrorMessages, locale en
    at com.mysql.jdbc.Messages.<clinit>(Messages.java:63)
    ... 16 more
    Caused by: java.util.MissingResourceException: Can't find bundle for base name com.mysql.jdbc.LocalizedErrorMessages, locale en
    at java.util.ResourceBundle.throwMissingResourceExcep tion(Unknown Source)
    at java.util.ResourceBundle.getBundleImpl(Unknown Source)
    at java.util.ResourceBundle.getBundle(Unknown Source)
    at com.mysql.jdbc.Messages.<clinit>(Messages.java:61)
    ... 16 more

    I searched the web for hours but I cannot find a solution.
    The only one I found suggests that the connector.jar directory might include illegal characters, but this is not the case.
    Thanks a lot!

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    does the export as executable jar file repackage the mysql .jar file as well, such as create a single jar file with your code and the stuff in the connector-j jar file ?
    Its possible that this operation is not collecting resource bundle (.properties) files from within the connector-j file, and is only copying the .class files.

    Have a look at the contents of your exported jar file and the original connector-j file, and try to manually repackage the jar file by hand to stuff in those resources, if they are missing, to see if that makes it work. If it does, it is likely a setting option or a bug with the eclipse export as executable jar file task.

  3. #3
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default

    Unfortunately, the packages are absolutly identical, there is no difference. I also get the same error if I use Fat Jar.

  4. #4
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default

    Has anyone an idea?
    Thanks a lot, I really do not know what to do.

  5. #5
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default

    Finally, I figured it out, instead of merging the connectorj classes into the jar, I dynamically load the file like in the class given at this forum:

    Java Runtime Environment (JRE) - Modify Classpath At Runtime [Locked]

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default

    Have you checked the manifest in your jar and ensured it has all the required jars in it? Are they in the relative location specified by the manifest?

    ETA: OK, well scratch that then...:)

Posting Permissions

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