利用geotools将shp文件导入postgis异常记录

二月 21, 2019 5:00:47 下午 org.geotools.referencing.factory.epsg.ThreadedPostgreSQLEpsgFactory isAvailable
警告: Unavailable authority factory: European Petroleum Survey Group
org.opengis.referencing.FactoryException: Failed to connect to the EPSG database.
    at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.createBackingStore(ThreadedEpsgFactory.java:441)
    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.(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.CRS.lookupIdentifier(CRS.java:1092)
    at org.geotools.referencing.CRS.lookupEpsgCode(CRS.java:1126)
    at org.geotools.data.postgis.PostGISDialect.postCreateTable(PostGISDialect.java:926)
    at org.geotools.jdbc.JDBCDataStore.createSchema(JDBCDataStore.java:797)
    at org.geotools.jdbc.JDBCDataStore.createSchema(JDBCDataStore.java:144)
    at com.aerors.service.Shp2pgService.importShp(Shp2pgService.java:93)
    at com.aerors.service.Shp2pgService.main(Shp2pgService.java:146)
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "Geotools"
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:514)
    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
    at org.postgresql.jdbc.PgConnection.(PgConnection.java:195)
    at org.postgresql.Driver.makeConnection(Driver.java:454)
    at org.postgresql.Driver.connect(Driver.java:256)
    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.createBacking

经过排查,发现多引了gt-epsg-postgresql-18.1.jar包,将其去掉即可。

你可能感兴趣的:(利用geotools将shp文件导入postgis异常记录)