chúng tôi đang tích hợp java blazeds hibernate với dự án flex .. Đầu tiên chúng tôi kiểm tra java hibernate tinh khiết trong nhật thực và nó đang thực hiện tốt. Nhưng khi chúng tôi đặt cùng trong tomcat cho hội nhập flex với blazeds nó được hiển thị các lỗi sau đây.Đây là lỗi duy nhất.tài sản hibernate không tìm thấy
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
đây là hibernate.cfg.xml (Để xác định xem hibernate.cfg.xml không được tìm thấy và tôi đã thử nghiệm bằng cách xóa DOCTYPE của .cfg.xml sau đó sản lượng tomcat hiển thị đã nói rằng phần tử gốc chưa được tìm thấy. đồi khế, đồi có nghĩa là nó có khả năng tìm ra hibernate.cfg.xml (tôi nghĩ)
<?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>
đây là 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;
}
}
tại sao lỗi được hiển thị? kiểm soát đến từ flex bên và thực hiện điểm bắt đầu của phương thức java ... nhưng khi nói đến việc thực thi công cụ ngủ đông, nó hiển thị lỗi này trong tomcat ...
Nhưng khi tôi thực thi java + hibernate như một ứng dụng thuần túy java, nó đang thực hiện tốt.
ai cũng có thể giúp tôi?
Cảm ơn
EDIT 1 Sau khi sửa đổi được đề xuất bởi @Andremoniy và đặt .cfg.xml trong thư mục src và đây cũng trong eclipse nó đang làm việc nhưng không phải trong tomcat với flex
lỗi sau đến
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)
Xin chào, lỗi trong câu hỏi ban đầu của bạn là gì? Trong ngăn xếp bạn đã dán, tôi chỉ có thể thấy 'hibernate.properties not found', đây không phải là lỗi. –
Trong câu hỏi origional của tôi thực hiện dừng lại bằng cách in ngăn xếp tôi dán và sau đó không thực hiện truy vấn và không có đầu ra .. nó kết thúc như thế này ... i đặt show_sql là đúng nhưng đó không phải là in .. –
Bạn đã kiểm tra kết nối với cơ sở dữ liệu của bạn? –