我们正在整合了java BlazeDS的与柔性project..First冬眠我们测试的纯java在eclipse冬眠和正在执行的罚款。 但是,当我们把同样的Tomcat中的Flex集成使用BlazeDS它显示以下error.this是唯一的错误。
Jan 24, 2013 11:31:31 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.6
Jan 24, 2013 11:31:31 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Jan 24, 2013 11:31:31 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Jan 24, 2013 11:31:31 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Jan 24, 2013 11:31:31 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Jan 24, 2013 11:31:31 AM org.hibernate.cfg.Configuration getConfigurationInputSt
ream
INFO: Configuration resource: /hibernate.cfg.xml
这是hibernate.cfg.xml中(要识别的hibernate.cfg.xml是否没有找到和我测试删去.cfg.xml的DOCTYPE然后Tomcat的输出显示的说根元素没有找到...这意味着它能够找到hibernate.cfg.xml的(我认为)
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:mysql://localhost/test</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<property name="current_session_context_class">thread</property>
<mapping class="com.model.User" />
<mapping class="com.model.UserDetails" />
<mapping class="com.model.LoanDetails" />
<mapping class="com.model.BorrowerDetails" />
</session-factory>
</hibernate-configuration>
这是hiberutil.java
public class HibernateUtil
{
private static SessionFactory sessionFactory=configureSessionFactory();
private static ServiceRegistry serviceRegistry;
private static SessionFactory configureSessionFactory() throws HibernateException {
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
return sessionFactory;
}
public static SessionFactory getSessionFactory()
{
return sessionFactory;
}
}
为什么错误显示? 控制从弯曲侧进入并执行该Java方法的起点...但是,当涉及到冬眠东西执行,它被示出在Tomcat的这个错误...
但是,当我执行java +休眠,因为它正在执行精细纯Java应用程序..
有谁能够帮我?
谢谢
编辑1通过@Andremoniy建议,并把.cfg.xml在src文件夹,在这里也日食它是工作,但不是在Tomcat中使用Flex修改后
以下错误出现
org.hibernate.MappingException: An AnnotationConfiguration instance is required
to use <mapping class="com.model.User"/>
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.jav
a:1606)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.jav
a:1561)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1540)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1514)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1420)
at com.sample.HibernateUtil.configureSessionFactory(HibernateUtil
.java:26)
at com.sample.HibernateUtil.<clinit>(HibernateUtil.java:20)
at com.sample.App.checkUser(App.java:34)