Java Spring Boot在部署到Tomcat期间无法加载外部jar

Java Spring Boot在部署到Tomcat期间无法加载外部jar,java,spring,tomcat,spring-boot,Java,Spring,Tomcat,Spring Boot,我一直在使用嵌入式服务器(使用SpringBootApp运行)和添加到类路径中的外部jar(数据库驱动程序Postgis)很好地处理SpringBoot1.2。但当我试图在eclipse中的Tomcat8上部署和运行它时。我遇到了这个错误无法加载驱动程序类:org.postgis.DriverWrapper 需要帮忙吗 janv. 06, 2015 12:08:03 AM org.apache.catalina.core.StandardService startInternal INFO: D

我一直在使用嵌入式服务器(使用SpringBootApp运行)和添加到类路径中的外部jar(数据库驱动程序Postgis)很好地处理SpringBoot1.2。但当我试图在eclipse中的Tomcat8上部署和运行它时。我遇到了这个错误
无法加载驱动程序类:org.postgis.DriverWrapper

需要帮忙吗

janv. 06, 2015 12:08:03 AM org.apache.catalina.core.StandardService startInternal
INFO: Démarrage du service Catalina
janv. 06, 2015 12:08:03 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.15
janv. 06, 2015 12:08:04 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
janv. 06, 2015 12:08:08 AM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration@44692e7f, com.geopro.config.ApplicationInitializer@556bb6ef]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.2.0.RELEASE)

