1

我无法在 rPi 上运行 ScadaLTS。

Aug 17, 2017 7:01:14 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Aug 17, 2017 7:01:14 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Aug 17, 2017 7:01:14 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Aug 17, 2017 7:01:14 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Aug 17, 2017 7:01:14 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Aug 17, 2017 7:01:14 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
Aug 17, 2017 7:01:16 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Aug 17, 2017 7:01:16 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1613 ms
Aug 17, 2017 7:01:16 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Aug 17, 2017 7:01:16 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.56 (Debian)
Aug 17, 2017 7:01:16 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/ScadaBR.war
Aug 17, 2017 7:01:29 AM org.apache.catalina.core.StandardContext checkUnusualURLPattern
INFO: Suspicious url pattern: "/**" in context [/ScadaBR] - see sections 12.1 and 12.2 of the Servlet specification
Aug 17, 2017 7:01:30 AM org.apache.tomcat.jdbc.pool.ConnectionPool init
WARNING: maxIdle is larger than maxActive, setting maxIdle to: 80
Aug 17, 2017 7:01:31 AM org.apache.tomcat.jdbc.pool.ConnectionPool init
SEVERE: Unable to create initial connections of pool.
java.sql.SQLException
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:144)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:554)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:242)
    at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:141)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
    at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1110)
    at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:689)
    at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:273)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5413)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1879)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:246)
    ... 36 more

Aug 17, 2017 7:01:31 AM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
java.sql.SQLException
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:144)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:554)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:242)
    at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:141)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
    at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1110)
    at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:689)
    at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:273)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5413)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1879)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:246)
    ... 36 more

Aug 17, 2017 7:01:31 AM org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException
WARN  2017-08-17 07:01:32,986 (org.springframework.security.core.SpringSecurityCoreVersion.performVersionChecks:78) - **** You are advised to use Spring 4.3.4.RELEASE or later with this version. You are running: 4.3.2.RELEASE 
INFO  2017-08-17 07:01:35,506 (com.serotonin.mango.MangoContextListener.contextInitialized:89) - Mango context starting 
INFO  2017-08-17 07:01:38,144 (com.serotonin.mango.MangoContextListener.contextInitialized:138) - Mango context started 
INFO  2017-08-17 07:01:38,405 (com.serotonin.mango.MangoContextListener.contextInitialized:141) - Cache point hierarchy initialized 
INFO  2017-08-17 07:01:38,447 (com.serotonin.mango.MangoContextListener.contextInitialized:148) - Cache views hierarchy initialized 
WARN  2017-08-17 07:01:46,356 (org.springframework.context.support.AbstractApplicationContext.refresh:549) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'handshakeHandler' defined in org.scada_lts.web.ws.config.WebSocketConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.socket.server.HandshakeHandler]: Factory method 'handshakeHandler' threw exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found 
ERROR 2017-08-17 07:01:46,367 (org.springframework.web.servlet.FrameworkServlet.initServletBean:502) - Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'handshakeHandler' defined in org.scada_lts.web.ws.config.WebSocketConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.socket.server.HandshakeHandler]: Factory method 'handshakeHandler' threw exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5264)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5551)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1879)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.socket.server.HandshakeHandler]: Factory method 'handshakeHandler' threw exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 34 more
Caused by: java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found
    at org.springframework.web.socket.server.support.AbstractHandshakeHandler.initRequestUpgradeStrategy(AbstractHandshakeHandler.java:143)
    at org.springframework.web.socket.server.support.AbstractHandshakeHandler.<init>(AbstractHandshakeHandler.java:109)
    at org.springframework.web.socket.server.support.DefaultHandshakeHandler.<init>(DefaultHandshakeHandler.java:35)
    at org.scada_lts.web.ws.config.ScadaHandshakeHandler.<init>(ScadaHandshakeHandler.java:19)
    at org.scada_lts.web.ws.config.WebSocketConfig.handshakeHandler(WebSocketConfig.java:55)
    at org.scada_lts.web.ws.config.WebSocketConfig$$EnhancerBySpringCGLIB$$7f30e4a1.CGLIB$handshakeHandler$0(<generated>)
    at org.scada_lts.web.ws.config.WebSocketConfig$$EnhancerBySpringCGLIB$$7f30e4a1$$FastClassBySpringCGLIB$$9dac466d.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at org.scada_lts.web.ws.config.WebSocketConfig$$EnhancerBySpringCGLIB$$7f30e4a1.handshakeHandler(<generated>)
    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:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 35 more
