Hello all,
There are a few of us that have been having some difficulties with the Java classpath in recent versions of Servoy. Servoy seems to act differently in different situations, but the basic problem is that a bean that references another jar file located in the beans/ directory turns up a NoClassDefFoundError in Java 1.5, and an extremely long stack trace in 1.4…
I am using Servoy R2 2.2.1 build-333, and JRE versions 1.4.2_09 and 1.5.0_05.
In versions previous to build-333 I was able to put a bean (ScheduleCalendar.jar) and a dependency bean (migcalendar.jar) both into the $servoy_home/beans directory and the JVM would pick them both up to work fine. Now the migcalendar.jar seems to be omitted from the classpath when placed in the same directory. I have been forced to put a copy of the migcalendar.jar in the $jre_home/lib/ext directory so that the JVM will find it to use the developer - the problem with that is when using the 1.5 JRE I am also forced to put a copy of migcalendar.jar in the $jre/lib/ext on each client connecting to the solution server… this is a major problem because it destroys the single source distribution/update features that Servoy is known for and requires installation of files for each client.
The manifest file in ScheduleCalendar.jar references migcalendar.jar as a Class-Path entry the same as before.
I haven’t looked yet at the changes in the JRE versions between 1.4 and 1.5, and can’t find the Servoy release notes for any version, but if anyone has suggestions or has experienced the same symptoms I would love to hear about it. I don’t know if this is a bug in Servoy, or a planned “enhancement”, but any help would be appreciated.
As it is I guess I might have to create a separate WebStart installer for the migcalendar.jar for clients.
I hope that I’m just doing something wrong, or that someone will point out a simple fix for this problem…
Here’s a sample stack trace when attempting to open a client connection to a solution with both jar files in the $servoy_home/beans directory:
Java Web Start 1.5.0_05
Using JRE version 1.5.0_05 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Fredric
----------------------------------------------------
Starting Servoy from C:\Program Files\Mozilla Firefox
Servoy R2 2.2.2 build-334 on Windows XP using Java 1.5.0_05
getWebStartURL http://83.245.73.101:8080/
getWebStartURL http://83.245.73.101:8080/
getWebStartURL http://83.245.73.101:8080/
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/miginfocom/util/gfx/geometry/numbers/AtRefRangeNumber
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.reflect.misc.MethodUtil.getMethod(Unknown Source)
at java.beans.ReflectionUtils.findPublicMethod(Unknown Source)
at java.beans.ReflectionUtils.findMethod(Unknown Source)
at java.beans.ReflectionUtils.getMethod(Unknown Source)
at java.beans.Statement.invoke(Unknown Source)
at java.beans.Expression.getValue(Unknown Source)
at com.sun.beans.MutableExpression.getValue(Unknown Source)
at com.sun.beans.ObjectHandler.getValue(Unknown Source)
at com.sun.beans.ObjectHandler.eval(Unknown Source)
at com.sun.beans.ObjectHandler.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at java.beans.XMLDecoder.readObject(Unknown Source)
at com.servoy.j2db.dataui.k.a(Unknown Source)
at com.servoy.j2db.dataui.k.a(Unknown Source)
at com.servoy.j2db.dataui.k.if(Unknown Source)
at com.servoy.j2db.dataui.k.a(Unknown Source)
at com.servoy.j2db.dataui.i.a(Unknown Source)
at com.servoy.j2db.dataui.i.a(Unknown Source)
at com.servoy.j2db.FormPanel.cK(Unknown Source)
at com.servoy.j2db.FormManager.if(Unknown Source)
at com.servoy.j2db.FormManager.a(Unknown Source)
at com.servoy.j2db.FormManager.for(Unknown Source)
at com.servoy.j2db.FormManager.do(Unknown Source)
at com.servoy.j2db.FormManager$3.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Thanks,
Fred
You are referencing a bean which cannot be found anymore…
This is only in your log and the form shows with a bean missing label right?
That is right if I use Java 1.4 to open Servoy Developer.
When using Java 1.5 Web Start to run a client I get the stack trace above and the client hangs with the spinning Servoy logo.
What I am most concerned about is that in order for a Java 1.5 WebStart client to connect to a Servoy Server that has the ScheduleCalendar.jar, I have to copy the migcalendar.jar to that client’s machine where the JRE can see it. If I don’t do that for some reason Java 1.5 does not “see” migcalendar.jar even though it downloads it on startup.
fdoddridge:
…What I am most concerned about is that in order for a Java 1.5 WebStart client to connect to a Servoy Server that has the ScheduleCalendar.jar, I have to copy the migcalendar.jar to that client’s machine…
If you put a bean in the servoy bean dir it will be automatically usable for a Servoy client (Servoy manages the deployment!)
JB,
I think this is the point, it doesn’t!
When a JRE1.42 Webstart starts the client it all works fine. When JRE1.5 client webstarts the stacktrace above occurs.
I’ve checked the .jnlp and the migcalendar.jar is in the “unsigned.jnlp” however unless we manually download the migcalendar.jar file to each client computers "\lib\ext" directory the error occurs resulting in the stacktrace above.
I’ll email you with a server url for you to see the problem yourself.
Cheers,
Lee.
The load problem has 2 origins
-Webstart jar loading behaviour is little different in Java 1.5 as it was in Java 1.4
-You build a bean wrapper in your own jar (enclosing migcalendar)
We hint webstart for faster classloading with a package tag like:
When a bean is loaded from a jar it seems it is not looking longer in other jars when the package hint is to narrow (since com.miginfocom.beans.* is to narrow for com.miginfocom.util.gfx.geometry.numbers.AtRefRangeNumber)
The only thing we could do is to make the package tag optional in the admin page
Hi guys.
I would just like to add that JC did a lot of work getting the classloaders right across Server, Developer and JWS-Client - using 1.4 and 1.5 (when I was preparing my new OLE release and so on)
I was having a number of issues similar in nature to those that fred reports. I now have no issues.
So, if you are running Version R2 2.2.1-build 333 (I have not progressed beyond that release and can’t speak for subsequent servoy builds), then all is good, imho.
As JB has suggested, there are some subtle differences in the way 1.4 and 1.5 JWS downloads libs, but I believe that (at least with build 333) everything works as expected.
cheers
J
Jan Blok:
The only thing we could do is to make the package tag optional in the admin page
Hi Jan, I think that making the package tag optional or disabled by default is a good idea. There doesn’t seem to be any other way to deliver this bean since even if I combine the two jar files into one, the unsigned.jnlp still includes a package tag that is too narrow in scope, preventing all of the dependent classes from being loaded.
<jar href="/beans/ScheduleCalendar.jar" part="ScheduleCalendar" download="eager" version="1133252387500"/>
<package name="com.servoybeans.migcalendar.*" part="ScheduleCalendar" recursive="true"/>
So any classes in the com.miginfocom.* package will not be included even if they are in the same jar.
If you have any suggestions on how to work around this issue for the current Servoy versions I would be grateful.
Thanks,
Fred
If you set the loading of jars in the admin page to eager we already stopped writing package definitions in the jnlp (in Servoy 2.2.3)
Thanks for your help Jan, however I still have some problems with the classpath I hope you can help me with.
This is the situation:
Servoy 2.2.3 build 335
Java 1.4 and Java 1.5
Windows XP Pro and Home
I put ScheduleCalendar.jar and migcalendar.jar in the servoy beans/ directory and start Servoy Developer. The classpath does not include migcalendar.jar, giving a ClassNotFoundException.
I then copy migcalendar.jar to the servoy lib/ directory and restart Developer. This gives the same exception.
The manifest file for ScheduleCalendar.jar specifies a Class-Path: migcalendar.jar - this should tell the classloader to pull in that jar file.
Even when I unpack migcalendar.jar, and include the entire thing in ScheduleCalendar.jar the migcalendar classes are not found. This is very strange behavior, and I wonder if maybe the custom classloaders you use are narrowing the scope of the packages loaded into Servoy?
It seems that the only way to get this to work is to copy migcalendar.jar to the JRE lib/ext directory where it is put in the JVM global classpath, or to add migcalendar.jar to the -classpath line in servoy_developer.bat. Shouldn’t there be an easier way for dependent bean jar files to be included in Servoy’s classpath? It used to work in Servoy versions before 2.2.1…
Thanks Jan,
Fred
Did you set the clientJarLoadOption to “eager” in the admin page?
Without the package tag in the jnlp it works fine for me
Hi Jan, I did set it to eager and the clients seem to load well for me. That part works great, thanks!
The problem I am running into now is with Servoy Developer. It is a less severe problem than the clients, but it would be nice to have a simple way for developers to open the Developer application without putting the migcalendar.jar in their system classpath.
Fred
That something I do not understand, we load all classes in developer found in the “beans” directory jars (with the same classloader, so the classes should be found)
Are you sure all the required classes are in the beans dir?
Yes I can confirm that all the required classes are in the beans folder.
Unless you either do as Fred says (eg in the /ext/ dir) or manually add the “beans/migcalendar.jar” to the batchfile for servoy developer it’ll fail to load.
I’ve not tried with 2.2.3 since I have some major problems with 2.2.3.
Lee.
Don’t you have by accident the ScheduleCalendar.jar somewhere in youre classpath (so not only in the beans dir?
Because if you say even if i put everything in the schedulercalendar.jar it is not found only when i set it in the ext dir it is found.
Then it really looks to me that the bean itself (thats in the schedulercalendar.jar) is loaded through the system classloader. And if that is the case then migcalendar.jar is not searched through because bean loading starts with the classloader the first bean is found and then go from there until the systemclassloader (it doesn’t go up)
johan
I’ll defer that question to Fred… ![Laughing :lol:]()
I’ll reimage a machine, and test on a fresh WinXP install with only one copy of each JAR file…
I’ll post the results when done.
I am miffed: I can not get even the most simple bean to load.
Here is my bean code:
import java.awt.*;
import java.io.Serializable;
public class SimpleBean extends Canvas
implements Serializable
{
//Constructor sets inherited properties
public SimpleBean(){
setSize(60,40);
setBackground(Color.red);
}
}
To complile this:
javac SimpleBean.java
To package the bean:
jar cfm SimpleBean.jar manifest.tmp SimpleBean.class
At this point I copy the bean into the bean folder at
C:\Program Files\Servoy\beans
Now I start Developer. I open my application and invoke the designer.
I select elements->place bean. I am presented with a dialog box that
does not include my bean. When I dump the .log.txt file at this point
I get
2006-03-09 16:14 : Error occured retrieving bean. Bean have been loaded, error: java.lang.ClassNotFoundException: SimpleBean
It seems to me that this used to work.
I am using Servoy version R2 2.2.4-Build 336
I have the runtime and SDK for Java version 1.5.0_06-b05 (Windows XP)
Can anyone give me any clue why such a simple bean should fail?
Many thanks
what does youre manifest.mf look like?
And also please give youre bean a package. I don’t think we support beans without a package
package my.simple.bean;
import java.awt.*;
import java.io.Serializable;
public class SimpleBean extends Canvas
implements Serializable
{
//Constructor sets inherited properties
public SimpleBean(){
setSize(60,40);
setBackground(Color.red);
}
}
then make a jar with the class in that directory ofcourse.
Thank you Johan.
I have modified my test program which now looks like this:
package my.simple.bean;
import java.awt.*;
import java.io.Serializable;
public class SimpleBean extends Canvas
implements Serializable
{
//Constructor sets inherited properties
public SimpleBean(){
setSize(60,40);
setBackground(Color.red);
}
}
My manifest file looks like this:
Name: bean/simple/my/SimpleBean.class
Java-Bean: True
I compiled the java code like this:
javac Simplebean.java
I placed the resulting class file in the directory structure:
bean/simple/my/SimpleBean.class
I built the jar file like this:
jar cfm SimpleBean.jar manifest.tmp bean/simple/my/SimpleBean.class
I placed the bean into the Servoy bean directory and I attempted to put
it on a form but it did not show up on the pick list.
The .log.txt file contains:
2006-03-13 12:22 : Error occured retrieving bean. Bean have been loaded, error: java.lang.ClassNotFoundException: SimpleBean
I am still confused as to why this is still failing. Do you have any other ideas?
Thanks again.