loading mapscript in java error
dbarron
dbarron at DSWLLC.COM
Mon Nov 8 18:00:22 PST 2004
Got the mapscript library to load - but now I have yet another error. Got
library to load by doing the following:
- commented out the following entry in the <src-root>/mapscript/swiginc/map.i
file - any ideas why the map.i file contains this entry? maybe it needs to
be modified?
int saveQueryAsGML(char *filename) {
return msGMLWriteQuery(self, filename);
}
- rebuilt the java source files using swig command
swig -java -v -package mapscript mapscript.i
- rebuilt the mapscript.jar and libmapscript.so files
- copied the mapscript.jar file to the /usr/local/jdk1.5.0/jre/lib/ext/
directory
Now when I try to run the following little java app to test:
import java.io.*;
import edu.umn.gis.mapscript.*;
public class MapScriptTest {
public static void main(String[] args) throws IOException {
System.out.println("loading mapscript library...");
System.loadLibrary("mapscript");
System.out.println("mapscript library LOADED...");
mapObj map;
imageObj image;
map=new mapObj("/home/dbarron/mapserver-test/china.map");
System.out.println("Created new mapObj()...");
image=map.draw();
image.save("china.png",map);
}
}
I get the following output and exception:
loading mapscript library...
mapscript library LOADED...
Exception in thread "main" java.lang.NoClassDefFoundError:
edu/umn/gis/mapscript/mapObj (wrong name: mapscript/mapObj)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at MapScriptTest.main(MapScriptTest.java:14)
I will continue to work through it - but wanted to see if either of you had
any ideas on this?
Thanks,
Dan
On Monday 08 November 2004 10:30, dbarron wrote:
> Umberto,
>
> Thanks for the suggestions!
>
> The error in full is below. The test app does see the library and tries to
> load it - it just has an error within the library itself. I used the
> straight beta2 release as Sean suggested. It seems like the
> java/libmapscript.so compile is not loading in the source that holds the
> GML functionality - that's my guess anyway. I do see the mapgml.c file get
> compiled into mapserv.exe - that defines the msGMLWriteQuery method - but
> why the java/libmapscript.so compile does not get it too, I do not know at
> this point. I'll see if I can get it to work today.
>
> loading mapscript library...
> Exception in thread "main"
> java.lang.UnsatisfiedLinkError: /usr/local/lib/special/libmapscript.so:
> /usr/local/lib/special/libmapscript.so: undefined symbol: msGMLWriteQuery
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
> at java.lang.Runtime.loadLibrary0(Runtime.java:822)
> at java.lang.System.loadLibrary(System.java:992)
> at MapScriptTest.main(MapScriptTest.java:8)
>
> Dan
More information about the MapServer-users
mailing list