(spring-boot与mongoDb整合,使用mogonTemplate查询报错

报错信息

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.Long] to type [java.util.Date]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:174)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getPotentiallyConvertedSimpleRead(MappingMongoConverter.java:887)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1392)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter

M

o

n

g

o

D

b

P

r

o

p

e

r

t

y

V

a

l

u

e

P

r

o

v

i

d

e

r

.

g

e

t

P

r

o

p

e

r

t

y

V

a

l

u

e

(

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

j

a

v

a

:

1335

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

m

o

n

g

o

d

b

.

c

o

r

e

.

c

o

n

v

e

r

t

.

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

r

e

a

d

P

r

o

p

e

r

t

i

e

s

(

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

j

a

v

a

:

335

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

m

o

n

g

o

d

b

.

c

o

r

e

.

c

o

n

v

e

r

t

.

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

r

e

a

d

(

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

j

a

v

a

:

297

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

m

o

n

g

o

d

b

.

c

o

r

e

.

c

o

n

v

e

r

t

.

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

r

e

a

d

(

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

j

a

v

a

:

253

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

m

o

n

g

o

d

b

.

c

o

r

e

.

c

o

n

v

e

r

t

.

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

r

e

a

d

(

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

j

a

v

a

:

202

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

m

o

n

g

o

d

b

.

c

o

r

e

.

c

o

n

v

e

r

t

.

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

r

e

a

d

(

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

j

a

v

a

:

198

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

m

o

n

g

o

d

b

.

c

o

r

e

.

c

o

n

v

e

r

t

.

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

r

e

a

d

(

M

a

p

p

i

n

g

M

o

n

g

o

C

o

n

v

e

r

t

e

r

.

j

a

v

a

:

86

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

m

o

n

g

o

d

b

.

c

o

r

e

.

M

o

n

g

o

T

e

m

p

l

a

t

e

MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:1335) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readProperties(MappingMongoConverter.java:335) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:297) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:253) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:202) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:198) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:86) at org.springframework.data.mongodb.core.MongoTemplate

MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:1335)atorg.springframework.data.mongodb.core.convert.MappingMongoConverter.readProperties(MappingMongoConverter.java:335)atorg.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:297)atorg.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:253)atorg.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:202)atorg.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:198)atorg.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:86)atorg.springframework.data.mongodb.core.MongoTemplateReadDocumentCallback.doWith(MongoTemplate.java:2782)
at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:2399)
at org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:2191)
at org.springframework.data.mongodb.core.MongoTemplate.findById(MongoTemplate.java:797)
at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.findById(SimpleMongoRepository.java:121)
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:498)
at org.springframework.data.repository.core.support.RepositoryComposition

R

e

p

o

s

i

t

o

r

y

F

r

a

g

m

e

n

t

s

.

i

n

v

o

k

e

(

R

e

p

o

s

i

t

o

r

y

C

o

m

p

o

s

i

t

i

o

n

.

j

a

v

a

:

377

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

r

e

p

o

s

i

t

o

r

y

.

c

o

r

e

.

s

u

p

p

o

r

t

.

R

e

p

o

s

i

t

o

r

y

C

o

m

p

o

s

i

t

i

o

n

.

i

n

v

o

k

e

(

R

e

p

o

s

i

t

o

r

y

C

o

m

p

o

s

i

t

i

o

n

.

j

a

v

a

:

200

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

r

e

p

o

s

i

t

o

r

y

.

c

o

r

e

.

s

u

p

p

o

r

t

.

R

e

p

o

s

i

t

o

r

y

F

a

c

t

o

r

y

S

u

p

p

o

r

t

RepositoryFragments.invoke(RepositoryComposition.java:377) at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:200) at org.springframework.data.repository.core.support.RepositoryFactorySupport

RepositoryFragments.invoke(RepositoryComposition.java:377)atorg.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:200)atorg.springframework.data.repository.core.support.RepositoryFactorySupportImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:629)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.data.repository.core.support.RepositoryFactorySupport

Q

u

e

r

y

E

x

e

c

u

t

o

r

M

e

t

h

o

d

I

n

t

e

r

c

e

p

t

o

r

.

d

o

I

n

v

o

k

e

(

R

e

p

o

s

i

t

o

r

y

F

a

c

t

o

r

y

S

u

p

p

o

r

t

.

j

a

v

a

:

593

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

d

a

t

a

.

r

e

p

o

s

i

t

o

r

y

.

c

o

r

e

.

s

u

p

p

o

r

t

.

R

e

p

o

s

i

t

o

r

y

F

a

c

t

o

r

y

S

u

p

p

o

r

t

QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:593) at org.springframework.data.repository.core.support.RepositoryFactorySupport

QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:593)atorg.springframework.data.repository.core.support.RepositoryFactorySupportQueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:578)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.

P

r

o

x

y

68.

f

i

n

d

B

y

I

d

(

U

n

k

n

o

w

n

S

o

u

r

c

e

)

a

t

c

o

m

.

t

e

n

s

q

u

a

r

e

.

s

p

i

t

.

s

e

r

v

i

c

e

.

S

p

i

t

S

e

r

v

i

c

e

.

g

e

t

S

p

i

t

B

y

I

d

(

S

p

i

t

S

e

r

v

i

c

e

.

j

a

v

a

:

41

)

a

t

c

o

m

.

t

e

n

s

q

u

a

r

e

.

s

p

i

t

.

c

o

n

t

r

o

l

l

e

r

.

S

p

i

t

C

o

n

t

r

o

l

l

e

r

.

g

e

t

S

p

i

t

B

y

I

d

(

S

p

i

t

C

o

n

t

r

o

l

l

e

r

.

j

a

v

a

:

43

)

a

t

s

u

n

.

r

e

f

l

e

c

t

.

N

a

t

i

v

e

M

e

t

h

o

d

A

c

c

e

s

s

o

r

I

m

p

l

.

i

n

v

o

k

e

0

(

N

a

t

i

v

e

M

e

t

h

o

d

)

a

t

s

u

n

.

r

e

f

l

e

c

t

.

N

a

t

i

v

e

M

e

t

h

o

d

A

c

c

e

s

s

o

r

I

m

p

l

.

i

n

v

o

k

e

(

N

a

t

i

v

e

M

e

t

h

o

d

A

c

c

e

s

s

o

r

I

m

p

l

.

j

a

v

a

:

62

)

a

t

s

u

n

.

r

e

f

l

e

c

t

.

D

e

l

e

g

a

t

i

n

g

M

e

t

h

o

d

A

c

c

e

s

s

o

r

I

m

p

l

.

i

n

v

o

k

e

(

D

e

l

e

g

a

t

i

n

g

M

e

t

h

o

d

A

c

c

e

s

s

o

r

I

m

p

l

.

j

a

v

a

:

43

)

a

t

j

a

v

a

.

l

a

n

g

.

r

e

f

l

e

c

t

.

M

e

t

h

o

d

.

i

n

v

o

k

e

