I'm working on project for studies. Now I am at the stage of moving project to docker containers. I have placet tomcat with my website and mysql with database do docker-compose.yml. Unfortunately classes from tomcat can't connect with database
Java code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Waliduj {
String url="jdbc:mysql://localhost:3306/uczelnia?useTimezone=true&serverTimezone=UTC";
String username="root";
String password="121212";
public boolean Waliduje(String uname,String pass) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url,username,password);
PreparedStatement st=con.prepareStatement("SELECT email,haslo FROM logowanie WHERE email=? AND haslo=?");
st.setString(1,uname);
st.setString(2,pass);
ResultSet rs = st.executeQuery();
if(rs.next()) {
return true;
}
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException se) {
// TODO Auto-generated catch block
se.printStackTrace();
}
return false;
}
}
Dockerfile code
FROM tomcat:8.0.41-jre8
COPY ./webapp /usr/local/tomcat/webapps/webapp
CMD ["catalina.sh", "run"]
docker-compose.yml code
version: '3'
services:
web:
build: .
ports:
- "8080:8080"
links:
- "db:uczelnia"
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: 121212
MYSQL_DATABASE: uczelnia
ports:
- "3306:3306"
PhpMyAdmin:
image: nazarpc/phpmyadmin
ports:
- "8090:80"
links:
- db:mysql
Error code
web_1 | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
web_1 |
web_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
web_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:172)
web_1 | at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
web_1 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:862)
web_1 | at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:444)
web_1 | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:230)
web_1 | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:226)
web_1 | at java.sql.DriverManager.getConnection(DriverManager.java:664)
web_1 | at java.sql.DriverManager.getConnection(DriverManager.java:247)
web_1 | at com.login.walidacja.Waliduj.Waliduje(Waliduj.java:20)
web_1 | at com.login.Login.doPost(Login.java:27)
web_1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
web_1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
web_1 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
web_1 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
web_1 | at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
web_1 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
web_1 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
web_1 | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
web_1 | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
web_1 | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
web_1 | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
web_1 | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
web_1 | at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
web_1 | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
web_1 | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
web_1 | at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
web_1 | at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
web_1 | at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)
web_1 | at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)
web_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
web_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
web_1 | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
web_1 | at java.lang.Thread.run(Thread.java:745)
web_1 | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
web_1 |
web_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
web_1 | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
web_1 | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
web_1 | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
web_1 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
web_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:59)
web_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:103)
web_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:149)
web_1 | at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:165)
web_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:92)
web_1 | at com.mysql.cj.NativeSession.connect(NativeSession.java:152)
web_1 | at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:982)
web_1 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:852)
web_1 | ... 30 more
web_1 | Caused by: java.net.ConnectException: Connection refused (Connection refused)
web_1 | at java.net.PlainSocketImpl.socketConnect(Native Method)
web_1 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
web_1 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
web_1 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
web_1 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
web_1 | at java.net.Socket.connect(Socket.java:589)
web_1 | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:173)
web_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:66)
web_1 | ... 33 more
Additional informations:
I'm working on windows 10 so docker is on windows too.
I apologize for spelling errors but I'm from poland so english is not
my
Via the compose file, your database service will be referencable on the network via db. The links keyword isn't necessary unless you simply need a different name for your container. If you change your java code to connect to jdbc:mysql://db:3306/uczelnia?useTimezone=true&serverTimezone=UTC it should work as expected.
https://docs.docker.com/compose/networking/
Related
I am using this docker - compose.yml.
services:
postgres:
image: postgres:14.3-alpine
volumes:
- C:\Postgres:/var/lib/postgresql/data
environment:
POSTGRES_DB: jbpm
POSTGRES_USER: jbpm
POSTGRES_PASSWORD: jbpm
ports:
- 5432:5432
jbpm:
image: quay.io/kiegroup/jbpm-server-full
environment:
JBPM_DB_DRIVER: postgres
JBPM_DB_HOST: postgres
ports:
- 8080:8080
- 8001:8081
depends_on:
- postgres
But i keep receiving the message error:
| 23:15:58,475 INFO [io.jaegertracing.internal.reporters.RemoteReporter] (jaeger.RemoteReporter-QueueProcessor) FlushCommand is working again!
jbpm_1 | 23:16:07,477 WARN [io.jaegertracing.internal.reporters.RemoteReporter] (jaeger.RemoteReporter-QueueProcessor) FlushCommand execution failed! Repeated errors of this command will not be logged.: io.jaegertracing.internal.exceptions.SenderException: Failed to flush spans.
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.thrift.internal.senders.ThriftSender.flush(ThriftSender.java:115)
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.internal.reporters.RemoteReporter$FlushCommand.execute(RemoteReporter.java:160)
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.internal.reporters.RemoteReporter$QueueProcessor.run(RemoteReporter.java:182)
jbpm_1 | at java.base/java.lang.Thread.run(Thread.java:834)
jbpm_1 | Caused by: io.jaegertracing.internal.exceptions.SenderException: Could not send 1 spans
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.thrift.internal.senders.UdpSender.send(UdpSender.java:85)
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.thrift.internal.senders.ThriftSender.flush(ThriftSender.java:113)
jbpm_1 | ... 3 more
jbpm_1 | Caused by: org.apache.thrift.transport.TTransportException: Cannot flush closed transport
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.thrift.internal.reporters.protocols.ThriftUdpTransport.flush(ThriftUdpTransport.java:148)
jbpm_1 | at org.apache.thrift#0.13.0//org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:73)
jbpm_1 | at org.apache.thrift#0.13.0//org.apache.thrift.TServiceClient.sendBaseOneway(TServiceClient.java:66)
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.agent.thrift.Agent$Client.send_emitBatch(Agent.java:70)
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.agent.thrift.Agent$Client.emitBatch(Agent.java:63)
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.thrift.internal.senders.UdpSender.send(UdpSender.java:83)
jbpm_1 | ... 4 more
jbpm_1 | Caused by: java.net.PortUnreachableException: ICMP Port Unreachable
jbpm_1 | at java.base/java.net.PlainDatagramSocketImpl.send(Native Method)
jbpm_1 | at java.base/java.net.DatagramSocket.send(DatagramSocket.java:695)
jbpm_1 | at io.jaegertracing.jaeger#1.5.0//io.jaegertracing.thrift.internal.reporters.protocols.ThriftUdpTransport.flush(ThriftUdpTransport.java:146)
jbpm_1 | ... 9 more
jbpm_1 |
jbpm_1 | 23:16:08,477 IN
The documentation can be found in https://www.jbpm.org/learn/gettingStartedUsingDocker.html. And some examples in https://github.com/jboss-dockerfiles/business-central/tree/main/docker-compose-examples.
Can you help me? I have been trying several suggestions but none works.
If you don't use it in standalone.xml, You can disable this by remove :
<subsystem xmlns="urn:wildfly:microprofile-opentracing-smallrye:3.0" default-tracer="jaeger">
<jaeger-tracer name="jaeger">
<sampler-configuration sampler-type="const" sampler-param="1.0"/>
</jaeger-tracer>
I'm just trying to setup a starter project based on Spring Boot and MySQL using Docker. So I tried to run this github project on the Docker. But I am unable to establish connection between Java and MySQL.
I'm running Ubuntu 16.04.
I'm getting "Failed to create/setup connection: Communications link failure...." error while executing "docker-compose up" command.
Also this error doesn't show up if I use Docker Client. Like when I do as:
# 1. docker run -d -p 6033:3306 --name=docker-mysql --env="MYSQL_ROOT_PASSWORD=root" --env="MYSQL_PASSWORD=root" --env="MYSQL_DATABASE=book_manager" mysql
# 2. docker build -t springio/gs-spring-boot-docker .
# 3. docker run -t --link docker-mysql:mysql -p 10222:10222 springio/gs-spring-boot-docker
I tried to setup same environment through docker-compose but somehow its not working.
Below are the configuration details:
application.properties
logging.level.org.springframework=INFO
logging.level.com.mkyong=INFO
logging.level.com.zaxxer=DEBUG
logging.level.root=ERROR
logging.pattern.console=%-5level %logger{36} - %msg%n
## MySQL
spring.datasource.url=jdbc:mysql://docker-mysql:3306/book_manager
spring.datasource.username=root
spring.datasource.password=root
server.port=10222
connection.driver.class = com.mysql.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQLDialect
#`hibernate_sequence' doesn't exist
spring.jpa.hibernate.use-new-id-generator-mappings=false
hibernate.show_sql=false
#drop n create table again, good for testing, comment this in production
spring.jpa.hibernate.ddl-auto=create
Dockerfile for the java application container (service)
FROM openjdk:8-jdk-alpine
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} spring-data-jpa-mysql-1.0.jar
ENTRYPOINT ["java","-jar","/spring-data-jpa-mysql-1.0.jar"]
docker-compose.yml
version: '3'
services:
docker-mysql:
restart: always
container_name: docker-mysql
image: mysql
environment:
MYSQL_DATABASE: book_manager
MYSQL_ROOT_PASSWORD: root
ports:
- "6033:3306"
networks:
- spring-boot-mysql-network
book-manager-app:
build:
context: ./
dockerfile: Dockerfile
expose:
- "10222"
ports:
- "10222:10222"
depends_on:
- "docker-mysql"
networks:
- spring-boot-mysql-network
networks:
spring-boot-mysql-network:
driver: bridge
The following is the error log that I'm getting:
$/spring-data-jpa-mysql-compose$ docker-compose up
Creating network "spring-data-jpa-mysql-compose_spring-boot-mysql-network" with driver "bridge"
Creating docker-mysql ... done
Creating spring-data-jpa-mysql-compose_book-manager-app_1 ... done
Attaching to docker-mysql, spring-data-jpa-mysql-compose_book-manager-app_1
docker-mysql | 2020-04-07 13:44:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian10 started.
docker-mysql | 2020-04-07 13:44:39+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
docker-mysql | 2020-04-07 13:44:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian10 started.
docker-mysql | 2020-04-07 13:44:39+00:00 [Note] [Entrypoint]: Initializing database files
docker-mysql | 2020-04-07T13:44:39.855069Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
docker-mysql | 2020-04-07T13:44:39.855190Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.19) initializing of server in progress as process 42
book-manager-app_1 |
book-manager-app_1 | . ____ _ __ _ _
book-manager-app_1 | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
book-manager-app_1 | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
book-manager-app_1 | \\/ ___)| |_)| | | | | || (_| | ) ) ) )
book-manager-app_1 | ' |____| .__|_| |_|_| |_\__, | / / / /
book-manager-app_1 | =========|_|==============|___/=/_/_/_/
book-manager-app_1 | :: Spring Boot :: (v2.1.2.RELEASE)
book-manager-app_1 |
book-manager-app_1 | INFO com.mkyong.StartApplication - Starting StartApplication v1.0 on 3638e84181ae with PID 1 (/spring-data-jpa-mysql-1.0.jar started by root in /)
book-manager-app_1 | INFO com.mkyong.StartApplication - No active profile set, falling back to default profiles: default
book-manager-app_1 | INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data repositories in DEFAULT mode.
book-manager-app_1 | INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 134ms. Found 1 repository interfaces.
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - Driver class com.mysql.cj.jdbc.Driver found in Thread context class loader org.springframework.boot.loader.LaunchedURLClassLoader#5d099f62
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration:
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension.............false
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - autoCommit......................true
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - catalog.........................none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql...............none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery.............none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout...............30000
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - dataSource......................none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName.............none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI..................none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties............{password=<masked>}
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................."com.mysql.cj.jdbc.Driver"
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties...........{}
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry.............none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout.....................600000
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout.......1
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries..........false
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl.........................jdbc:mysql://docker-mysql:3306/book_manager
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold..........0
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime.....................1800000
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize.................10
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry..................none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory...........none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle.....................10
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - password........................<masked>
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - poolName........................"HikariPool-1"
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - readOnly........................false
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans..................false
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor...............none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - schema..........................none
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - threadFactory...................internal
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation............default
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - username........................"root"
book-manager-app_1 | DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout...............5000
book-manager-app_1 | INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
book-manager-app_1 | DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Failed to create/setup connection: Communications link failure
book-manager-app_1 |
book-manager-app_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
book-manager-app_1 | DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Cannot acquire connection from data source
book-manager-app_1 | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
book-manager-app_1 |
book-manager-app_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
book-manager-app_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
book-manager-app_1 | at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
book-manager-app_1 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
book-manager-app_1 | at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
book-manager-app_1 | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
book-manager-app_1 | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
book-manager-app_1 | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136)
book-manager-app_1 | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369)
book-manager-app_1 | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198)
book-manager-app_1 | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467)
book-manager-app_1 | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541)
book-manager-app_1 | at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
book-manager-app_1 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
book-manager-app_1 | at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157)
book-manager-app_1 | at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115)
book-manager-app_1 | at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78)
book-manager-app_1 | at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319)
book-manager-app_1 | at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:356)
book-manager-app_1 | at org.springframework.boot.autoconfigure.orm.jpa.DatabaseLookup.getDatabase(DatabaseLookup.java:73)
book-manager-app_1 | at org.springframework.boot.autoconfigure.orm.jpa.JpaProperties.determineDatabase(JpaProperties.java:142)
book-manager-app_1 | at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.jpaVendorAdapter(JpaBaseConfiguration.java:112)
book-manager-app_1 | at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration$$EnhancerBySpringCGLIB$$ff868e63.CGLIB$jpaVendorAdapter$8(<generated>)
book-manager-app_1 | at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration$$EnhancerBySpringCGLIB$$ff868e63$$FastClassBySpringCGLIB$$5875e117.invoke(<generated>)
book-manager-app_1 | at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
book-manager-app_1 | at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
book-manager-app_1 | at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration$$EnhancerBySpringCGLIB$$ff868e63.jpaVendorAdapter(<generated>)
book-manager-app_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
book-manager-app_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
book-manager-app_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
book-manager-app_1 | at java.lang.reflect.Method.invoke(Method.java:498)
book-manager-app_1 | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
book-manager-app_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
book-manager-app_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
book-manager-app_1 | at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
book-manager-app_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)
book-manager-app_1 | at com.mysql.cj.NativeSession.connect(NativeSession.java:152)
book-manager-app_1 | at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:955)
book-manager-app_1 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
book-manager-app_1 | ... 83 common frames omitted
book-manager-app_1 | Caused by: java.net.ConnectException: Connection refused (Connection refused)
book-manager-app_1 | at java.net.PlainSocketImpl.socketConnect(Native Method)
book-manager-app_1 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
book-manager-app_1 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
book-manager-app_1 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
book-manager-app_1 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
book-manager-app_1 | at java.net.Socket.connect(Socket.java:589)
book-manager-app_1 | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
book-manager-app_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)
book-manager-app_1 | ... 86 common frames omitted
book-manager-app_1 | ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
book-manager-app_1 | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
book-manager-app_1 |
book-manager-app_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
book-manager-app_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
book-manager-app_1 | at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
book-manager-app_1 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
book-manager-app_1 | at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
book-manager-app_1 | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
book-manager-app_1 | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
book-manager-app_1 | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136)
book-manager-app_1 | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369)
book-manager-app_1 | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198)
book-manager-app_1 | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467)
book-manager-app_1 | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541)
book-manager-app_1 | at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
book-manager-app_1 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
book-manager-app_1 | at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157)
book-manager-app_1 | at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115)
book-manager-app_1 | at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78)
book-manager-app_1 | at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319)
book-manager-app_1 | at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:356)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
book-manager-app_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
book-manager-app_1 | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
book-manager-app_1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:853)
book-manager-app_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
book-manager-app_1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
book-manager-app_1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
book-manager-app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
book-manager-app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
book-manager-app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
book-manager-app_1 | at com.mkyong.StartApplication.main(StartApplication.java:19)
book-manager-app_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
book-manager-app_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
book-manager-app_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
book-manager-app_1 | at java.lang.reflect.Method.invoke(Method.java:498)
book-manager-app_1 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
book-manager-app_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
book-manager-app_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
book-manager-app_1 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
book-manager-app_1 | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
book-org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
book-manager-app_1 | at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
book-manager-app_1 | at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMertiesSet(AbstractEntityManagerFactoryBean.java:377)
book-manager-app_1 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
book-manager-app_1 | at java.lang.reflect.Method.invoke(Method.java:498)
book-manager-app_1 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
book-manager-app_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
book-manager-app_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
book-manager-app_1 | at com.cketImpl.java:392)
book-manager-app_1 | at java.net.Socket.connect(Socket.java:589)
book-manager-app_1 | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
book-manager-app_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)
book-manager-app_1 | ... 59 common frames omitted
book-manager-app_1 | WARN o.s.c.a.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
book-manager-app_1 | INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener -
book-manager-app_1 |
book-manager-app_1 | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
book-manager-app_1 | ERROR o.s.boot.SpringApplication - Application run failed
book-manager-app_1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(Abstractorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:853)
book-manager-app_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
book-manager-app_1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
book-manager-app_1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
book-manager-app_1 | Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
book-manager-app_1 | at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentityManagerFactoryBuilderImpl.java:904)
book-manager-app_1 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:935)
book-manager-app_1 | at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityMaAbstractEntityManagerFactoryBean.java:377)
book-manager-app_1 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804)
book-manager-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741)
book-manager-app_1 | ... 23 common frames omitted
book-manager-app_1 | Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
book-manager-app_1 | at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImporg.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:94)
book-manager-app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
book-manager-app_1 | ... 40 common frames omitted
spring-data-jpa-mysql-compose_book-manager-app_1 exited with code 1
Below is my application.properties file
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/test?autoReconnect=true
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=true
Below is my docker-compose.yml file
version: '3'
services:
docker-mysql:
image: mysql:latest
ports:
- 3306
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
- MYSQL_PASSWORD=root
spring-boot-jpa-docker-webapp:
image: springboot_docker
depends_on:
- docker-mysql
ports:
- 8080:8080
environment:
- DATABASE_HOST=docker-mysql
- DATABASE_USER=root
- DATABASE_PASSWORD=root
- DATABASE_NAME=test
- DATABASE_PORT=3306
Application is exited with
Caused by: java.net.ConnectException: Connection refused (Connection
refused)
Caused by: java.sql.SQLNonTransientConnectionException: Could not
create connection to database server. Attempted reconnect 3 times.
Giving up.
Caused by: java.net.ConnectException: Connection refused (Connection
refused)
git_spring-boot-jpa-docker-webapp_1 exited with code 1
Update 1: New error after correction to docker-compose
docker-mysql_1 | Initializing database
docker-mysql_1 | 2019-02-13T20:34:44.351044Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
docker-mysql_1 | 2019-02-13T20:34:44.351123Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.15) initializing of server in progress as process 29
docker-mysql_1 | 2019-02-13T20:34:44.352587Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
docker-mysql_1 | 2019-02-13T20:34:44.352592Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/lib/mysql/ is unusable. You can safely remove it.
docker-mysql_1 | 2019-02-13T20:34:44.352638Z 0 [ERROR] [MY-010119] [Server] Aborting
docker-mysql_1 | 2019-02-13T20:34:44.353948Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15) MySQL Community Server - GPL.
spring-boot-jpa-docker-webapp_1 |
spring-boot-jpa-docker-webapp_1 | 2019-02-13 21:02:22.562 WARN 1 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08001
spring-boot-jpa-docker-webapp_1 | 2019-02-13 21:02:22.562 ERROR 1 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Could not create connection to database server. Attempted reconnect 3 times. Giving up.
spring-boot-jpa-docker-webapp_1 | 2019-02-13 21:02:22.569 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
spring-boot-jpa-docker-webapp_1 | 2019-02-13 21:02:22.573 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
spring-boot-jpa-docker-webapp_1 | 2019-02-13 21:02:22.596 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :
spring-boot-jpa-docker-webapp_1 |
spring-boot-jpa-docker-webapp_1 | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
spring-boot-jpa-docker-webapp_1 | 2019-02-13 21:02:22.601 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
spring-boot-jpa-docker-webapp_1 |
spring-boot-jpa-docker-webapp_1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) ~[spring-context-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:853) ~[spring-context-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.2.RELEASE.jar!/:2.1.2.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.2.RELEASE.jar!/:2.1.2.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.2.RELEASE.jar!/:2.1.2.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.2.RELEASE.jar!/:2.1.2.RELEASE]
spring-boot-jpa-docker-webapp_1 | at com.github.Application.main(Application.java:15) ~[classes!/:1.0-SNAPSHOT]
spring-boot-jpa-docker-webapp_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[spring-boot-docker-1.0.jar:1.0-SNAPSHOT]
spring-boot-jpa-docker-webapp_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[spring-boot-docker-1.0.jar:1.0-SNAPSHOT]
spring-boot-jpa-docker-webapp_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) ~[spring-boot-docker-1.0.jar:1.0-SNAPSHOT]
spring-boot-jpa-docker-webapp_1 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) ~[spring-boot-docker-1.0.jar:1.0-SNAPSHOT]
spring-boot-jpa-docker-webapp_1 | Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
spring-boot-jpa-docker-webapp_1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:402) ~[spring-orm-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) ~[spring-orm-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) ~[spring-beans-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | ... 22 common frames omitted
spring-boot-jpa-docker-webapp_1 | Caused by: org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
spring-boot-jpa-docker-webapp_1 | at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:48) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:69) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.jdbcStatement(GenerationTargetToDatabase.java:77) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:53) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:375) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:241) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:144) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57) ~[spring-orm-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) ~[spring-orm-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
spring-boot-jpa-docker-webapp_1 | ... 26 common frames omitted
spring-boot-jpa-docker-webapp_1 | Caused by: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:905) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:830) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136) ~[HikariCP-3.2.0.jar!/:na]
spring-boot-jpa-docker-webapp_1 | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369) ~[HikariCP-3.2.0.jar!/:na]
spring-boot-jpa-docker-webapp_1 | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198) ~[HikariCP-3.2.0.jar!/:na]
spring-boot-jpa-docker-webapp_1 | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467) ~[HikariCP-3.2.0.jar!/:na]
spring-boot-jpa-docker-webapp_1 | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541) ~[HikariCP-3.2.0.jar!/:na]
spring-boot-jpa-docker-webapp_1 | at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-3.2.0.jar!/:na]
spring-boot-jpa-docker-webapp_1 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.2.0.jar!/:na]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:43) ~[hibernate-core-5.3.7.Final.jar!/:5.3.7.Final]
spring-boot-jpa-docker-webapp_1 | ... 42 common frames omitted
spring-boot-jpa-docker-webapp_1 | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
spring-boot-jpa-docker-webapp_1 |
spring-boot-jpa-docker-webapp_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
spring-boot-jpa-docker-webapp_1 | at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.NativeSession.connect(NativeSession.java:152) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:849) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | ... 56 common frames omitted
spring-boot-jpa-docker-webapp_1 | Caused by: java.net.ConnectException: Connection refused (Connection refused)
spring-boot-jpa-docker-webapp_1 | at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at java.base/java.net.Socket.connect(Socket.java:591) ~[na:na]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
spring-boot-jpa-docker-webapp_1 | ... 58 common frames omitted
You are passing the DATABASE_HOST, DATABASE_PORT, DATABASE_NAME, DATABASE_USER and DATABASE_PASSWORD but you are not using it inside your app.
Update your properties like this. (Better if your create a profile so that you app runs outside of docker)
spring.datasource.url=jdbc:mysql://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}?autoReconnect=true
spring.datasource.username=${DATABASE_USER}
spring.datasource.password=${DATABASE_PASSWORD}
If you really want to use localhost as your db_url. You can also use network_mode: "service:[service name]" property of docker compose. Only downside is that this property cannot be used with port property.
version: '3'
services:
docker-mysql:
image: mysql:latest
network_mode: "service:spring-boot-jpa-docker-webapp"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
- MYSQL_PASSWORD=root
spring-boot-jpa-docker-webapp:
image: springboot_docker
depends_on:
- docker-mysql
ports:
- 8080:8080
- 3306 #Add this only if you want to expose the mysql to outer world.
environment:
- DATABASE_USER=root
- DATABASE_PASSWORD=root
- DATABASE_NAME=test
And your properties file could look like
spring.datasource.url=jdbc:mysql://localhost:3306/${DATABASE_NAME}?autoReconnect=true
spring.datasource.username=${DATABASE_USER}
spring.datasource.password=${DATABASE_PASSWORD}
Containers in compose services can connect to other containers by using name, e.g. try to ping database container from spring-boot container.
Check if you can ping database container
docker-compose exec spring-boot-jpa-docker-webapp /bin/bash
once you are in the shell (You may have to install ping in spring-boot container for testing only apt-get install iputils-ping or yum install depending on image container is based on)
ping docker-mysql
if ping is successful then it means you can connect to database
replace database url in application.properties with
spring.datasource.url=jdbc:mysql://docker-mysql:3306/test?autoReconnect=true
Minimal Example for Mysql
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- "./volumes/database:/var/lib/mysql"
Try following docker-compose
version: "3.7"
services:
docker-mysql:
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
volumes:
- "./volumes/database:/var/lib/mysql"
networks:
- spring_net
spring-boot-jpa-docker-webapp:
image: springboot_docker
ports:
- "8080:8080"
networks:
- spring_net
networks:
spring_net:
I'm really stuck with a problem
I have built an Axis 2 client running against an API using a .WSDL file. I have used a local jetty server when I have developed, but I need to move it over to a local tomcat server. When I moved my .war file to the local Tomcat, I get the following error. Can someone please give me some advice so I'm going in the right direction
SLL debug in tomcat:
http-nio-8080-exec-1, WRITE: TLSv1.2 Handshake, length = 189
http-nio-8080-exec-1, handling exception: java.net.SocketException: Connection reset
http-nio-8080-exec-1, SEND TLSv1.2 ALERT: fatal, description = unexpected_message
http-nio-8080-exec-1, WRITE: TLSv1.2 Alert, length = 2
http-nio-8080-exec-1, Exception sending alert: java.net.SocketException: Connection reset by peer: socket write error
http-nio-8080-exec-1, called closeSocket()
http-nio-8080-exec-1, called close()
http-nio-8080-exec-1, called closeInternal(true)
A
INFO | jvm 1 | 2016/12/21 13:28:59.193 | Unable to sendViaPost to url[https://someurl.com/Service.svc]
INFO | jvm 1 | 2016/12/21 13:28:59.194 | org.apache.axis2.AxisFault: Connection reset
INFO | jvm 1 | 2016/12/21 13:28:59.196 | at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
INFO | jvm 1 | 2016/12/21 13:28:59.197 | at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:99)
INFO | jvm 1 | 2016/12/21 13:28:59.198 | at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
INFO | jvm 1 | 2016/12/21 13:28:59.199 | at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
INFO | jvm 1 | 2016/12/21 13:28:59.201 | at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
INFO | jvm 1 | 2016/12/21 13:28:59.204 | at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
INFO | jvm 1 | 2016/12/21 13:28:59.205 | at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
INFO | jvm 1 | 2016/12/21 13:28:59.206 | at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
INFO | jvm 1 | 2016/12/21 13:28:59.207 | at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.executeMethod(HTTPSenderImpl.java:900)
INFO | jvm 1 | 2016/12/21 13:28:59.209 | at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.sendViaPost(HTTPSenderImpl.java:212)
INFO | jvm 1 | 2016/12/21 13:28:59.213 | at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:121)
INFO | jvm 1 | 2016/12/21 13:28:59.215 | at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:403)
INFO | jvm 1 | 2016/12/21 13:28:59.218 | at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:234)
INFO | jvm 1 | 2016/12/21 13:28:59.220 | at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431)
INFO | jvm 1 | 2016/12/21 13:28:59.222 | at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399)
INFO | jvm 1 | 2016/12/21 13:28:59.224 | at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
INFO | jvm 1 | 2016/12/21 13:28:59.227 | at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
INFO | jvm 1 | 2016/12/21 13:28:59.229 | at se.docpub.documentfolderservice.DocumentFolderServiceStub.loadFolder(DocumentFolderServiceStub.java:769)
INFO | jvm 1 | 2016/12/21 13:28:59.231 | at se.soleilit.document_api.resources.DocumentResource.getPublishedFolder(DocumentResource.java:96)
INFO | jvm 1 | 2016/12/21 13:28:59.233 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2016/12/21 13:28:59.235 | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:28:59.236 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:28:59.237 | at java.lang.reflect.Method.invoke(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:28:59.239 | at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
INFO | jvm 1 | 2016/12/21 13:28:59.246 | at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
INFO | jvm 1 | 2016/12/21 13:28:59.250 | at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
INFO | jvm 1 | 2016/12/21 13:28:59.255 | at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205)
INFO | jvm 1 | 2016/12/21 13:28:59.265 | at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
INFO | jvm 1 | 2016/12/21 13:28:59.270 | at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
INFO | jvm 1 | 2016/12/21 13:28:59.279 | at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
INFO | jvm 1 | 2016/12/21 13:28:59.283 | at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
INFO | jvm 1 | 2016/12/21 13:28:59.290 | at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
INFO | jvm 1 | 2016/12/21 13:28:59.298 | at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
INFO | jvm 1 | 2016/12/21 13:28:59.302 | at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
INFO | jvm 1 | 2016/12/21 13:28:59.304 | at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
INFO | jvm 1 | 2016/12/21 13:28:59.306 | at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
INFO | jvm 1 | 2016/12/21 13:28:59.308 | at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
INFO | jvm 1 | 2016/12/21 13:28:59.314 | at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
INFO | jvm 1 | 2016/12/21 13:28:59.316 | at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
INFO | jvm 1 | 2016/12/21 13:28:59.324 | at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
INFO | jvm 1 | 2016/12/21 13:28:59.330 | at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
INFO | jvm 1 | 2016/12/21 13:28:59.333 | at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
INFO | jvm 1 | 2016/12/21 13:28:59.336 | at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
INFO | jvm 1 | 2016/12/21 13:28:59.339 | at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
INFO | jvm 1 | 2016/12/21 13:28:59.345 | at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
INFO | jvm 1 | 2016/12/21 13:28:59.348 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
INFO | jvm 1 | 2016/12/21 13:28:59.352 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
INFO | jvm 1 | 2016/12/21 13:28:59.354 | at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
INFO | jvm 1 | 2016/12/21 13:28:59.356 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
INFO | jvm 1 | 2016/12/21 13:28:59.357 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
INFO | jvm 1 | 2016/12/21 13:28:59.363 | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
INFO | jvm 1 | 2016/12/21 13:28:59.365 | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
INFO | jvm 1 | 2016/12/21 13:28:59.367 | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
INFO | jvm 1 | 2016/12/21 13:28:59.369 | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
INFO | jvm 1 | 2016/12/21 13:28:59.371 | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
INFO | jvm 1 | 2016/12/21 13:28:59.373 | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
INFO | jvm 1 | 2016/12/21 13:28:59.375 | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
INFO | jvm 1 | 2016/12/21 13:28:59.376 | at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
INFO | jvm 1 | 2016/12/21 13:29:00.224 | at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
INFO | jvm 1 | 2016/12/21 13:29:00.532 | at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
INFO | jvm 1 | 2016/12/21 13:29:00.534 | at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
INFO | jvm 1 | 2016/12/21 13:29:00.535 | at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.537 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.539 | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
INFO | jvm 1 | 2016/12/21 13:29:00.541 | at java.lang.Thread.run(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.542 | Caused by: java.net.SocketException: Connection reset
INFO | jvm 1 | 2016/12/21 13:29:00.543 | at java.net.SocketInputStream.read(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.555 | at java.net.SocketInputStream.read(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.558 | at sun.security.ssl.InputRecord.readFully(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.560 | at sun.security.ssl.InputRecord.readV3Record(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.573 | at sun.security.ssl.InputRecord.read(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.590 | at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.593 | at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.618 | at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.621 | at sun.security.ssl.AppOutputStream.write(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.656 | at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.659 | at java.io.BufferedOutputStream.flush(Unknown Source)
INFO | jvm 1 | 2016/12/21 13:29:00.726 | at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:95)
INFO | jvm 1 | 2016/12/21 13:29:00.738 | ... 63 more
I'm trying to use dropwizard-websockets v1.2 with dropwizard 1.0.3 but getting the below error. Is dropwizard-guice getting in the way?
web_1 | WARN [2016-12-21 12:50:53,665] org.eclipse.jetty.servlet.ServletHandler:
web_1 | ! java.lang.NoSuchMethodError: org.eclipse.jetty.io.AbstractConnection.<init>(Lorg/eclipse/jetty/io/EndPoint;Ljava/util/concurrent/Executor;Z)V
web_1 | ! at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.<init>(AbstractWebSocketConnection.java:225)
web_1 | ! at org.eclipse.jetty.websocket.server.WebSocketServerConnection.<init>(WebSocketServerConnection.java:41)
web_1 | ! at org.eclipse.jetty.websocket.server.WebSocketServerFactory.upgrade(WebSocketServerFactory.java:520)
web_1 | ! at org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:186)
web_1 | ! at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:206)
web_1 | ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
web_1 | ! at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:34)
web_1 | ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
web_1 | ! at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:50)
web_1 | ! at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:44)
web_1 | ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
web_1 | ! at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:119)
web_1 | ! at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)
web_1 | ! at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)
web_1 | ! at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)
web_1 | ! at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)
web_1 | ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
web_1 | ! at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
web_1 | ! at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
web_1 | ! at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
web_1 | ! at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
web_1 | ! at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
web_1 | ! at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
web_1 | ! at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
web_1 | ! at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
web_1 | ! at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
web_1 | ! at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
web_1 | ! at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
web_1 | ! ... 26 common frames omitted
web_1 | ! Causing: javax.servlet.ServletException: Filtered request failed.
web_1 | ! at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:384)
web_1 | ! at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
web_1 | ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
web_1 | ! at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
web_1 | ! at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
web_1 | ! at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
web_1 | ! at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
web_1 | ! at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
web_1 | ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
web_1 | ! at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:240)
web_1 | ! at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51)
web_1 | ! at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:459)
web_1 | ! at io.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:68)
web_1 | ! at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)
web_1 | ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
web_1 | ! at org.eclipse.jetty.server.Server.handle(Server.java:524)
web_1 | ! at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
web_1 | ! at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
web_1 | ! at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
web_1 | ! at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
web_1 | ! at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
web_1 | ! at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
web_1 | ! at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
web_1 | ! at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
web_1 | ! at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
web_1 | ! at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
web_1 | ! at java.lang.Thread.run(Thread.java:745)
Maven central holds a version 1.2 of dropwizard-websockets, which is old and out of date but a higher number than more recent versions so displayed by default.
Version 1.0.0-1 works fine.