我一直在使用来自https://ariasprado.name/2012/08/13/quick-and-dirty-coordinate-transforming-using-geotools.html#comment-792的代码在我的GWT服务器端,并且已经按照要求附加了所有必需的jar文件。我附上了错误日志。任何帮助将不胜感激。提前致谢。
import org.geotools.geometry.DirectPosition2D;
import org.geotools.referencing.CRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
...
CoordinateReferenceSystem sourceCrs = CRS.decode("EPSG:25829");
CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:4326");
double x = (double) 636497.59434;
double y = (double) 4778964.017375;
boolean lenient = true;
MathTransform mathTransform
= CRS.findMathTransform(sourceCrs, targetCrs, lenient);
DirectPosition2D srcDirectPosition2D
= new DirectPosition2D(sourceCrs, x, y);
DirectPosition2D destDirectPosition2D
= new DirectPosition2D();
mathTransform.transform(srcDirectPostion2D, destDirectPosition2D);
double transX = destDirectPosition2D.x;
double transY = destDirectPosition2D.y;
Mar 10, 2018 10:59:20 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "MathTransformFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.operation.MathTransformFactory: Provider org.geotools.referencing.operation.DefaultMathTransformFactory not a subtype".
java.util.ServiceConfigurationError: org.opengis.referencing.operation.MathTransformFactory: Provider org.geotools.referencing.operation.DefaultMathTransformFactory not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:823)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:769)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:802)
at org.geotools.factory.FactoryRegistry.getUnfilteredProviders(FactoryRegistry.java:229)
at org.geotools.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:429)
at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:364)
at org.geotools.factory.FactoryCreator.getServiceProvider(FactoryCreator.java:144)
at org.geotools.referencing.ReferencingFactoryFinder.getFactory(ReferencingFactoryFinder.java:194)
at org.geotools.referencing.ReferencingFactoryFinder.getMathTransformFactory(ReferencingFactoryFinder.java:504)
at org.geotools.referencing.factory.ReferencingFactoryContainer.getMathTransformFactory(ReferencingFactoryContainer.java:274)
at org.geotools.referencing.factory.ReferencingFactoryContainer.initialize(ReferencingFactoryContainer.java:181)
at org.geotools.referencing.factory.ReferencingFactoryContainer.getImplementationHints(ReferencingFactoryContainer.java:206)
at org.geotools.factory.FactoryRegistry.usesAcceptableHints(FactoryRegistry.java:551)
at org.geotools.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:505)
at org.geotools.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:436)
at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:364)
at org.geotools.factory.FactoryCreator.getServiceProvider(FactoryCreator.java:144)
at org.geotools.referencing.factory.ReferencingFactoryContainer.instance(ReferencingFactoryContainer.java:171)
at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.<init>(ThreadedEpsgFactory.java:194)
at org.geotools.referencing.factory.epsg.ThreadedHsqlEpsgFactory.<init>(ThreadedHsqlEpsgFactory.java:132)
at org.geotools.referencing.factory.epsg.ThreadedHsqlEpsgFactory.<init>(ThreadedHsqlEpsgFactory.java:118)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:823)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:769)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:802)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:195)
at org.geotools.referencing.ReferencingFactoryFinder.getFactories(ReferencingFactoryFinder.java:177)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactories(ReferencingFactoryFinder.java:452)
at org.geotools.referencing.DefaultAuthorityFactory.getBackingFactory(DefaultAuthorityFactory.java:88)
at org.geotools.referencing.DefaultAuthorityFactory.<init>(DefaultAuthorityFactory.java:69)
at org.geotools.referencing.CRS.getAuthorityFactory(CRS.java:250)
at org.geotools.referencing.CRS.decode(CRS.java:488)
at org.geotools.referencing.CRS.decode(CRS.java:416)
at com.interfacema.gis.server.logic.BorderServlet.transformCRS(BorderServlet.java:342)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:587)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:303)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
Mar 10, 2018 10:59:20 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "DatumFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.datum.DatumFactory: Provider org.geotools.referencing.factory.ReferencingObjectFactory not a subtype".
java.util.ServiceConfigurationError: org.opengis.referencing.datum.DatumFactory: Provider org.geotools.referencing.factory.ReferencingObjectFactory not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:823)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:769)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:802)
at org.geotools.factory.FactoryRegistry.getUnfilteredProviders(FactoryRegistry.java:229)
at org.geotools.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:429)
at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:364)
at org.geotools.factory.FactoryCreator.getServiceProvider(FactoryCreator.java:144)
at org.geotools.referencing.ReferencingFactoryFinder.getFactory(ReferencingFactoryFinder.java:194)
at org.geotools.referencing.ReferencingFactoryFinder.getDatumFactory(ReferencingFactoryFinder.java:233)
at org.geotools.referencing.factory.ReferencingFactoryContainer.getDatumFactory(ReferencingFactoryContainer.java:232)
at org.geotools.referencing.factory.ReferencingFactoryContainer.initialize(ReferencingFactoryContainer.java:182)
at org.geotools.referencing.factory.ReferencingFactoryContainer.getImplementationHints(ReferencingFactoryContainer.java:206)
at org.geotools.factory.FactoryRegistry.usesAcceptableHints(FactoryRegistry.java:551)
at org.geotools.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:505)
at org.geotools.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:436)
at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:364)
at org.geotools.factory.FactoryCreator.getServiceProvider(FactoryCreator.java:144)
at org.geotools.referencing.factory.ReferencingFactoryContainer.instance(ReferencingFactoryContainer.java:171)
at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.<init>(ThreadedEpsgFactory.java:194)
at org.geotools.referencing.factory.epsg.ThreadedHsqlEpsgFactory.<init>(ThreadedHsqlEpsgFactory.java:132)
at org.geotools.referencing.factory.epsg.ThreadedHsqlEpsgFactory.<init>(ThreadedHsqlEpsgFactory.java:118)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:823)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:769)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:802)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:195)
at org.geotools.referencing.ReferencingFactoryFinder.getFactories(ReferencingFactoryFinder.java:177)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactories(ReferencingFactoryFinder.java:452)
at org.geotools.referencing.DefaultAuthorityFactory.getBackingFactory(DefaultAuthorityFactory.java:88)
at org.geotools.referencing.DefaultAuthorityFactory.<init>(DefaultAuthorityFactory.java:69)
at org.geotools.referencing.CRS.getAuthorityFactory(CRS.java:250)
at org.geotools.referencing.CRS.decode(CRS.java:488)
at org.geotools.referencing.CRS.decode(CRS.java:416)
at com.interfacema.gis.server.logic.BorderServlet.transformCRS(BorderServlet.java:342)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:587)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:303)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
Mar 10, 2018 10:59:20 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "DatumFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.datum.DatumFactory: Provider org.geotools.referencing.factory.DatumAliases not a subtype"...
WARNING: Can't load a service for category "CSFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.cs.CSFactory: Provider org.geotools.referencing.factory.ReferencingObjectFactory not a subtype"...
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.epsg.DefaultFactory not a subtype"...
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.epsg.FactoryUsingWKT not a subtype"...
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.epsg.LongitudeFirstFactory not a subtype"...
Mar 10, 2018 10:59:20 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.wms.AutoCRSFactory not a subtype"...
Mar 10, 2018 10:59:20 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.URN_AuthorityFactory not a subtype"...
Mar 10, 2018 10:59:20 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.HTTP_AuthorityFactory not a subtype"...
Mar 10, 2018 10:59:20 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.epsg.LongitudeFirstEpsgDecorator not a subtype"...
Mar 10, 2018 10:59:20 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.epsg.ThreadedHsqlEpsgFactory not a subtype"...