Aug 17, 2017 7:01:48 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/tomcat7/webapps/ScadaBR.war has finished in 31,513 ms
Aug 17, 2017 7:01:48 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/ScadaLTS.war
Aug 17, 2017 7:01:49 AM org.apache.tomcat.jdbc.pool.ConnectionPool init
WARNING: maxIdle is larger than maxActive, setting maxIdle to: 80
Aug 17, 2017 7:01:49 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/tomcat7/webapps/ScadaLTS.war has finished in 849 ms
Aug 17, 2017 7:01:49 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Aug 17, 2017 7:01:49 AM org.apache.tomcat.jdbc.pool.ConnectionPool init
WARNING: maxIdle is larger than maxActive, setting maxIdle to: 80
Aug 17, 2017 7:01:50 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /var/lib/tomcat7/webapps/ROOT has finished in 767 ms
Aug 17, 2017 7:01:50 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Aug 17, 2017 7:01:50 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 33475 ms

我将 mysql-connetors 复制到 tomcat7 lib:

sudo ln -s /var/lib/tomcat7/webapps/ScadaBR/WEB-INF/lib/mysql-connector-java-3.1.8-bin.jar /usr/share/tomcat7/lib/mysql-connector-java-3.1 .8-bin.jar

sudo ln -s /var/lib/tomcat7/webapps/ScadaBR/WEB-INF/lib/mysql-connector-java-5.1.38-bin.jar /usr/share/tomcat7/lib/mysql-connector-java-5.1 .38-bin.jar

sudo ln -s /var/lib/tomcat7/webapps/ScadaBR/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar /usr/share/tomcat7/lib/mysql-connector-java-5.1 .7-bin.jar

所以我认为这不是问题,但我不知道是什么——有什么建议吗?

4

1 回答 1

0

没关系。

ScadaLTS 可以配置为以几种方式连接数据库。

1.直接连接数据库

在 ScadaLTS/WebContent/WEB-INF/env.properties 中配置

db.type=mysql
db.url=jdbc:mysql://localhost:3306/scadalts
db.username=xxxxx
db.password=xxxxx
db.pool.maxActive=10
db.pool.maxIdle=10

不需要附加到 tomcat mysql-connetor* 库。

2. 使用 JNDI 连接数据库(默认)

在 ScadaLTS/WebContent/WEB-INF/env.properties 中配置

db.type=mysql
db.datasource=true
db.datasourceName=java:comp/env/jdbc/scadalts
#db.url=jdbc:mysql://localhost:3306/scadalts (commented for comparison)
#db.username=xxxxx                           (commented for comparison)
#db.password=xxxxx                           (commented for comparison)
#db.pool.maxActive=10                        (commented for comparison)
#db.pool.maxIdle=10                          (commented for comparison)

Tomcat /tomcat/conf/context.xml 的配置

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <Resource name="jdbc/scadalts"
          auth="Container"
          type="javax.sql.DataSource"
          factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
          testWhileIdle="true"
          testOnBorrow="true"
          testOnReturn="false"
          validationQuery="SELECT 1"
          validationInterval="30000"
          timeBetweenEvictionRunsMillis="30000"
          maxActive="80"
          minIdle="10"
          maxWait="10000"
          initialSize="10"
          removeAbandonedTimeout="1000"
          removeAbandoned="true"
          abandonWhenPercentageFull="75"
          logAbandoned="true"
          minEvictableIdleTimeMillis="30000"
          jmxEnabled="true"          
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
                                                        org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
                                                        org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer;
                                                        org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport(threshold=1500)"
          username="xxxxx"
          password="xxxxx"
          driverClassName="com.mysql.jdbc.Driver"
          defaultTransactionIsolation="READ_COMMITTED"
          url="jdbc:mysql://localhost:3306/scadalts"
         />


<!--     
<Parameter name="javamelody.storage-directory" value="/var/log/tomcat7/javamelody" override="false"/>
 -->    

需要将 mysql-connector-* 复制到 tomcat/libs 目录

更多关于 JNDI 数据源 HOW-TO

总之,比您将 mysql-connector 复制到 tomcat/lib 这很好。

docker scadalts-dev 中可用的已配置系统

如果您仍然有连接问题,那么您正在检查:

  1. 您是否设置了 MySQL 数据库?(例如斯卡达特)
  2. 您是否有正确配置的用户和密码?
  3. 您在配置文件中有正确的数据吗?

在 ScadaLTS/WebContent/WEB-INF/env.properties 中配置

db.type=mysql
db.datasource=true
db.datasourceName=java:comp/env/jdbc/scadalts

Tomcat /tomcat/conf/context.xml 的配置

<?xml version="1.0" encoding="UTF-8"?>
<Context>
          ...
          username="xxxxx"
          password="xxxxx"
          driverClassName="com.mysql.jdbc.Driver"
          ...
          url="jdbc:mysql://localhost:3306/scadalts"
         />
         ...
</Context>
于 2017-08-17T09:10:44.220 回答