简体   繁体   中英

Spring Boot Cannot load External jar during deployment to Tomcat

i've been working nicely on Spring boot 1.2 using embeded server (running using spring boot app) with an external jar (Database driver Postgis) which was added to the class path. but when i tried to deploy and run it on TomCat 8 in eclipse. i got this error Cannot load driver class: org.postgis.DriverWrapper

Any Help please

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);
}
}

application.properties

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

EDIT 1 JConsole of classpath

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>

If you have the library on your build classpath, it does not mean that you also have it on the classpath of you running application. One way (from my point of view the better way) is the one which geogeek describes and pack the library to the war archive. Another way is to copy the jar library to /lib folder of your Tomcat.

I hope it helps!

解决此问题的最佳方法是将jar添加到内部Maven存储库中(如本文中所述),以避免管理类路径及其麻烦,因此所有jar都打包在war文件中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM