Im building a java application that uses JDBC to connect to MySQL. I have an ant script that compiles my code and then packages it, along with log4j, junit, libshout-java and the mysql jdbc driver into one executable jar. This all works fine on ubuntu 9.10, and my code connects to mysql and away we go.
However my production env will be solaris (my dev box is ubuntu) and when I came to build and run this on there i had the following errors.
17 [main] DEBUG com.radiobusi.ShoutGen.ParseConfig - [SQL, SELECT * FROM RadioBusi.RadioBusi_song JOIN RadioBusi.RadioBusi_playlist WHERE RadioBusi_playlist.Name = 'Placebo 2';]
18 [main] DEBUG com.radiobusi.ShoutGen.ParseConfig - this is able to be broken up[SQL, SELECT * FROM RadioBusi.RadioBusi_song JOIN RadioBusi.RadioBusi_playlist WHERE RadioBusi_playlist.Name = 'Placebo 2';]
78 [main] ERROR com.radiobusi.ShoutGen - An error occured instantiating the class ShoutGen
java.lang.ExceptionInInitializerError
at com.mysql.jdbc.Util.stackTraceToString(Util.java:351)
at com.mysql.jdbc.Util.<clinit>(Util.java:116)
at com.mysql.jdbc.NonRegisteringDriver.parseURL(NonRegisteringDriver.java:672)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:277)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.radiobusi.ShoutGen.PlayList.<init>(Unknown Source)
at com.radiobusi.ShoutGen.ShoutGen.<init>(Unknown Source)
at com.radiobusi.ShoutGen.ShoutGen.main(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_AU
at com.mysql.jdbc.Messages.<clinit>(Messages.java:60)
... 9 more
Caused by: java.util.MissingResourceException: Can't find bundle for base name com.mysql.jdbc.LocalizedErrorMessages, locale en_AU
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)
at com.mysql.jdbc.Messages.<clinit>(Messages.java:58)
... 9 more
Exception in thread "main" java.lang.NullPointerException
at com.radiobusi.ShoutGen.ShoutGen.main(Unknown Source)
My mysql database locale is en_US on solaris, but my ubuntu mysql database is the also en_US.
Anybody got any idea's?
Im not sure what other information is needed, so if you would like more information just let me know in the comments.
Jars that get packaged
junit-4.8.1.jar
libshout.jar
log4j-1.2.15.jar
mysql-5.1.6.jar
munderwo@opensolaris:~/ShoutGen-Java$ uname -a
SunOS opensolaris 5.11 snv_111b i86pc i386 i86pc Solaris
MySQL Version: MySQL 5.1.30
Cheers
Mark
PS this is a cross post from https://stackoverflow.com/questions/2036507/building-a-jar-with-mysql-jdbc-on-solaris as it kind of blurs the line between programming an sys-admin.
UPDATE 1:
the following ant target is how i packaged my jars. This means that the mysql jar is actually inside the jar and should be available to in automatically
<target name="jar">
<!-- Capture the path as a delimited property using the refid attribute -->
<property name="myclasspath" refid="classpath"/>
<!-- Emit the property to the ant console -->
<echo message="Classpath = ${myclasspath}"/>
<mkdir dir="${jar.dir}"/>
<jar destfile="${dest.file}" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="com.radiobusi.ShoutGen.ShoutGen"/>
</manifest>
<zipfileset src="${lib.dir}/junit-4.8.1.jar" includes="**/*.class"/>
<zipfileset src="${lib.dir}/libshout.jar" includes="**/*.class"/>
<zipfileset src="${lib.dir}/log4j-1.2.15.jar" includes="**/*.class"/>
<zipfileset src="${lib.dir}/mysql-5.1.6.jar" includes="**/*.class"/>
</jar>
</target>