Hi "lacd" ... your question is a common one.

The only answer is to dump all the GeoTools jars into the same plugin, 
GeoTools uses Java's Factory Service Provide Interface (ie FactorySPI) 
plugin system in which it looks up stuff on the classpath.

Eclipse RCP uses some scary classloader tricks that interfere with this.

For more information on FactorySPI:
- http://docs.codehaus.org/display/GEOTDOC/How+to+Find+a+Factory

For a working example of how to do this check out the uDig project. And 
before you ask the "buddy classloader" trick wont work - it lets plugin 
share a classloader but it does not let a buddy provided a 
META_INF/services/ directory full of text files (which is what factory 
spi wants to see).

Cheers,
Jody

> Hello,
> Thanks for the tutorial it works fine with Java Project .
> But, I would like to know how to use geotools Libraries in Eclipse 
> Plugin-Project.
> When I add the geotools libraries to the Java Build Path and when I used any 
> class of geotools like  
>
> crs = CRS.decode("EPSG:32631") 
>
> for exemple 
> My plugin send in my view the exception like the one herebelow 
>
> java.lang.NoClassDefFoundError: org/opengis/referencing/FactoryException
>       at java.lang.Class.getDeclaredConstructors0(Native Method)
>       at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
>       at java.lang.Class.getConstructor0(Unknown Source)
>       at java.lang.Class.newInstance0(Unknown Source)
>       at java.lang.Class.newInstance(Unknown Source)
>       at 
> org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:157)
>       at 
> org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:759)
>       at 
> org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
>       at 
> org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
>       at 
> org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:234)
>       at 
> org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:69)
>       at 
> org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:292)
>       at 
> org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:197)
>       at 
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
>       at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:290)
>       at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:525)
>       at 
> org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:140)
>       at 
> org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
>       at 
> org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
>       at 
> org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:394)
>       at 
> org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1144)
>       at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1097)
>       at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1311)
>       at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:601)
>       at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:532)
>       at 
> org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:562)
>       at 
> org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:244)
>       at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:815)
>       at 
> org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2436)
>       at 
> org.eclipse.ui.internal.WorkbenchWindow$6.run(WorkbenchWindow.java:2616)
>       at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
>       at 
> org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2597)
>       at 
> org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:658)
>       at 
> org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Workbench.java:811)
>       at 
> org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Workbench.java:1453)
>       at 
> org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbench.java:1404)
>       at 
> org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWindow(WorkbenchConfigurer.java:190)
>       at 
> org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:708)
>       at org.eclipse.ui.internal.Workbench.init(Workbench.java:1101)
>       at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1863)
>       at 
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
>       at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
>       at org.map.ct.Application.run(Application.java:18)
>       at 
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
>       at 
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
>       at 
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
>       at 
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
>       at 
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
>       at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>       at org.eclipse.core.launcher.Main.run(Main.java:977)
>       at org.eclipse.core.launcher.Main.main(Main.java:952)
>
>
>  
>
> Jody Garnett wrote:
>   
>> Help! Did these instructions work for you?
>>
>> Feedback would be great,
>> Jody
>>     
>>> I know most users have figure this one out already; but I thought I 
>>> should document how to do things for the wiki:
>>> - http://docs.codehaus.org/display/GEOTDOC/Welcome+to+Eclipse+Developers
>>>
>>> There are a couple of good things about this page:
>>> - it tells you to remove conflicting jars in the binary download
>>> - it makes one project to hold the geotools jars, and has you work in a 
>>> second project (so you can update the geotools jars in one spot)
>>>
>>> Let me know what you think?
>>> Jody
>>> PS. I know maven is way "better", but it is unstable when you don't have 
>>> a mirror
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Splunk Inc.
>>> Still grepping through log files to find problems?  Stop.
>>> Now Search log events and configuration files using AJAX and a browser.
>>> Download your FREE copy of Splunk now >>  http://get.splunk.com/
>>> _______________________________________________
>>> Geotools-gt2-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>   
>>>       
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems?  Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >>  http://get.splunk.com/
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>>     
> Quoted from: 
> http://www.nabble.com/How-to-use-a-bin-download-in-eclipse-tf4346299.html#a12396617
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to