Hi,<div>I haven't done osgi specifically, but have created a netbeans platform module (similar concept, see this link <a href="http://wiki.netbeans.org/OSGiAndNetBeans#NetBeans_and_OSGi">http://wiki.netbeans.org/OSGiAndNetBeans#NetBeans_and_OSGi</a>) that wraps vtk. </div>
<div><br></div><div>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:</div>
<div><a href="http://forums.netbeans.org/viewtopic.php?t=16272">http://forums.netbeans.org/viewtopic.php?t=16272</a></div><div><br></div><div>I had issues on mac where it wouldn't load the libraries unless I specified the <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12.5px; border-collapse: collapse; ">DYLD_LIBRARY_PATH and made sure the </span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12.5px; border-collapse: collapse; ">arch type of the libs matched that of the jvm. Also, had some weirdness with the suffixes of the libs (jnilib vs dylib see :</span><a href="http://forums.netbeans.org/ntopic16681.html">http://forums.netbeans.org/ntopic16681.html</a><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12.5px; border-collapse: collapse; ">) </span></div>
<div><br></div><div>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.</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12.5px; border-collapse: collapse; "></span>biv</div>
<div><br></div><div><br></div><div><br></div><div><br><div class="gmail_quote">On Mon, Oct 11, 2010 at 7:29 AM, Jérémie Turbet <span dir="ltr"><<a href="mailto:jet@artenum.com">jet@artenum.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><span style="white-space:pre-wrap">        </span>Hi all,<div><br></div><div>Before my question, a small description of the context: </div>
<div> I'm trying to create an OSGi bundle displaying some VTK stuff using Java wrapping.</div><div> 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...</div>
<div> </div><div> 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.</div>
<div>This method is declared as native, but my DYLD_LIBRARY_PATH points to the VTK libs. I thought it should have found this method....</div><div><br></div><div>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...) ?</div>
<div><br></div><div>to summarise:</div><div>vtkPanel panel = new vtkPanel()</div><div>panel.Render()</div><div>works fine</div><div> </div><div><div>vtkPanel panel = new vtkPanel()</div><div>panel.Render()</div><div>leads to "<span style="color:rgb(222, 42, 0);font-family:Monaco;font-size:11px">Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: test.vtk.impl.MyVtkPanel.RenderCreate(Lvtk/vtkRenderWindow;)I</span></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(222, 42, 0)"><span style="white-space:pre-wrap">        </span>at test.vtk.impl.MyVtkPanel.RenderCreate(<span style="text-decoration:underline;color:#121f8f">Native Method</span>)<span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium">"</span></div>
</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(222, 42, 0)"><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium"><br></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(222, 42, 0)">
<span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium"><br></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(222, 42, 0)"><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">>nm libvtkRenderingJava.dylib | grep RenderCreate</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">0000000000047b9b T _Java_vtk_vtkPanel_RenderCreate</div>
<div><br></div><div>Tested under Mac OSX snow leopard with VTK 5.40, 5.6.0 and 5.6.1</div><div><br></div><div><span style="white-space:pre-wrap">        </span>Regards,</div><div><br></div><div><span style="white-space:pre-wrap">                </span>JeT</div>
<div><br></div><div>PS: if someone has some experience with VTK + OSGi, some tips would be of great help. I'm a little bit stuck with it...</div></div></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(222, 42, 0)">
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>