(

M

e

t

h

o

d

.

j

a

v

a

:

498

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

m

e

t

h

o

d

.

s

u

p

p

o

r

t

.

I

n

v

o

c

a

b

l

e

H

a

n

d

l

e

r

M

e

t

h

o

d

.

d

o

I

n

v

o

k

e

(

I

n

v

o

c

a

b

l

e

H

a

n

d

l

e

r

M

e

t

h

o

d

.

j

a

v

a

:

209

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

m

e

t

h

o

d

.

s

u

p

p

o

r

t

.

I

n

v

o

c

a

b

l

e

H

a

n

d

l

e

r

M

e

t

h

o

d

.

i

n

v

o

k

e

F

o

r

R

e

q

u

e

s

t

(

I

n

v

o

c

a

b

l

e

H

a

n

d

l

e

r

M

e

t

h

o

d

.

j

a

v

a

:

136

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

m

v

c

.

m

e

t

h

o

d

.

a

n

n

o

t

a

t

i

o

n

.

S

e

r

v

l

e

t

I

n

v

o

c

a

b

l

e

H

a

n

d

l

e

r

M

e

t

h

o

d

.

i

n

v

o

k

e

A

n

d

H

a

n

d

l

e

(

S

e

r

v

l

e

t

I

n

v

o

c

a

b

l

e

H

a

n

d

l

e

r

M

e

t

h

o

d

.

j

a

v

a

:

102

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

m

v

c

.

m

e

t

h

o

d

.

a

n

n

o

t

a

t

i

o

n

.

R

e

q

u

e

s

t

M

a

p

p

i

n

g

H

a

n

d

l

e

r

A

d

a

p

t

e

r

.

i

n

v

o

k

e

H

a

n

d

l

e

r

M

e

t

h

o

d

(

R

e

q

u

e

s

t

M

a

p

p

i

n

g

H

a

n

d

l

e

r

A

d

a

p

t

e

r

.

j

a

v

a

:

877

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

m

v

c

.

m

e

t

h

o

d

.

a

n

n

o

t

a

t

i

o

n

.

R

e

q

u

e

s

t

M

a

p

p

i

n

g

H

a

n

d

l

e

r

A

d

a

p

t

e

r

.

h

a

n

d

l

e

I

n

t

e

r

n

a

l

(

R

e

q

u

e

s

t

M

a

p

p

i

n

g

H

a

n

d

l

e

r

A

d

a

p

t

e

r

.

j

a

v

a

:

783

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

m

v

c

.

m

e

t

h

o

d

.

A

b

s

t

r

a

c

t

H

a

n

d

l

e

r

M

e

t

h

o

d

A

d

a

p

t

e

r

.

h

a

n

d

l

e

(

A

b

s

t

r

a

c

t

H

a

n

d

l

e

r

M

e

t

h

o

d

A

d

a

p

t

e

r

.

j

a

v

a

:

87

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

D

i

s

p

a

t

c

h

e

r

S

e

r

v

l

e

t

.

d

o

D

i

s

p

a

t

c

h

(

D

i

s

p

a

t

c

h

e

r

S

e

r

v

l

e

t

.

j

a

v

a

:

991

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

D

i

s

p

a

t

c

h

e

r

S

e

r

v

l

e

t

.

d

o

S

e

r

v

i

c

e

(

D

i

s

p

a

t

c

h

e

r

S

e

r

v

l

e

t

.

j

a

v

a

:

925

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

F

r

a

m

e

w

o

r

k

S

e

r

v

l

e

t

.

p

r

o

c

e

s

s

R

e

q

u

e

s

t

(

F

r

a

m

e

w

o

r

k

S

e

r

v

l

e

t

.

j

a

v

a

:

974

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

F

r

a

m

e

w

o

r

k

S

e

r

v

l

e

t

.

d

o

G

e

t

(

F

r

a

m

e

w

o

r

k

S

e

r

v

l

e

t

.

j

a

v

a

:

866

)

a

t

j

a

v

a

x

.

s

e

r

v

l

e

t

.

h

t

t

p

.

H

t

t

p

S

e

r

v

l

e

t

.

s

e

r

v

i

c

e

(

H

t

t

p

S

e

r

v

l

e

t

.

j

a

v

a

:

635

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

s

e

r

v

l

e

t

.

F

r

a

m

e

w

o

r

k

S

e

r

v

l

e

t

.

s

e

r

v

i

c

e

(

F

r

a

m

e

w

o

r

k

S

e

r

v

l

e

t

.

j

a

v

a

:

851

)

a

t

j

a

v

a

x

.

s

e

r

v

l

e

t

.

h

t

t

p

.

H

t

t

p

S

e

r

v

l

e

t

.

s

e

r

v

i

c

e

(

H

t

t

p

S

e

r

v

l

e

t

.

j

a

v

a

:

742

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

i

n

t

e

r

n

a

l

D

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

231

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

d

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

166

)

a

t

o

r

g

.

a

p

a

c

h

e

.

t

o

m

c

a

t

.

w

e

b

s

o

c

k

e

t

.

s

e

r

v

e

r

.

W

s

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

(

W

s

F

i

l

t

e

r

.

j

a

v

a

:

52

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

i

n

t

e

r

n

a

l

D

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

193

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

d

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

166

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

f

i

l

t

e

r

.

R

e

q

u

e

s

t

C

o

n

t

e

x

t

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

I

n

t

e

r

n

a

l

(

R

e

q

u

e

s

t

C

o

n

t

e

x

t

F

i

l

t

e

r

.

j

a

v

a

:

99

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

f

i

l

t

e

r

.

O

n

c

e

P

e

r

R

e

q

u

e

s

t

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

(

O

n

c

e

P

e

r

R

e

q

u

e

s

t

F

i

l

t

e

r

.

j

a

v

a

:

107

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

i

n

t

e

r

n

a

l

D

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

193

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

d

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

166

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

f

i

l

t

e

r

.

H

t

t

p

P

u

t

F

o

r

m

C

o

n

t

e

n

t

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

I

n

t

e

r

n

a

l

(

H

t

t

p

P

u

t

F

o

r

m

C

o

n

t

e

n

t

F

i

l

t

e

r

.

j

a

v

a

:

109

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

f

i

l

t

e

r

.

O

n

c

e

P

e

r

R

e

q

u

e

s

t

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

(

O

n

c

e

P

e

r

R

e

q

u

e

s

t

F

i

l

t

e

r

.

j

a

v

a

:

107

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

i

n

t

e

r

n

a

l

D

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

193

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

d

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

166

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

f

i

l

t

e

r

.

H

i

d

d

e

n

H

t

t

p

M

e

t

h

o

d

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

I

n

t

e

r

n

a

l

(

H

i

d

d

e

n

H

t

t

p

M

e

t

h

o

d

F

i

l

t

e

r

.

j

a

v

a

:

81

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

f

i

l

t

e

r

.

O

n

c

e

P

e

r

R

e

q

u

e

s

t

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

(

O

n

c

e

P

e

r

R

e

q

u

e

s

t

F

i

l

t

e

r

.

j

a

v

a

:

107

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

i

n

t

e

r

n

a

l

D

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

193

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

d

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

166

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

f

i

l

t

e

r

.

C

h

a

r

a

c

t

e

r

E

n

c

o

d

i

n

g

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

I

n

t

e

r

n

a

l

(

C

h

a

r

a

c

t

e

r

E

n

c

o

d

i

n

g

F

i

l

t

e

r

.

j

a

v

a

:

200

)

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

w

e

b

.

f

i

l

t

e

r

.

O

n

c

e

P

e

r

R

e

q

u

e

s

t

F

i

l

t

e

r

.

d

o

F

i

l

t

e

r

(

O

n

c

e

P

e

r

R

e

q

u

e

s

t

F

i

l

t

e

r

.

j

a

v

a

:

107

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

i

n

t

e

r

n

a

l

D

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

193

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

d

o

F

i

l

t

e

r

(

A

p

p

l

i

c

a

t

i

o

n

F

i

l

t

e

r

C

h

a

i

n

.

j

a

v

a

:

166

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

S

t

a

n

d

a

r

d

W

r

a

p

p

e

r

V

a

l

v

e

.

i

n

v

o

k

e

(

S

t

a

n

d

a

r

d

W

r

a

p

p

e

r

V

a

l

v

e

.

j

a

v

a

:

198

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

S

t

a

n

d

a

r

d

C

o

n

t

e

x

t

V

a

l

v

e

.

i

n

v

o

k

e

(

S

t

a

n

d

a

r

d

C

o

n

t

e

x

t

V

a

l

v

e

.

j

a

v

a

:

96

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

a

u

t

h

e

n

t

i

c

a

t

o

r

.

A

u

t

h

e

n

t

i

c

a

t

o

r

B

a

s

e

.

i

n

v

o

k

e

(

A

u

t

h

e

n

t

i

c

a

t

o

r

B

a

s

e

.

j

a

v

a

:

496

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

S

t

a

n

d

a

r

d

H

o

s

t

V

a

l

v

e

.

i

n

v

o

k

e

(

S

t

a

n

d

a

r

d

H

o

s

t

V

a

l

v

e

.

j

a

v

a

:

140

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

v

a

l

v

e

s

.

E

r

r

o

r

R

e

p

o

r

t

V

a

l

v

e

.

i

n

v

o

k

e

(

E

r

r

o

r

R

e

p

o

r

t

V

a

l

v

e

.

j

a

v

a

:

81

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

r

e

.

S

t

a

n

d

a

r

d

E

n

g

i

n

e

V

a

l

v

e

.

i

n

v

o

k

e

(

S

t

a

n

d

a

r

d

E

n

g

i

n

e

V

a

l

v

e

.

j

a

v

a

:

87

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

a

t

a

l

i

n

a

.

c

o

n

n

e

c

t

o

r

.

C

o

y

o

t

e

A

d

a

p

t

e

r

.

s

e

r

v

i

c

e

(

C

o

y

o

t

e

A

d

a

p

t

e

r

.

j

a

v

a

:

342

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

o

y

o

t

e

.

h

t

t

p

11.

H

t

t

p

11

P

r

o

c

e

s

s

o

r

.

s

e

r

v

i

c

e

(

H

t

t

p

11

P

r

o

c

e

s

s

o

r

.

j

a

v

a

:

803

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

o

y

o

t

e

.

A

b

s

t

r

a

c

t

P

r

o

c

e

s

s

o

r

L

i

g

h

t

.

p

r

o

c

e

s

s

(

A

b

s

t

r

a

c

t

P

r

o

c

e

s

s

o

r

L

i

g

h

t

.

j

a

v

a

:

66

)

a

t

o

r

g

.

a

p

a

c

h

e

.

c

o

y

o

t

e

.

A

b

s

t

r

a

c

t

P

r

o

t

o

c

o

l

Proxy68.findById(Unknown Source) at com.tensquare.spit.service.SpitService.getSpitById(SpitService.java:41) at com.tensquare.spit.controller.SpitController.getSpitById(SpitController.java:43) 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:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol

Proxy68.findById(UnknownSource)atcom.tensquare.spit.service.SpitService.getSpitById(SpitService.java:41)atcom.tensquare.spit.controller.SpitController.getSpitById(SpitController.java:43)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:498)atorg.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)atorg.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)atorg.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)atorg.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)atorg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)atorg.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)atorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)atorg.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:635)atorg.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:742)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)atorg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)atorg.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)atorg.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)atorg.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)atorg.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)atorg.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)atorg.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)atorg.apache.coyote.AbstractProtocolConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint

S

o

c

k

e

t

P

r

o

c

e

s

s

o

r

.

d

o

R

u

n

(

N

i

o

E

n

d

p

o

i

n

t

.

j

a

v

a

:

1459

)

a

t

o

r

g

.

a

p

a

c

h

e

.

t

o

m

c

a

t

.

u

t

i

l

.

n

e

t

.

S

o

c

k

e

t

P

r

o

c

e

s

s

o

r

B

a

s

e

.

r

u

n

(

S

o

c

k

e

t

P

r

o

c

e

s

s

o

r

B

a

s

e

.

j

a

v

a

:

49

)

a

t

j

a

v

a

.

u

t

i

l

.

c

o

n

c

u

r

r

e

n

t

.

T

h

r

e

a

d

P

o

o

l

E

x

e

c

u

t

o

r

.

r

u

n

W

o

r

k

e

r

(

T

h

r

e

a

d

P

o

o

l

E

x

e

c

u

t

o

r

.

j

a

v

a

:

1149

)

a

t

j

a

v

a

.

u

t

i

l

.

c

o

n

c

u

r

r

e

n

t

.

T

h

r

e

a

d

P

o

o

l

E

x

e

c

u

t

o

r

SocketProcessor.doRun(NioEndpoint.java:1459) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor

SocketProcessor.doRun(NioEndpoint.java:1459)atorg.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

原因

mogonTemplate从mongoDb数据库中查询的数据,特别是date数据,没有日期转换器converter和java实体类中的date属性进行转换

解决方式:

自定义一个日期转换器converter,然后将该converter添加到mongoTemplate的属性中

转换器

package com.tensquare.spit.converter;

import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;
import org.springframework.data.convert.WritingConverter;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * long型数据转换为date数据,全局日期处理
 */
@Component
@ReadingConverter
@WritingConverter
public class DateConverter implements Converter<Long,Date> {


    @Override
    public Date convert(Long source) {
        if (null!=source){
            Date date = new Date(source);
            return date;
        }
        return null;
    }
}

将转换器添加到mongoTemplate属性中

package com.tensquare.spit.config;


import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.tensquare.spit.converter.DateConverter;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import org.springframework.data.mongodb.core.convert.*;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;


import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Configuration
public  class MongoDbConfig extends AbstractMongoConfiguration {

    private String dbName = "spitdb";
    @Override
    public MongoClient mongoClient() {
        MongoClient mongoClient = new MongoClient();
        return mongoClient;
    }

    @Override
    protected String getDatabaseName() {
        return dbName;
    }
    @Bean
    public MappingMongoConverter mappingMongoConverter() throws Exception {
        DefaultDbRefResolver dbRefResolver = new DefaultDbRefResolver(this.dbFactory());
        MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, this.mongoMappingContext());
        List<Object> list = new ArrayList<>();
        list.add(new DateConverter());//自定义的类型转换器
        converter.setCustomConversions(new MongoCustomConversions(list));
        return converter;
    }
    @Bean
    public MongoDbFactory dbFactory() throws Exception {
        return new SimpleMongoDbFactory(new MongoClientURI("mongodb://localhost:27017/spitdb"));
    }
    @Bean
    public MongoMappingContext mongoMappingContext() {
        MongoMappingContext mappingContext = new MongoMappingContext();
        return mappingContext;
    }
    @Bean
    public MongoTemplate mongoTemplate() throws Exception {
        return new MongoTemplate(this.dbFactory(), this.mappingMongoConverter());
    }
}

启动springboot运行,启动时可能出现如下信息:(可忽略,可能和程序编译有关,但是运行时没问题)

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

参照大神

https://www.cnblogs.com/muxi0407/p/11703316.html


版权声明:本文为xiao_bai_cai_bai原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/xiao_bai_cai_bai/article/details/108649275