【问题标题】:Glassfish connection pool don't work after restart serverGlassfish 连接池在重新启动服务器后不起作用
【发布时间】:2012-06-11 13:02:16
【问题描述】:

问题改变了

我在 Glassfish 3.1 中有一个连接池来连接到 SqlServer 2008 Express,这个池工作正常,但是当 Glassfish 重新启动时,连接池无法 ping 并停止工作。为了再次工作,我转到池配置->附加属性并更改主机名(例如 localhost 为 127.0.0.1),正如您在此屏幕中看到的那样。

我注意到这个问题只是在服务器重新启动之前部署我的应用程序时发生...如果我的应用程序没有部署并且我重新启动服务器,当我尝试 ping 池时不会出现问题。查看日志文件,我可以在部署时看到这些警告:

[#|2012-06-22T17:24:48.979-0300|WARNING|null|null|_ThreadID=1;_ThreadName=Thread-2;|Record begin marker is not a proper value so using default.|#]
[#|2012-06-22T17:24:48.979-0300|WARNING|null|null|_ThreadID=1;_ThreadName=Thread-2;|Record end marker is not a proper value so using default.|#]
[#|2012-06-22T17:24:48.979-0300|WARNING|null|null|_ThreadID=1;_ThreadName=Thread-2;|Log Format field separator is not a character so using default.|#]
[#|2012-06-22T17:25:20.080-0300|WARNING|glassfish3.1.1|org.eclipse.persistence.session.file:/home/hudson/projetos/ERP-HM/modulos-web/erp-web/target/erp-web-0.1.0/WEB-INF/lib/persistencia-erp-0.1.0.jar_erpPU.ejb_or_metadata|_ThreadID=17;_ThreadName=Thread-2;|You have specified multiple ids for the entity class [com.hrgi.persistencia.erp.entidades.Composicao] without specifying an @IdClass. By doing this you may lose the ability to find by identity, distributed cache support etc. Note: You may however use entity manager find operations by passing a list of primary key fields. Else, you will have to use JPQL queries to read your entities. For other id options see @PrimaryKey.|#]
[#|2012-06-22T17:25:41.769-0300|WARNING|glassfish3.1.1|org.springframework.beans.GenericTypeAwarePropertyDescriptor|_ThreadID=17;_ThreadName=Thread-2;|Invalid JavaBean property 'armazenador' being accessed! Ambiguous write methods found next to actually used [public void com.hrgi.persistencia.nfe.controladores.ControladorArmazenamentoEmitenteNFe.setArmazenador(com.hrgi.persistencia.nfe.dao.interfaces.IEmitenteDao)]: [public void com.hrgi.persistencia.controladores.ControladorArmazenamento.setArmazenador(com.hrgi.persistencia.dao.IArmazenadorDao)]|#]
[#|2012-06-22T17:25:49.734-0300|WARNING|glassfish3.1.1|org.eclipse.persistence.session.file:/home/hudson/projetos/ERP-HM/modulos-web/erp-web/target/erp-web-0.1.0/WEB-INF/lib/persistencia-erp-0.1.0.jar_erpPU.server|_ThreadID=17;_ThreadName=Thread-2;|Multiple [2] JMX MBeanServer instances exist, we will use the server at index [0] : [com.sun.enterprise.v3.admin.DynamicInterceptor@2ed0005e].|#]
[#|2012-06-22T17:25:49.737-0300|WARNING|glassfish3.1.1|org.eclipse.persistence.session.file:/home/hudson/projetos/ERP-HM/modulos-web/erp-web/target/erp-web-0.1.0/WEB-INF/lib/persistencia-erp-0.1.0.jar_erpPU.server|_ThreadID=17;_ThreadName=Thread-2;|JMX MBeanServer in use: [com.sun.enterprise.v3.admin.DynamicInterceptor@2ed0005e] from index [0] |#]
[#|2012-06-22T17:25:49.740-0300|WARNING|glassfish3.1.1|org.eclipse.persistence.session.file:/home/hudson/projetos/ERP-HM/modulos-web/erp-web/target/erp-web-0.1.0/WEB-INF/lib/persistencia-erp-0.1.0.jar_erpPU.server|_ThreadID=17;_ThreadName=Thread-2;|JMX MBeanServer in use: [com.sun.jmx.mbeanserver.JmxMBeanServer@e40e825] from index [1] |#]
[#|2012-06-22T17:25:52.457-0300|INFO|glassfish3.1.1|org.apache.myfaces.webapp.WebConfigParamsLogger|_ThreadID=17;_ThreadName=Thread-2;|No context init parameter 'org.apache.myfaces.ERROR_HANDLER' found.|#]
[#|2012-06-22T17:25:52.474-0300|INFO|glassfish3.1.1|org.apache.myfaces.webapp.WebConfigParamsLogger|_ThreadID=17;_ThreadName=Thread-2;|No context init parameter 'org.apache.myfaces.ERROR_TEMPLATE_RESOURCE' found, using default value 'META-INF/rsc/myfaces-dev-error.xml'.|#]

我抑制了一个 javax.mail.MessagingException,因为它发生在没有设置密码连接到邮件服务器时...

我的应用程序中是否有问题导致此问题?

【问题讨论】:

  • 我是否正确阅读了您的问题:服务器重启期间池配置更改,从 127.0.0.1 到 localhost?
  • 没有。重新启动后配置不会改变,池根本不适用于主机。所以我手动将池配置从 127.0.0.1 更改为 localhost,它可以工作...
  • 抱歉,我不明白 ;-) 你为什么不使用 localhost?您的连接池是如何配置的?它是与您的应用程序一起部署的,还是您手动配置的?
  • 池是手动配置的,如图所示。我看你不明白......所以这样想,连接运行得很好,出于某种原因,我需要重新启动 glassfish 服务器。重启后连接池不起作用。在服务器重新启动之前,所有配置都相同......所以我进入池配置,只需从 localhost 更改为 127.0.0.1 或从 127.0.0.1 更改为 localhost 并再次工作。如果服务器再次重新启动,我需要再次更改主机...
  • 您应该检查您的 domain.xml 并比较重新启动前后的连接池设置。有什么不同吗?

标签: jakarta-ee jpa-2.0 eclipselink glassfish-3 connection-pooling


【解决方案1】:

嗯,那是多余的......

我会先检查 C:\Windows\System32\drivers\etc\hosts

确保 localhost 的映射没有损坏...

127.0.0.1       localhost
::1             localhost

无论哪种方式,这似乎都是名称解析的问题,无论是主机文件还是 DNS 服务器。

如果有更多可用信息,您能否检查一下并提供更多信息??

【讨论】:

  • hosts文件和你提到的一样,dns服务器配置正确。也许是玻璃鱼问题......
【解决方案2】:

已解决,问题出在 jndi 数据源中... 我只是删除了 jndi 数据源并在应用程序中使用了本地数据源。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-20
    • 1970-01-01
    • 2021-07-31
    • 2016-07-23
    • 2022-10-15
    • 2022-08-24
    • 1970-01-01
    相关资源
    最近更新 更多