2015-01-06 00:08:08.751 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [servletConfigInitParams] PropertySource with lowest search precedence
2015-01-06 00:08:08.756 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [servletContextInitParams] PropertySource with lowest search precedence
2015-01-06 00:08:08.757 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [jndiProperties] PropertySource with lowest search precedence
2015-01-06 00:08:08.757 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [systemProperties] PropertySource with lowest search precedence
2015-01-06 00:08:08.758 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [systemEnvironment] PropertySource with lowest search precedence
2015-01-06 00:08:08.758 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
2015-01-06 00:08:08.822  INFO   --- [ost-startStop-1] o.s.boot.SpringApplication               : Starting application on hp-PC with PID 6564 (C:\Users\hp\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\geopro\WEB-INF\lib\spring-boot-1.2.0.RELEASE.jar started by hp in C:\eclipse)
2015-01-06 00:08:08.895  INFO   --- [ost-startStop-1] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@745df3a9: startup date [Tue Jan 06 00:08:08 GMT 2015]; root of context hierarchy
2015-01-06 00:08:08.902 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Replacing [servletContextInitParams] PropertySource with [servletContextInitParams]
2015-01-06 00:08:10.266  INFO   --- [ost-startStop-1] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2015-01-06 00:08:10.691 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [applicationConfig: [classpath:/application.properties]] PropertySource with search precedence immediately lower than [applicationConfigurationProperties]
2015-01-06 00:08:10.691 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Removing [applicationConfigurationProperties] PropertySource
2015-01-06 00:08:10.692 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Removing [defaultProperties] PropertySource
2015-01-06 00:08:11.111  INFO   --- [ost-startStop-1] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration' of type [class org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-01-06 00:08:11.209  INFO   --- [ost-startStop-1] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$6051c0dc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-01-06 00:08:11.249  INFO   --- [ost-startStop-1] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-01-06 00:08:11.268  INFO   --- [ost-startStop-1] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-01-06 00:08:11.281  INFO   --- [ost-startStop-1] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-01-06 00:08:11.311  INFO   --- [ost-startStop-1] o.a.c.c.C.[.[localhost].[/demoweb]       : Initializing Spring embedded WebApplicationContext
2015-01-06 00:08:11.311 DEBUG   --- [ost-startStop-1] o.s.web.context.ContextLoader            : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
2015-01-06 00:08:11.311  INFO   --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2416 ms
2015-01-06 00:08:11.869 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [servletConfigInitParams] PropertySource with lowest search precedence
2015-01-06 00:08:11.869 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [servletContextInitParams] PropertySource with lowest search precedence
2015-01-06 00:08:11.870 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [jndiProperties] PropertySource with lowest search precedence
2015-01-06 00:08:11.870 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [systemProperties] PropertySource with lowest search precedence
2015-01-06 00:08:11.870 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [systemEnvironment] PropertySource with lowest search precedence
2015-01-06 00:08:11.870 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
2015-01-06 00:08:11.955 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [servletConfigInitParams] PropertySource with lowest search precedence
2015-01-06 00:08:11.955 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [servletContextInitParams] PropertySource with lowest search precedence
2015-01-06 00:08:11.955 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [jndiProperties] PropertySource with lowest search precedence
2015-01-06 00:08:11.956 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [systemProperties] PropertySource with lowest search precedence
2015-01-06 00:08:11.956 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [systemEnvironment] PropertySource with lowest search precedence
2015-01-06 00:08:11.956 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
2015-01-06 00:08:12.027 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [servletConfigInitParams] PropertySource with lowest search precedence
2015-01-06 00:08:12.027 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [servletContextInitParams] PropertySource with lowest search precedence
2015-01-06 00:08:12.028 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [jndiProperties] PropertySource with lowest search precedence
2015-01-06 00:08:12.028 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [systemProperties] PropertySource with lowest search precedence
2015-01-06 00:08:12.028 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Adding [systemEnvironment] PropertySource with lowest search precedence
2015-01-06 00:08:12.028 DEBUG   --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment     : Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
2015-01-06 00:08:12.949  INFO   --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
2015-01-06 00:08:12.952  INFO   --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'errorPageFilter' to: [/*]
2015-01-06 00:08:12.953  INFO   --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2015-01-06 00:08:12.953  INFO   --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [/*]
2015-01-06 00:08:13.177  WARN   --- [ost-startStop-1] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: org.postgis.DriverWrapper
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
AppConfig.java

package com.geopro.config;

import javax.persistence.EntityManagerFactory;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;


@EnableAutoConfiguration
@ComponentScan(basePackages = { "com.geopro" })
//@Import({ DomainAndPersistenceConfig.class })
@EnableJpaRepositories(basePackages = { "com.geopro.repositories" })
@EntityScan(basePackages = { "com.geopro.entities" })
@EnableTransactionManagement
public class AppConfig {


    @Bean
    public HibernateJpaSessionFactoryBean sessionFactory(EntityManagerFactory emf) {
         HibernateJpaSessionFactoryBean factory = new HibernateJpaSessionFactoryBean();
         factory.setEntityManagerFactory(emf);
         return factory;
    }
}
ApplicationInitializer.java

package com.geopro.config;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;

public class ApplicationInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(AppConfig.class);
}
}
应用程序属性

spring.datasource.driverClassName=org.postgis.DriverWrapper
spring.datasource.url=jdbc:postgresql_postGIS://localhost:5432/geopro
spring.datasource.username=postgres
spring.datasource.password=***********
spring.jpa.database-platform=org.hibernate.spatial.dialect.postgis.PostgisDialect
spring.jpa.show-sql=true
编辑1 类路径的JConsole

VM arguments: 
-Dosgi.requiredJavaVersion=1.6 -Xms512m -Xmx1024m 
Class path: 
C:\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
Library path: 
C:\ProgramData\Oracle\Java\javapath;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Users\hp\bin\Sencha\Cmd\5.0.1.231;C:\PYTHON27\ARCGIS10.1\LIB\SITE-PACKAGES\PYQT4;C:\PROGRAM FILES (X86)\EAZFUSCATOR.NET;C:\jdk\BIN;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;C:\WINDOWS\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM FILES\WIDCOMM\BLUETOOTH SOFTWARE\;C:\PROGRAM FILES\WIDCOMM\BLUETOOTH SOFTWARE\SYSWOW64;;C:\PROGRAM FILES (X86)\MICROSOFT SQL SERVER\100\TOOLS\BINN\;C:\PROGRAM FILES\MICROSOFT SQL SERVER\100\TOOLS\BINN\;C:\PROGRAM FILES\MICROSOFT SQL SERVER\100\DTS\BINN\;C:\PYTHON26\ARCGIS10.0;C:\PYTHON26\ARCGIS10.0\SCRIPTS;C:\PYTHON27\ARCGIS10.1;C:\WAMP\BIN\PHP\PHP5.4.3;C:\USERS\HP\DOCUMENTS\VISUAL STUDIO 2010\PROJECTS\GEODATA\GEODATA\BIN\DEBUG\GEODATA.EXE;C:\F\G77\BIN;C:\ADT-BUNDLE-WINDOWS\SDK\PLATFORM-TOOLS;C:\ADT-BUNDLE-WINDOWS\SDK\TOOLS;C:\apache-ant\BIN;C:\PROGRAM FILES (X86)\HEROKU\BIN;C:\PROGRAM FILES (X86)\GIT\CMD;C:\APACHE-MAVEN\BIN;C:\PYTHON27\ARCGIS10.1\SCRIPTS;C:\USERS\HP\DOWNLOADS\ECLIPSE-STANDARD-KEPLER-SR1-WIN32-X86_64\ECLIPSE\PLUGINS\COM.GOOGLE.GWT.ECLIPSE.SDKBUNDLE_2.6.0\GWT-2.6.0;;.
Boot class path: 
C:\Program Files\Java\jre1.8.0_25\lib\resources.jar;C:\Program Files\Java\jre1.8.0_25\lib\rt.jar;C:\Program Files\Java\jre1.8.0_25\lib\sunrsasign.jar;C:\Program Files\Java\jre1.8.0_25\lib\jsse.jar;C:\Program Files\Java\jre1.8.0_25\lib\jce.jar;C:\Program Files\Java\jre1.8.0_25\lib\charsets.jar;C:\Program Files\Java\jre1.8.0_25\lib\jfr.jar;C:\Program Files\Java\jre1.8.0_25\classes

Pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.testpg</groupId>
    <artifactId>demoweb</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>demoweb</name>
    <description>Demo project</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.0.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <start-class>demoweb.Application</start-class>
        <java.version>1.7</java.version>
        <geotools.version>12-RC1</geotools.version>
    </properties>
    <repositories>

        <repository>
            <id>lambdaj</id>
            <name>Lambdaj Repository</name>
            <url>http://lambdaj.googlecode.com/svn/repo/releases/</url>
        </repository>

        <repository>
            <id>sonatype-postgis-releases</id>
            <name>Sonatype Postgis Releases Repo</name>
            <url>http://oss.sonatype.org/content/repositories/postgis-releases</url>
        </repository>
        <repository>
            <id>OSGEO GeoTools repo</id>
            <url>http://download.osgeo.org/webdav/geotools</url>
        </repository>
        <repository>
            <id>Hibernate Spatial repo</id>
            <url>http://www.hibernatespatial.org/repository</url>
        </repository>
        <repository>
            <id>maven2-repository.dev.java.net</id>
            <name>Java.net repository</name>
            <url>http://download.java.net/maven/2</url>
        </repository>
        <repository>
            <id>osgeo</id>
            <name>Open Source Geospatial Foundation Repository</name>
            <url>http://download.osgeo.org/webdav/geotools/</url>
        </repository>
        <repository>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>boundless</id>
            <name>Boundless Maven Repository</name>
            <url>http://repo.boundlessgeo.com/main</url>
        </repository>


    </repositories>
    <dependencies>
        <dependency>
            <groupId>com.googlecode.lambdaj</groupId>
            <artifactId>lambdaj</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-spatial</artifactId>
            <version>4.3</version>
            <exclusions>
                <exclusion>
                    <artifactId>hibernate-core</artifactId>
                    <groupId>org.hibernate</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>postgis-jdbc</artifactId>
                    <groupId>org.postgis</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>postgresql</artifactId>
                    <groupId>postgresql</groupId>
                </exclusion>
            </exclusions>
        </dependency>


        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-geojson</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.3-1100-jdbc41</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>16.0.1</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>de.grundid.opendatalab</groupId>
            <artifactId>geojson-jackson</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

4.0.0
org.testpg
demoweb
0.0.1-快照
战争
demoweb
演示项目
org.springframework.boot
spring启动程序父级
1.2.0.1发布
UTF-8
UTF-8
demoweb.Application
1.7
12-RC1
兰姆达斯
Lambdaj存储库
http://lambdaj.googlecode.com/svn/repo/releases/
sonatype postgis发行版
Sonatype Postgis发布回购协议
http://oss.sonatype.org/content/repositories/postgis-releases
OSGEO地理工具回购
http://download.osgeo.org/webdav/geotools
休眠空间报告
http://www.hibernatespatial.org/repository
maven2-repository.dev.java.net
Java.net存储库
http://download.java.net/maven/2
奥斯吉
开源地理空间基础知识库
http://download.osgeo.org/webdav/geotools/
真的
无边无际
无限Maven存储库
http://repo.boundlessgeo.com/main
com.googlecode.lambdaj
兰姆达斯
2.4
org.hibernate
冬眠空间
4.3
冬眠核心
org.hibernate
postgis jdbc
org.postgis
postgresql
postgresql
org.geotools
gt geojson
${geotools.version}
org.postgresql
postgresql
9.3-1100-jdbc41
番石榴
番石榴
16.0.1
公共dbcp
公共dbcp
共用池
共用池
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧起动试验
测试
org.springframework.boot
弹簧启动机tomcat
假如
de.grundid.opendatalab
杰克森·杰克逊
1.2
org.springframework.boot
springbootmaven插件

解决此问题的最佳方法是避免管理类路径及其麻烦,因此所有JAR都打包在war文件中。

如果在构建类路径上有库,并不意味着在运行应用程序的类路径上也有库。一种方法(在我看来是更好的方法)是geogeek描述的方法,并将库打包到战争档案中。另一种方法是将jar库复制到Tomcat的/lib文件夹


我希望有帮助

你确定这个类在你在图片中提到的一个jar中吗?是的,我确定,它已经用“spring boot app”成功运行了。你能检查正在运行的应用程序的类路径吗?我怎么能检查正在运行的应用程序的类路径呢?你应该在eclipse项目属性中转到部署程序集(将您发布的映像中的选定项升级2级)并将maven依赖项JAR添加到部署环境中。我知道这是一个旧线程,但如果我想要一个“附加组件”,该怎么办lib?这是不可能的吗?例如,我创建了一个带有嵌入式tomcat的启动应用程序jar/war文件,然后另一个团队有了稍后提供的附加功能。我希望原始二进制文件保持不变,而另一个团队只需将lib添加到“附加组件”中即可然后重新开始。@peekay你有没有想过这个问题?我想做一个类似的概念…没有,我从来没有在项目中这样做过,现在我已经转移到另一个机会。