Print at Dec 20, 2025, 6:40:38 PM
Posted by mikeycast at May 24, 2012, 9:56:07 PM
smile   Problem using Ant, missing classes
Good evening,

I come to ask you a question once more, because I now have an issue building my application with Ant. The build is successful (I tried the jarExecutable and MacOsInstaller preselection with the good VM arguments) but when I launch my application all the functionnalities I added in two new files placed in com.eteks.sweethome3d.swing don't work. Nothing happens when I click on the button I added, when a new window should appear. I precise that appart from the part I added SweetHome is working well.

I checked and my classes are in build/classes. I don't understand why my functionnalities don't work, because Ant is set to pack "all workspace".

Thanks for your help smile ,

Mikaël

Posted by Puybaret at May 25, 2012, 7:04:33 AM
Re: Problem using Ant, missing classes
What exception stack trace do you get in /Applications/Utilities/Console program?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by mikeycast at May 25, 2012, 9:05:53 AM
Re: Problem using Ant, missing classes
When I click on the button I added I get the error (I put what I found pertinent) :

.com.apple.JarLauncher: Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.eteks.sweethome3d.swing.ControllerAction.actionPerformed(Unknown Source)

...

Caused by: java.lang.reflect.InvocationTargetException

...

Caused by: java.lang.NoClassDefFoundError: com/lowagie/text/Elementat com.eteks.sweethome3d.swing.MonitoringFrame.createSensorPagePanel(Unknown Source)

...

Caused by: java.lang.ClassNotFoundException: Class com.lowagie.text.Element
at com.eteks.sweethome3d.tools.ExtensionsClassLoader.findClass(Unknown Source)

Posted by Puybaret at May 25, 2012, 12:06:33 PM
Re: Problem using Ant, missing classes
com.lowagie is the package base of iText library.
Could you check the source code version you use?
Because I remember that I fixed in version 3.5 an issue about iText version that was wrong in SweetHome3DBootstrap.java.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by mikeycast at May 26, 2012, 10:24:03 AM
Re: Problem using Ant, missing classes
Ok this fixes my issue, I just refreshed the file you cited. Now my window is lauching but I have some other issues :

- First, the "é,è,à" characters are not printed well, even though Ant is encoding in UTF-8...

- Secondly, I have a JPanel composed with JCheckBox which is absent sad

Can you continue to help me please? I don't have any error message in the console this time.

Posted by mikeycast at May 31, 2012, 6:10:45 PM
Re: Problem using Ant, missing classes
Hello,

an idea where it can come from? Of why my panel is not showed?

The panel is printed thanks to values from a distant database. Could it be a problem of connexion? Are the supplementary sql packages automatically added by Ant?

Thanks for your help,

Mikael

Posted by Puybaret at May 31, 2012, 8:04:46 PM
Re: Problem using Ant, missing classes
Without source code, it's impossible to be sure. You probably didn't pay enough attention to the encoding of the files that contain accented letters, and executed your plug-in on a different OS.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by mikeycast at Jun 3, 2012, 10:20:48 PM
Re: Problem using Ant, missing classes
Thank you, and what do you think about the sql connection problem?

I've added mysql-connector-java-5.1.18-bin.jar to the libs but Ant may not include it.

Should normally Ant add the .jar I added in /lib or do I have to force it by modifying the build.xml file?

I think about this because the symptoms are the same than when I had some problems connecting to the database.

Anyway, I don't have any messages in the Console.

Posted by mikeycast at Jun 5, 2012, 5:03:52 PM
Re: Problem using Ant, missing classes
Hello, I've juste read the post from Mitsaki and so I've added my packages to the SweetHome3DBootstrap, in the extensionJarsAndDlls array. And thanks to your link I know now that my .jar are included during the building, while they are in /lib.

Still the connection to the database doesn't work and I don't have any messages in the console.

Do you have any ideas of other things to do to make it work?

Please, I have 3 days left to fix it until my presentation...

Posted by Puybaret at Jun 5, 2012, 6:50:45 PM
Re: Problem using Ant, missing classes
You may have to add the packages of your project in applicationPackages of SweetHome3DBootstrap too.
If you have nothing in the console, run in a Terminal window your JAR executable file with command:
java -jar jarExecutableFile.jar
Without source code or a stack trace it will be difficult to help you further. I just can't guess what is wrong. I don't even know why you use a database and how!!!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

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

Posted by Puybaret at Jun 6, 2012, 12:03:27 PM
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

Posted by mikeycast at Jun 6, 2012, 7:33:29 PM
Re: Problem using Ant, missing classes
Unfortunately no it doesn't work.

Posted by mikeycast at Jun 6, 2012, 7:54:46 PM
Re: Problem using Ant, missing classes
And the errors in the terminal are still the same..

Posted by mikeycast at Jun 7, 2012, 12:59:57 PM
Re: Problem using Ant, missing classes
May I send you my source code? Because should have to make it work for tomorrow sad

Thanks

Posted by Puybaret at Jun 7, 2012, 1:30:26 PM
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

Posted by mikeycast at Jun 7, 2012, 6:37:38 PM
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 sad

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...

Thank you very much

Posted by mikeycast at Jun 7, 2012, 8:05:50 PM
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 !! biggrin (I put a System.out.println to tell me it's connected.)
Do you have an idea how the lowagie problem could be solved?

Posted by mikeycast at Jun 11, 2012, 9:13:06 PM
Re: Problem using Ant, missing classes
Hello, I finally presented with Eclipse, but I would have to give a release...

Do you have some fresh ideas ?