मैं वर्तमान में ओएसजीआई का उपयोग कर परीक्षण कर रहा हूं। मैं ग्रहण के माध्यम से इसे चला रहा हूँ। मैं एक OSGi समाधान का हिस्सा के रूप में मेरी डीएओ परत करना चाहते हैं, लेकिन मेरी पहली बड़ी बाधा यह त्रुटि है:Persistence.xml और ओएसजीआई (विषुव)
Jun 29, 2009 6:12:37 PM org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.0.GA
Jun 29, 2009 6:12:37 PM org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.3.0.GA
Jun 29, 2009 6:12:37 PM org.hibernate.ejb.Ejb3Configuration configure
INFO: Could not find any META-INF/persistence.xml file in the classpath
मैं विभिन्न स्थानों का एक बहुत में persistence.xml फ़ाइल डाल, कोई फायदा नहीं हुआ है। क्या मैं गलत कर रहा हूं पर कोई विचार?
क्या persistence.xml मैन्युअल रूप से लोड करने का कोई तरीका है?
उत्प्रेरक इस तरह दिखता है:
alt text http://www.freeimagehosting.net/uploads/7b7b7d2d30.jpg
यहाँ मेरी MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Dao Plug-in
Bundle-SymbolicName: Dao
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.osgi.framework;version="1.4.0"
Bundle-Activator: com.activator.PersistenceActivator
Export-Package: com.dao.service
Require-Bundle: HibernateBundle;bundle-version="1.0.0"
है:
package com.activator;
public class PersistenceActivator implements BundleActivator {
@Override
public void start(BundleContext arg0) throws Exception {
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("postgres");
EntityManager em = emf.createEntityManager();
SimpleDaoImpl dao = new SimpleDaoImpl();
dao.setEntityManager(em);
}
@Override
public void stop(BundleContext arg0) throws Exception {
// TODO Auto-generated method stub
}
}
यहाँ क्या मेरी निर्देशिका संरचना लगता है कि है
हाइबरनेटबंडल में सभी हाइबरनेट और पर्सिस्टेंस जार शामिल हैं।
बंडल-क्लासपाथ:
यहाँ मेरी Persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<!-- Sample persistence using PostgreSQL. See postgres.txt. -->
<persistence-unit name="postgres" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.archive.autodetection" value="class" />
<!--
Comment out if schema exists & you don't want the tables dropped.
-->
<property name="hibernate.hbm2ddl.auto" value="create-drop" /> <!-- drop/create tables @startup, drop tables @shutdown -->
<!-- Database Connection Settings -->
<property name="hibernate.connection.autocommit">true</property>
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.connection.username" value="postgres" />
<property name="hibernate.connection.password" value="postgres" />
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/test" />
<!-- Not sure about these... -->
<property name="hibernate.max_fetch_depth">16</property>
<property name="hibernate.jdbc.batch_size">1000</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.default_batch_fetch_size">500</property>
<!-- Hibernate Query Language (HQL) parser. -->
<property name="hibernate.query.factory_class">
org.hibernate.hql.ast.ASTQueryTranslatorFactory</property>
<!-- Echo all executed SQL to stdout -->
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">false</property>
<!-- Use c3p0 for the JDBC connection pool -->
<property name="hibernate.c3p0.min_size">3</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
</properties>
</persistence-unit>
</persistence>
बातें मैं कोई भाग्य के साथ प्रकट की क्लासपाथ में की कोशिश की है है।, META-INF/persistence.xml
बंडल-क्लासपाथ:।, ../META-INF/persistence.xml
बंडल-क्लासपाथ:।, /META-INF/persistence.xml
बंडल-क्लासपाथ:।, ./META-INF/persistence.xml
बंडल-क्लासपाथ:। , META-INF
बंडल-क्लासपाथ:।, ../META-INF
बंडल-क्लासपाथ :।,/META-INF
बंडल-क्लासपाथ:।, ./META-INF
बंडल-क्लासपाथ:।, C: \ कार्यस्थान \ OSGiJPA \ दाव \ META-INF \ हठ .xml
बंडल-क्लासपाथ:।, C: \ कार्यस्थान \ OSGiJPA \ दाव \ META-INF
कोई भाग्य। मैं कोशिश की है: ** बंडल-क्लासपाथ:।, META-INF/persistence.xml ** ** बंडल-क्लासपाथ:।, ../META-INF/persistence.xml** ** बंडल-क्लासपाथ:।, /META-INF/persistence.xml** ** बंडल-क्लासपाथ:।, ./META-INF/persistence.xml** ** बंडल-क्लासपाथ:।, मेटा-आईएनएफ ** ** बंडल-क्लासपाथ:।, ../META-INF** ** बंडल-क्लासपाथ:।,/META-INF ** ** बंडल-क्लासपाथ:।, ./META- आईएनएफ ** ** बंडल-क्लासपाथ:।, सी: \ वर्कस्पेस \ OSGiJPA \ Dao \ META-INF \ persis tence.xml ** ** बंडल-क्लासपाथ:।, सी: \ वर्कस्पेस \ OSGiJPA \ Dao \ META-INF ** – systemoutprintln
सही दिखाई नहीं दिया, इसलिए मैंने इसे स्वयं पोस्ट में रखा – systemoutprintln
move persistence.xml जार बंडल की जड़ तक? इसे – bwobbones