France
Joined: May 6, 2012
Post Count: 17
Status:
Offline
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... , I still can send you some files if you prefer
France
Joined: Nov 7, 2005
Post Count: 9420
Status:
Offline
Re: Problem using Ant, missing classes
I'm not sure it will solve your problem but try to add "com.mysql.jdbc" package to applicationPackages array in SweetHome3DBootstrap.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
France
Joined: Nov 7, 2005
Post Count: 9420
Status:
Offline
Re: Problem using Ant, missing classes
You can send me your code, but I'm not sure I'll have the time to look at it. Maybe you could show your application from Eclipse, or deliver it as an application? You can generate a Sweet Home 3D Mac OS X application with macosxInstaller Ant target, after adding the path of the missing libraries in the Classpath array of its Info.plist file. If your additional jars are in the lib directory, there should be no other changes to make!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
France
Joined: May 6, 2012
Post Count: 17
Status:
Offline
Re: Problem using Ant, missing classes
I'll show it from Eclipse if I don't fix it but that's not very serious... I've made a MacOsXInstaller but my panel doesn't launch like at the beginning of this topic (problem you solved in the version 3.5). I've added the 3 lines <string>$JAVAROOT/mysql-connector-java ....jar</string> in the array.
I get the error in the console :
07/06/12 19:28:09,671 [0x0-0x198198].com.eteks.sweethome3d.SweetHome3D: [JavaAppLauncher] Requested [1.5*], launching in [1.6] instead.
It doesn't matter if it is the .jar or an installer, I just would like to launch it without Eclipse
I hope it is just a java version problem and that after it will work..
Or even if you can make it work on Windows it will be enough...
France
Joined: May 6, 2012
Post Count: 17
Status:
Offline
Re: Problem using Ant, missing classes
I'm sorry I don't know why I got this error. In fact it seems that the problem with the .dmg solution is the same than at the beginning of this topic, with the lowagie problem. I get this error in the console :
... [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: ... 39 more 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: Caused by: java.lang.NoClassDefFoundError: com/lowagie/text/Element 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: at com.eteks.sweethome3d.swing.MonitoringFrame.createSensorPagePanel(Unknown Source) 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: at com.eteks.sweethome3d.swing.MonitoringFrame.<init>(Unknown Source) 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: at com.eteks.sweethome3d.viewcontroller.HomeController.monitoringMode(Unknown Source) 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: ... 43 more 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: Caused by: java.lang.ClassNotFoundException: com.lowagie.text.Element 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: at java.security.AccessController.doPrivileged(Native Method) 07/06/12 21:02:26,617 [0x0-0x1de1de].com.eteks.sweethome3d.SweetHome3D: at java.net.URLClassLoader.findClass(URLClassLoader.java:190) ... 46 more
But it seems that the connection to the database is working !! (I put a System.out.println to tell me it's connected.) Do you have an idea how the lowagie problem could be solved?