I can connect to postgresql database, but when I try to getFeatureSource(). Would you please help me??<br><br>2007-3-21 10:39:17 FactoryRegistry scanForPlugins<br>少御: Can't load a service for category "CRSAuthorityFactory". Cause is "NoClassDefFoundError: javax/units/ConversionException".
<br>2007-3-21 10:39:17 FactoryRegistry scanForPlugins<br>少御: Can't load a service for category "CRSAuthorityFactory". Cause is "NoClassDefFoundError: javax/units/ConversionException".<br>2007-3-21 10:39:17 FactoryRegistry scanForPlugins
<br>少御: Can't load a service for category "CRSAuthorityFactory". Cause is "NoClassDefFoundError: javax/units/ConversionException".<br>Exception in thread "main" java.lang.StackOverflowError
<br> at java.util.HashSet.iterator(HashSet.java:154)<br> at javax.imageio.spi.DigraphNode.getOutNodes(DigraphNode.java:59)<br> at javax.imageio.spi.PartialOrderIterator.next(PartiallyOrderedSet.java:179)
<br> at javax.imageio.spi.FilterIterator.advance(ServiceRegistry.java:792)<br> at javax.imageio.spi.FilterIterator.<init>(ServiceRegistry.java:787)<br> at javax.imageio.spi.ServiceRegistry.getServiceProviders
(ServiceRegistry.java:491)<br> at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:167)<br> at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:117)<br>
at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:275)<br> at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:254)<br> at org.geotools.factory.FactoryCreator.getServiceProvider
(FactoryCreator.java:115)<br> at org.geotools.referencing.FactoryFinder.getAuthorityFactory(FactoryFinder.java:235)<br> at org.geotools.referencing.FactoryFinder.getCRSAuthorityFactory(FactoryFinder.java:496)
<br> at org.geotools.referencing.factory.epsg.LongitudeFirstFactory.createBackingStore(LongitudeFirstFactory.java:180)<br> at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java
:136)<br> at org.geotools.referencing.factory.BufferedAuthorityFactory.isAvailable(BufferedAuthorityFactory.java:206)<br> at org.geotools.referencing.factory.DeferredAuthorityFactory.isAvailable(DeferredAuthorityFactory.java
:124)<br> at org.geotools.factory.FactoryRegistry$DefaultFilter.filter(FactoryRegistry.java:76)<br> at javax.imageio.spi.FilterIterator.advance(ServiceRegistry.java:793)<br> at javax.imageio.spi.FilterIterator
.<init>(ServiceRegistry.java:787)<br> at javax.imageio.spi.ServiceRegistry.getServiceProviders(ServiceRegistry.java:491)<br> at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java
:167)<br> at ......<br>....................................<br>....................................<br><br>and the code:<br><br>import java.io.IOException;<br>import java.util.HashMap;<br>import java.util.Map;<br><br>
import org.geotools.data.DataStore;<br>import org.geotools.data.DataStoreFinder;<br>import org.geotools.data.FeatureSource;<br>import org.geotools.data.postgis.PostgisDataStore;<br>import org.geotools.data.postgis.PostgisDataStoreFactory
;<br><br>public class Postgis {<br> @SuppressWarnings("unchecked")<br> /** Creates a new instance of Postgis */<br> public Postgis(String host,int port,String database,String user,String password) {
<br> params= new HashMap();<br> params.put("dbtype","postgis");<br> params.put("host",host);<br> params.put("port",new Integer(port));<br> params.put
("database",database);<br> params.put("user",user);<br> params.put("passwd",password);<br> }<br> <br> public void connect(){<br> try {<br> //pgDataStore=(PostgisDataStore)factory.createDataStore(params);
<br> pgDataStore=DataStoreFinder.getDataStore(params);<br> ................<br> }<br> <br> public void getFS(String featureName){<br> try {<br> FeatureSource fsBC=pgDataStore.getFeatureSource
(featureName);<br> } catch (IOException ex) {<br> ex.printStackTrace();<br> .........<br> }<br> }<br> <br> public static void main(String[] args) throws IOException {<br> Postgis pg=new Postgis("localhost",5432,"mapdb","user","passwd");
<br> pg.connect();<br> pg.getFS("roads");<br> }<br> <br> private Map params;<br> private DataStore pgDataStore;<br> //private PostgisDataStoreFactory factory=new PostgisDataStoreFactory();
<br> <br>}