setCRS失败。。
org.postgresql.util.PSQLException: 致命错误: 用户 "Geotools" Password 认证失败 (pgjdbc: autodetected server-encoding to be GB2312, if the message is not readable, please check database logs and/or host, port, dbname, user, password, pg_hba.conf)
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:438)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:222)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:194)
at org.postgresql.Driver.makeConnection(Driver.java:450)
at org.postgresql.Driver.connect(Driver.java:252)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:94)
at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:79)
at org.geotools.referencing.factory.epsg.DirectEpsgFactory.getConnection(DirectEpsgFactory.java:3302)
at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.createBackingStore(ThreadedEpsgFactory.java:436)
at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:133)
at org.geotools.referencing.factory.BufferedAuthorityFactory.isAvailable(BufferedAuthorityFactory.java:235)
at org.geotools.referencing.factory.DeferredAuthorityFactory.isAvailable(DeferredAuthorityFactory.java:119)
at org.geotools.factory.FactoryRegistry.isAvailable(FactoryRegistry.java:667)
at org.geotools.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:501)
at org.geotools.factory.FactoryRegistry$1.filter(FactoryRegistry.java:192)
at javax.imageio.spi.FilterIterator.advance(ServiceRegistry.java:821)
at javax.imageio.spi.FilterIterator.<init>(ServiceRegistry.java:815)
at javax.imageio.spi.ServiceRegistry.getServiceProviders(ServiceRegistry.java:516)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:197)
at org.geotools.referencing.ReferencingFactoryFinder.getFactories(ReferencingFactoryFinder.java:180)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactories(ReferencingFactoryFinder.java:455)
at org.geotools.referencing.DefaultAuthorityFactory.getBackingFactory(DefaultAuthorityFactory.java:89)
at org.geotools.referencing.DefaultAuthorityFactory.<init>(DefaultAuthorityFactory.java:69)
at org.geotools.referencing.CRS.getAuthorityFactory(CRS.java:263)
at org.geotools.referencing.CRS.decode(CRS.java:525)
at com.lzugis.geotools.utils.FeaureUtil.creatSimpleFeatureType(FeaureUtil.java:52)
at com.lzugis.geotools.utils.FeaureUtil.creatSimpleFeatureByFeilds(FeaureUtil.java:156)
at org.geotools.tutorial.quickstart.EquiSurface.clipFeatureCollection(EquiSurface.java:143)
at org.geotools.tutorial.quickstart.EquiSurface.calEquiSurface(EquiSurface.java:97)
at org.geotools.tutorial.quickstart.EquiSurface.main(EquiSurface.java:296)
参考:https://docs.geotools.org/stable/javadocs/org/geotools/feature/simple/SimpleFeatureTypeBuilder.html
参考2:https://www.cnblogs.com/tuboshu/p/10752281.html(Geotools创建Feature的两种方式)
>>geotools - how to `CRS.decode` without loading hsql?:https://stackoverflow.com/questions/55788089/geotools-how-to-crs-decode-without-loading-hsql
>>GeoTools入门(五)-- CRS操作:https://blog.csdn.net/oYinHeZhiGuang/article/details/118315724
官方关于CRS的说明:https://docs.geotools.org/latest/userguide/library/referencing/crs.html
CRS->DirectEpsgFactory
To hook this up make sure you have one of the gt-epsg
plugins on your CLASSPATH. The gt-epsg-hsql
plugin is recommended.
DirectEpsgFactory在package org.geotools.referencing.factory.epsg;包下,
然后getConnection就发动了。。
然后就找到了DriverManager了。。
然后就报错了。。
奇怪,如果不安装postgresql,难道就不能用setCRS了吗?