How to use Hibernate/JPA with OSGi [message #104918] |
Mon, 11 February 2008 07:51 |
Eclipse User |
|
|
|
Originally posted by: madihaanees.hotmail.com
Hello fellows.
I am developing one application which requires persistence with database
so I am using hibernate / JPA (EJB3-JBoss).
My structure of the of the osgi bundles are as follows
plug-in 1) "my.mimos.ejb3.hibernate.plugin" has hibernate-3,
ejb3-persistence, ejb3.x and ejb3 jar files
in its MANIFEST.MF "Eclipse-BuddyPolicy: registered" is added
plun-in 2) is my jpa bundle where i want to register EntityManagerFactory
let say "my.xxx.bundles.jpabundle" in its MANIFEST.MF
"Eclipse-RegisterBuddy: my.mimos.ejb3.hibernate.plugin" is added
jpa jar ) this is my ejb project which has entity beans and
persistence.xml file in its META-INF folder. and is packed in jar file
.... let us say liberary.jar
and liberary.jar file is added into the classpath of plug-in-2 and
exported its package let us say "my.mimos.bundles.databaseservice.beans".
plug-in 3) "my.mimos.bundles.databaseservice" is my database service used
for injection and usage of entity manager of hibernate/jpa. in its
MANFEST.MF file i didn't added the buddy policy of eclipse. this plug-in
use the jpa plug and pass the peristence unit name to the jpa bundle to
create the "EntityManagerFactory"
but when i run these plug-ins i got the following error. I am posting all
console message.
WARNING: Unable to find file (ignored): bundleresource://142
java.io.FileNotFoundException:
C:\Testing\eclipse-SDK-3.2.2-win32\projects\my.xxx.bundles.j pabundle\bin
(Access is denied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at
org.eclipse.osgi.framework.util.SecureAction.getFileInputStr eam(SecureAction.java:98)
at
org.eclipse.osgi.baseadaptor.bundlefile.FileBundleEntry.getI nputStream(FileBundleEntry.java:50)
at
org.eclipse.osgi.framework.internal.core.BundleURLConnection .connect(BundleURLConnection.java:53)
at
org.eclipse.osgi.framework.internal.core.BundleURLConnection .getInputStream(BundleURLConnection.java:99)
at java.net.URL.openStream(Unknown Source)
at
org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doPr ocessElements(InputStreamZippedJarVisitor.java:33)
at
org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(Ja rVisitor.java:215)
at
org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(E jb3Configuration.java:253)
at
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configurat ion.java:229)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFa ctory(HibernatePersistence.java:120)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:51)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:33)
at
my.mimos.bundles.jpabundle.service.JPAServiceBean.createEnti tyManagerFactory(JPAServiceBean.java:31)
at
my.mimos.bundles.databaseservice.tracker.JPATracker.addingSe rvice(JPATracker.java:33)
at
org.osgi.util.tracker.ServiceTracker$Tracked.trackAdding(Ser viceTracker.java:1014)
at
org.osgi.util.tracker.ServiceTracker$Tracked.track(ServiceTr acker.java:992)
at
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged( ServiceTracker.java:917)
at
org.eclipse.osgi.framework.internal.core.FilteredServiceList ener.serviceChanged(FilteredServiceListener.java:71)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.d ispatchEvent(BundleContextImpl.java:1216)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:189)
at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEv entSynchronous(ListenerQueue.java:141)
at
org.eclipse.osgi.framework.internal.core.Framework.publishSe rviceEventPrivileged(Framework.java:1535)
at
org.eclipse.osgi.framework.internal.core.Framework.publishSe rviceEvent(Framework.java:1510)
at
org.eclipse.osgi.framework.internal.core.ServiceRegistration Impl. <init>(ServiceRegistrationImpl.java:103)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.c reateServiceRegistration(BundleContextImpl.java:649)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.r egisterService(BundleContextImpl.java:601)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.r egisterService(BundleContextImpl.java:667)
at my.mimos.bundles.jpabundle.Activator.start(Activator.java:29 )
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:991)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:985)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:966)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:329)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1046)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:573)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:495)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:275)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:455)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:189)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:291)
Feb 11, 2008 3:48:39 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Feb 11, 2008 3:48:39 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Feb 11, 2008 3:48:39 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: true
Feb 11, 2008 3:48:39 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.postgresql.Driver at URL:
jdbc:postgresql://127.0.0.1/mimos
Feb 11, 2008 3:48:39 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=postgres, password=****,
autocommit=true, release_mode=auto}
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: PostgreSQL, version: 8.1.5
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3
with SSL (build 407)
Feb 11, 2008 3:48:39 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
Feb 11, 2008 3:48:39 PM
org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy:
org.hibernate.transaction.JDBCTransactionFactory
Feb 11, 2008 3:48:39 PM
org.hibernate.transaction.TransactionManagerLookupFactory
getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of
read-write or transactional second-level cache is not recommended)
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory
createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Feb 11, 2008 3:48:39 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory
<init>
INFO: Using ASTQueryTranslatorFactory
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: enabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory
createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Feb 11, 2008 3:48:39 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
please do help me where i did something wrong and how can i able to solve
this issue. bcoz when i try to use the EntityManager created by this
EntityManagerFacotry.... it will not able to recognize the entity beans.
Regards,
ANees-ur-Rehman
|
|
|
|
Re: How to use Hibernate/JPA with OSGi [message #105102 is a reply to message #105089] |
Wed, 13 February 2008 02:00 |
Eclipse User |
|
|
|
Originally posted by: madihaanees.gmail.com
Thanks for your reply.
Actually I tried using EasyBeans. but one i deploy easy beans in equinox
they got installed. but when I try to start them I got errors like
javax.management error with version 1.5.0
can u help me how to solve this issue.
regards
Anees-ur-Rehman
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03364 seconds