loading mapscript in java error
Umberto Nicoletti
unicoletti at PROMETEO.IT
Tue Nov 9 00:34:10 PST 2004
Comments inline....
On Tue, 2004-11-09 at 09:26, Umberto Nicoletti wrote:
> On Tue, 2004-11-09 at 03:00, dbarron wrote:
> > 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?
> >
>
> I think Sean is more informed than me but this has probably to do with
> compile flags.
> The same happened to me once when I built mapscript without OWS support.
>
>
> > int saveQueryAsGML(char *filename) {
> > return msGMLWriteQuery(self, filename);
> > }
> >
> > - rebuilt the java source files using swig command
> >
> > swig -java -v -package mapscript mapscript.i
> >
>
I just noticed that the -package argument is wrong!
That explains for the odd wrong name excpetion below.
Use make interface.
Sean: what about a 5 lines README in mapscript/java ?
Umberto
> I think you can use 'make interface' instead
>
> > - rebuilt the mapscript.jar and libmapscript.so files
> > - copied the mapscript.jar file to the /usr/local/jdk1.5.0/jre/lib/ext/
> > directory
>
> It is probably not a good idea to copy the jar file over there.
> Keep it in a local directory and set CLASSPATH accordingly, at least
> until we don't get these issues sorted out.
>
> >
> > 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?
> >
>
> java simply cannot find the mapObj. But the 'wrong name' error looks
> strange.
> Have you run the tests that come with mapscript ('make test')?
>
> Then what about telling us what platform you running on?
>
> Please forward your previous email to the list for others to benefit.
>
> HTH,
> Umberto
>
> > 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