【发布时间】:2011-06-17 01:44:55
【问题描述】:
我在 Tomcat Apache 容器中使用 GWT 和 JPA 和 Hibernate。当我尝试从独立的 java 应用程序测试我的 dao 和数据库连接时,它工作正常。但是,当我在服务器环境中使用它时,它有时会起作用,有时却不起作用。以下是日志事件的精简序列:
org.hibernate.type.BasicTypeRegistry - 添加类型注册 boolean -> org.hibernate.type.BooleanType@82b436 信息 org.hibernate.cfg.Environment - 休眠 3.6.0.Final 42937 [btpool0-0] 信息 org.hibernate.cfg.Environment -hibernate.properties 未找到 42940 [btpool0-0] INFO org.hibernate.cfg.Environment -字节码提供者名称:javassist [btpool0-0] INFO org.hibernate.cfg.Environment - 使用JDK 1.4 java.sql.Timestamp 处理 43038 [btpool0-0] 调试 org.hibernate.id.factory.DefaultIdentifierGeneratorFactor - 注册 IdentifierGenerator 策略 [uuid2] -> [class org.hibernate.id.UUIDGenerator] 43069 [btpool0-0] 信息 org.hibernate.ejb.Version - 休眠 EntityManager 3.6.0.Final
43090 [btpool0-0] 调试 org.hibernate.type.BasicTypeRegistry - 添加类型注册文本 -> org.hibernate.type.TextType@1cf00aa43106 [btpool0-0] 调试 org.hibernate.ejb.Ejb3Configuration - 查找持久性单元: 交易 - 可选 43269 [btpool0-0] 调试 org.hibernate.ejb.Ejb3Configuration 检测类:true;检测 hbm: true
43285 [btpool0-0] 调试 org.hibernate.ejb.packaging.AbstractJarVisitor - 在 jar/par 中搜索映射实体:file://xxxxx 43378
[btpool0-0] 调试 org.hibernate.ejb.packaging.AbstractJarVisitor - 过滤:com.demo.server.hello 43492 [btpool0-0] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - com.demo.server.hello 43505 匹配的 Java 元素过滤器
[btpool0-0] 调试 org.hibernate.ejb.Ejb3Configuration - 检测类:真;检测 hbm: true
43505 [btpool0-0] 调试 org.hibernate.ejb.Ejb3Configuration - 创建工厂: 交易-可选
在此之后,我没有收到任何日志消息,并且我的客户端层无法与数据库层通信。当我的客户端层能够与数据库层通信时,上述日志条目之后的条目如下:
1063 [main] DEBUG org.hibernate.cfg.Configuration - 处理 hbm.xml 文件
如果您能指出可能出了什么问题,我将不胜感激。我不知道是它的 eclipse 编译错误,还是 GWT 插件中的一些问题,或者(很可能)我的编程错误。
【问题讨论】: