[vtkusers] VTK + OSGi & RenderCreate native method

Jérémie Turbet jet at artenum.com
Mon Oct 11 17:14:26 EDT 2010


  You're right about some strange behavior under OSX. I've tested my demo under linux and it works well. I still have to investigate on this "Invalid memory access" on mac, but now I know I'm not so wrong.

	Thanks for this valuable advice.

  Does someone has some kind of explanation about the "unsatisfied link error" when the vtkPanel class is duplicated ?

	Thanks,

		JeT

Le 11 oct. 2010 à 17:31, Gerrick Bivins a écrit :

> Hi,
> I haven't done osgi specifically, but have created a netbeans platform module (similar concept, see this link http://wiki.netbeans.org/OSGiAndNetBeans#NetBeans_and_OSGi) that wraps vtk. 
> 
> I ended up forcing the load of the required libs for my app when the module loads via the module installer (not sure what the equivalent is in osgi terms,bundle activator maybe?) similar to the technique described here for loading jogl in a netbeans application:
> http://forums.netbeans.org/viewtopic.php?t=16272
> 
> I had issues on mac where it wouldn't load the libraries unless I specified the DYLD_LIBRARY_PATH and made sure the 
> arch type of the libs matched that of the jvm. Also, had some weirdness with the suffixes of the libs (jnilib vs dylib see :http://forums.netbeans.org/ntopic16681.html) 
> 
> On windows or linux, things worked as expected (ie how it was described in the docs) so you may want to try your module on one of those platforms before trying on OSX.
> 
> biv
> 
> 
> 
> 
> On Mon, Oct 11, 2010 at 7:29 AM, Jérémie Turbet <jet at artenum.com> wrote:
> 	Hi all,
> 
> Before my question, a small description of the context: 
>   I'm trying to create an OSGi bundle displaying some VTK stuff using Java wrapping.
>   The service class is a simple POJO (OSGi classes and configuration are managed using iPOJO). when I test it out of OSGi environment, it works well, load libraries, and displays a beautiful 3D cone in a window. When I ask to the OSGi container to launch my service, libraries are loaded, objects are instantiated, but as soon as I ask a rendering (using vtkPanel::Render() ) I get this error "Invalid memory access of location 0x0 rip=0x10109cdcc" which looks like a null pointer exception...
>   
>   For a debugging purpose, I have made a copy/paste of vtkPanel class into MyVtkPanel (which is in my application package) and replace the vtkPanel by MyVtkPanel into my small test application. I expected no change in the resulting behaviour, instead I have an unsatisfied link error on RenderCreate() method.
> This method is declared as native, but my DYLD_LIBRARY_PATH points to the VTK libs. I thought it should have found this method....
> 
> Does someone has an idea of why this error occurs, is there some access restriction due to the class location (which is the only change... I guess...) ?
> 
> to summarise:
> vtkPanel panel = new vtkPanel()
> panel.Render()
> works fine
>  
> vtkPanel panel = new vtkPanel()
> panel.Render()
> leads to "Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: test.vtk.impl.MyVtkPanel.RenderCreate(Lvtk/vtkRenderWindow;)I
> 	at test.vtk.impl.MyVtkPanel.RenderCreate(Native Method)"
> 
> 
> >nm libvtkRenderingJava.dylib  | grep RenderCreate
> 0000000000047b9b T _Java_vtk_vtkPanel_RenderCreate
> 
> Tested under Mac OSX snow leopard with VTK 5.40, 5.6.0 and 5.6.1
> 
> 	Regards,
> 
> 		JeT
> 
> PS: if someone has some experience with VTK + OSGi, some tips would be of great help. I'm a little bit stuck with it...
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101011/a8d34550/attachment.htm>


More information about the vtkusers mailing list