Print at Dec 20, 2025, 6:11:18 AM

Posted by mikeycast at Jun 5, 2012, 8:00:41 PM
Re: Problem using Ant, missing classes
Cool I thought the console and running in terminal had the same effect.
The goal of my work was to add a pannel in SweetHome that would show graphs of measures present in a database. The software making the measures (it is a sensor listener) runs under Linux, and is not necesserily on the same computer than the one running SweetHome. Therefore I made a link between SweetHome and the database, using the .jar mysql-connector-java-5.1.18-bin.jar.

I added this jar with some other to personnalize my pannel in /lib and so added "jcommon-1.0.17.jar", //Monitoring Mode jars
"jfreechart-1.0.17.jar",
"mysql-connector-java-5.1.18-bin.jar",
in the List<String> extensionJarsAndDlls = new ArrayList<String> of the SweetHome3DBootstrap.

I didn't add any package, all the classes I added are in com.eteks.sweethome3d.model and com.eteks.sweethome3d.swing, that's why I think I don't need to add anything in the applicationPackages (please tell me what to add if I have to).

Here is the code I added to the init() function of the classe SweetHome3D.java :

sensors=new ArrayList<Sensor_>();
updatetimer = new Timer();
db = new Database("databaseadress", "..", "..", "..");
myCon=db.connect();

//sensor detecting
Statement myStmt;
try{
myStmt = myCon.createStatement();
String query = "SELECT id,nom FROM capteurs";
ResultSet result = myStmt.executeQuery(query);

while (result.next()){
sensors.add(new Sensor_(result.getInt("id"),result.getString("nom"),myCon));
}

myStmt.close();
}
catch (Exception sqlEx){
}


Here is the error I get when launching in the terminal :

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.eteks.sweethome3d.SweetHome3DBootstrap.main(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at com.mysql.jdbc.Util.stackTraceToString(Util.java:355)
at com.mysql.jdbc.Util.<clinit>(Util.java:120)
at com.mysql.jdbc.NonRegisteringDriver.parseURL(NonRegisteringDriver.java:729)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:296)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.eteks.sweethome3d.io.Database.connect(Unknown Source)
at com.eteks.sweethome3d.SweetHome3D.monitoringModeLoader(Unknown Source)
at com.eteks.sweethome3d.SweetHome3D.init(Unknown Source)
at com.eteks.sweethome3d.SweetHome3D.main(Unknown Source)
... 5 more
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 fr_FR
at com.mysql.jdbc.Messages.<clinit>(Messages.java:61)
... 15 more
Caused by: java.util.MissingResourceException: Can't find bundle for base name com.mysql.jdbc.LocalizedErrorMessages, locale fr_FR
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:705)
at com.mysql.jdbc.Messages.<clinit>(Messages.java:59)
... 15 more


I hope I have given you all you need to fnd the solution... confused, I still can send you some files if you prefer