pq quando eu mudo a data do computador… meu hibernate não acessa mais o bancooo???
desde ja agradeço
pq quando eu mudo a data do computador… meu hibernate não acessa mais o bancooo???
desde ja agradeço
\o/
Eu acredito que o problema deve ser outro. É printado algum stacktrace ou qualquer coisa do tipo?
O que do hibernate para de funcionar?
Eu já vi isso acontecer
mas foi qdo virou o horário de verão
um cliente atualizou o horário do pc dele e o software parou de funcionar, mais foi só nele, nos outros continuou funcionando
coloca ai o erro que dá
org.hibernate.exception.JDBCConnectionException: could not load an entity: [objetos.Configuracao#1]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1874)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3049)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:399)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at dao.Dao.carregarPorID(Dao.java:98)
at janelas.CadastroBanco.getBtnsalvar(CadastroBanco.java:229)
at janelas.CadastroBanco.getJContentPane(CadastroBanco.java:164)
at janelas.CadastroBanco.initialize(CadastroBanco.java:106)
at janelas.CadastroBanco.<init>(CadastroBanco.java:91)
at janelas.Menu2$3.actionPerformed(Menu2.java:218)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:
** BEGIN NESTED EXCEPTION **
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
MESSAGE: Communications link failure
Last packet sent to the server was 16 ms ago.
STACKTRACE:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 16 ms ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1885)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at dao.FuncionarioDAO.selecionaFuncionarioPorFuncionario(FuncionarioDAO.java:65)
at janelas.MovimentarPonto.validaUsuario(MovimentarPonto.java:378)
at janelas.MovimentarPonto.access$1(MovimentarPonto.java:373)
at janelas.MovimentarPonto$2.focusLost(MovimentarPonto.java:140)
at java.awt.AWTEventMulticaster.focusLost(Unknown Source)
at java.awt.Component.processFocusEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
... 41 more
Você consegue acesso ao banco normal??
pelo que parece o hibernate não encontra o banco
coloca sua configuração do hibernate
não ele funciona normal a aplicação…
dai por exemplo… vou la e mudo a data do computador… dai da pau e não encontra mais o banco… o problema é quando muda a data… pq sera?
Depois de mudar a data do pc, vc já tentou reinicia-lo?
O sistema que eu vi isso acontecer era web, só aconteceu em um cliente
Qual a versão do seu MySQL?
Faça o seguinte teste.
Feche seu programa totalmente e pare o servidor web (se for aplicação web).
Mude a data.
Reinicie o programa.
Veja se assim ele volta a funcionar.
Parece que está dando timeout na conexão com o banco.
Vc muda a data e a conexão expira entendeu?
Olhe aqui
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: [color=red]No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error: [/color]** BEGIN NESTED EXCEPTION **
[color=red]com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
MESSAGE: Communications link failure [/color]Last packet sent to the server was 16 ms ago.
STACKTRACE:
[color=red]com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure [/color]
é Sistema desktop
valeu pelas resposta… mas o que acontece é o seguinte
se eu mudar a senha… o sistema na hora para de encontrar o banco
mais se eu reiniciar o programa ele volta ao normall
é isso que eu quero saber
se tem como arrumar
é Sistema desktopvaleu pelas resposta… mas o que acontece é o seguinte
se eu mudar a senha… o sistema na hora para de encontrar o banco
mais se eu reiniciar o programa ele volta ao normallé isso que eu quero saber
se tem como arrumar
Vc leu o que eu escrevi? Pelo o que eu escrevi, o que você faria?
hum… foi mal… falta de interpretaçãoo
mas… como resolve esse problema?
hum… foi mal… falta de interpretaçãoo
mas… como resolve esse problema?
Eu não vejo isso como problema, pq o usuário não vai ficar alterando a data do sistema todo dia. Ou vai?
Vc poderia tratar essa excessão e avisar o usuário que alterou a data e que deve reiniciar a aplicação, mas sei lá, acho essa preocupação meio inútil, a não ser é claro, como falei, se o usuário for trocar a data todo o tempo… O porque de fazer isso eu não tenho idéia, mas enfim…
Vc poderia desabilitar o timeout do banco tbm, mas sinceramente não recomendo isso…