Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/tmolecules", "root", "......");
当我尝试使用本地数据库时,我不断收到此错误。我该如何解决?
堆栈跟踪:
org.javalite.activejdbc.InitException: Failed to connect to JDBC URL: jdbc:mysql://localhost/tmolecules
at org.javalite.activejdbc.DB.open(DB.java:93)
at org.javalite.activejdbc.Base.open(Base.java:64)
at com.tmolecules.Application.lambda$main$0(Application.java:62)
at spark.FilterImpl$1.handle(FilterImpl.java:62)
at spark.http.matching.BeforeFilters.execute(BeforeFilters.java:48)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:129)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
at com.mysql.jdbc.Util.getInstance(Util.java:360)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2311)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at org.javalite.activejdbc.DB.open(DB.java:89)
... 20 more
Caused by: java.lang.NullPointerException
at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:2983)
at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1873)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1802)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1206)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2234)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265)
... 33 more
[qtp1110198618-23] WARN org.javalite.activejdbc.DB - Could not close connection! MUST INVESTIGAMTE POTENTIAL CONNECTION LEAK!a
y 02, 2018 2:40:06 PM com.tmolecules.Application lambda$main$0
SEVERE: null
org.javalite.activejdbc.InitException: Failed to connect to JDBC URL: jdbc:mysql://localhost/tmolecules
at org.javalite.activejdbc.DB.open(DB.java:93)
org.javalit e.activejdbc.DBException: cannot close caonnection 'default' becauset it is not av ailoablerg.javalite.activejdbc.Base.ope
Base.java:64)
at com.tmolecules.Application.lambda$main$0(Application.java:62)
at spark.FilterIm at org.javalite.activejdbc.pDlB$.1c.lhoasned(lDeB(.Fjialvtae:r3I08)mpl.java:62)
at spark.http.matching.BeforeFilters.execute(BeforeFilter
s.java:48)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:129)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:5 at org.javalite.activejdbc.DB.close(DB.java:297)0
)
at org.eclipse.jett at org.javalite.activejdbc.Base.close(Base.java:144)y
.server.session.SessionHandler.doScope(SessionHandler. at com.tmolecules.Application.lambda$main$0(Application.java:74)
at spark.FiltjerImpl$1.handle(FaivlaterI:mpl.java:62)189)
at org.eclipse.jetty.server.
handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.Handle at spark.http.matching.BeforeFiltrWrapper.handle(Handlerers.execute(BeforeFilters.
va:48)W
rapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded( at sApark.http.matching.MatcherFilter.doFilter(MatcherFilt
.java:129)b
stractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProdu at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)c
eConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.uti at org.eclipse.jetty.serlver.session.SessionHandler.doScope(SessionHandler.java:189).
thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org. at oerg.eclipse.jetty.server.handler.ScopedHandclleirp.shea.njdelte(ScopedHandler.java:141)ty.uti
l.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWra
Caused by: com.mysql.jdbc.exceptions.jdbc4.Mypper.Sjava:119)QLNon
TransientConnectionException: Could not create connection to database server.
at sun.reflect.NativeConstructorAccessor at org.eclipse.jetty.server.Server.handle(Server.java:517)I
mpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorI at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:3m08)pl.ne
wInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Delegatin gat orCg.eclipse.jetty.server.HttpConnection.onFillable(Ht
Connection.java:242)o
nstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.new at org.eclipseInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:.jetty.io.AbstractConnection$ReadCallba3ck.succeeded(AbstractConnection.java:26
7
7)
at com.mysql.jdbc.Util.getInstance(Util.ja at org.eclipse.jetty.io.FillInterest.fillablev(aF:illInterest.java:95)360
)
at com.mysql.jdbc.SQLError.createSQLException(S at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
LError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)
at com.mysql.j at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)d
bc.SQLError.createSQLException(SQLError.java:870)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImp at org.el.java:2311)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064clipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(E
cuteProduceConsume.java:147))
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4C at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654
nnection.java:44)
at sun.reflect.NativeConstructorAccesso at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)r
Impl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl. at java.lang.Thread.run(Thread.java:748)n
ewInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at org.javalite.activejdbc.DB.open(DB.java:89)
... 20 more
Caused by: java.lang.NullPointerException
at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:2983)
at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1873)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1802)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1206)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2234)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265)
... 33 more
1qt p
.=1=0=1=9=8=6=1=8=-=2=2=]= =W=A=R=N= =o=r=g=.=j=a=v=a=l=i=t=e=.=a=c=t=i=v=e=j=d=b=c
T=B= =-= =C=o=u=l=d= =n=o=t= =c=l=o=s=e= =c=o=n=n=e=c=t=i=o=n=!= =MU=S=T= =I=N=V=E=S
IGATE POTENTIAL CONNECTION LEAK!
[qtp1110198618-23] WARN org.eclipse.jetty.server.HttpChannel - //localhost:4567/get_categories_on_load
org.javalite.activejdbc.DBException: cannot close connection 'default' because it is not available
at org.javalite.activejdbc.DB.close(DB.java:308)
at org.javalite.activejdbc.DB.close(DB.java:297)
at org.javalite.activejdbc.Base.close(Base.java:144)
at com.tmolecules.Application.lambda$main$0(Application.java:74)
at spark.FilterImpl$1.handle(FilterImpl.java:62)
at spark.http.matching.BeforeFilters.execute(BeforeFilters.java:48)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:129)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:748)
Lava.lang.NoSuchMethodError: com.tmoleculOeNs .PmAoGdEe lLsO.APDo s-t-s CLaItMeIgTo:r i3e sO.FfFiSnEdTB:y S0Q
(Ljava/lang/String;[Ljava/lang/Object;)Lorg/javalite/activejdbc/LazyList;
at com.tmolecules.Application.lambda$main$7(Application.java:195)
at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:748)
[qtp1110198618-22] WARN org.eclipse.jetty.server.HttpChannel - //localhost:4567/data_on_page_load?limit=3&offset=0
java.lang.NoSuchMethodError: com.tmolecules.models.Post.findAll()Lorg/javalite/activejdbc/LazyList;
at com.tmolecules.Application.lambda$main$5(Application.java:160)
at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:748)