Solucionado (ver solução)
Solucionado
(ver solução)
5
respostas

Erro

quando eu uso a seguinte dependência abaixo

<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>3.4.2</version>
  </dependency

retorna o seguinte erro, o que pode ser?

com.mongodb.MongoSocketOpenException: Exception opening socket
    at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongodb-driver-core-3.4.2.jar:na]
    at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongodb-driver-core-3.4.2.jar:na]
    at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongodb-driver-core-3.4.2.jar:na]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_192]
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_192]
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_192]
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_192]
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_192]
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_192]
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_192]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_192]
    at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_192]
    at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:57) ~[mongodb-driver-core-3.4.2.jar:na]
    at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongodb-driver-core-3.4.2.jar:na]
    ... 3 common frames omitted

2018-11-12 23:43:54.722  INFO 5164 --- [      Thread-14] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5cc7e2cf: startup date [Mon Nov 12 23:43:38 BRST 2018]; root of context hierarchy
2018-11-12 23:43:54.725  INFO 5164 --- [      Thread-14] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

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

2018-11-12 23:43:54.942  INFO 5164 --- [  restartedMain] b.c.d.s.ServicesgeoApplication           : Starting ServicesgeoApplication on lundy-PC with PID 5164 (C:\Users\lundy\eclipse-workspace\servicesgeo\target\classes started by lundy in C:\Users\lundy\eclipse-workspace\servicesgeo)
2018-11-12 23:43:54.942  INFO 5164 --- [  restartedMain] b.c.d.s.ServicesgeoApplication           : No active profile set, falling back to default profiles: default
2018-11-12 23:43:54.958  INFO 5164 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@62eed072: startup date [Mon Nov 12 23:43:54 BRST 2018]; root of context hierarchy
2018-11-12 23:43:55.361  INFO 5164 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-11-12 23:43:55.362  INFO 5164 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service Tomcat
2018-11-12 23:43:55.362  INFO 5164 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.14
2018-11-12 23:43:55.375  INFO 5164 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-11-12 23:43:55.375  INFO 5164 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 417 ms
2018-11-12 23:43:55.399  INFO 5164 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-11-12 23:43:55.399  INFO 5164 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
5 respostas

ja e eu uso essa dependencia


<dependencies>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver-sync</artifactId>
        <version>3.9.0</version>
    </dependency>
</dependencies>

retorna o erro abaixo, e posso colocar a porta que for que da o mesmo erro

APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

2018-11-12 23:48:47.672  INFO 5408 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'


e mesmo dano os erros acima, percebi que o projeto roda, porem quando submeto ele gera o erro

Validation failed for object='aluno'. Error count: 1
org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'aluno' on field 'dataNascimento': rejected value [2018-09-06]; codes 


Ou tá dando conflito de porta ou seu firewall tá barrando. Tenta primeiro desligar o firewall pra ver se ele tá barrando.

Vou desligar o firewall pra ver, agora conflito d porta acho difícil Pq troquei a porta varias vezes e da a mesma mensagem

solução!

Troquei a dependencia para versão 3.8.2 e funcionou

<dependencies>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver-sync</artifactId>
        <version>3.8.2</version>
    </dependency>
</dependencies>