Could you post all import package from your bundle?
Several packages are aslo needed for your bundle such as
org.hibernate.ejb,
org.hibernate.proxy,
org.hibernate.hql.ast,
javassist.util.proxy,
org.apache.commons.dbcp,
org.springframework.orm.jpa,
org.springframework.orm.jpa.vendor,
org.springframework.transaction.support,Ensure they are all there. Freeman On 2010-4-13, at 下午1:58, Jason Chaffee wrote:
If look at the bundle information, I already have the all of the import packages for postgresql. My understanding is that using <Require-Bundle> will include all the packages found. See paste below:org.postgresql,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.core,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.core.types,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.core.v2,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.core.v3,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.ds,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.ds.common,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.ds.jdbc23,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.ds.jdbc4,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.fastpath,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.geometric,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.jdbc2,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.jdbc2.optional,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.jdbc3,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.jdbc4,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.largeobject,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.ssl,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.translation,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.util,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211) org.postgresql.xa,version=8.3.604 from com.springsource.org.postgresql.jdbc4 (211)-----Original Message----- From: Freeman Fang [mailto:[email protected]] Sent: Mon 4/12/2010 10:57 PM To: [email protected] Subject: Re: error with osgi jax-rs service Hi, Take a look at $SMX_HOME/examples/jpa-osgi/wsdl-first-cxfse-bundle/ pom.xml, it use <Import-Package> org.hsqldb, org.hsqldb.util, org.hsqldb.jdbc </Import-Package> to make hsqldb driver available in the bundle, could you do the same way? Freeman On 2010-4-13, at ??1:45, Jason Chaffee wrote:I have looked at jpa-osgi example and I have tried both <Require- Bundle> and <Embed-Dependency> for the driver. In both cases, I get the same error. Isn't the hsqldb jar deployed in the system directory? Does that make any difference? The class is found when I do the require-bundle because I did a Class.forName on the driver in my own code and it worked. It just seems that it isn't working hibernate from the jpa-hibernate feature. I honestly think I have tried everything that I can think of and it just doesn't make any sense why it isn't working. Jason -----Original Message----- From: Freeman Fang [mailto:[email protected]] Sent: Mon 4/12/2010 10:38 PM To: [email protected] Subject: Re: error with osgi jax-rs service Hi, How about your bundle import the db driver package? We have a jpa-osgi example(which use org.hsqldb.jdbcDriver) shipped with FUSE ESB 4.2 kit, just in case you were not aware of that. Freeman On 2010-4-13, at ??1:15, Jason Chaffee wrote:Does anyone have any insight on why I cannot get a database connection with my OSGI service in Servicemix, but the exact same code on the exact same machine is able to get a connection with the database in unit-tests and when deployed in a war? I am using the postgresql bundle created by spring in all three scenarios and other the log message error in the karaf.log, there are no errors with my service or the imports. I am stuck, any help is greatly appreciated. Thanks, Jason -----Original Message----- From: Jason Chaffee [mailto:[email protected]] Sent: Mon 4/12/2010 5:42 PM To: [email protected]; [email protected]; [email protected] Subject: RE: error with osgi jax-rs service I almost have everything working, but there is one last error that I don't understand with regards to the DB driver. I added the postgresql wrapped jar to my required bundles and I see in the logs that the driver is loaded, but I am still getting a sql exception with regards to finding an adequate driver. It loaded the correct driver, yet it cannot find a suitable driver few log statements later?? Any ideas? Here are the logs: 17:37:43,426 | INFO | xtenderThread-58 | DriverManagerDataSource | tasource.DriverManagerDataSource 155 | Loaded JDBC driver: org.postgresql.Driver 17:37:43,463 | INFO | xtenderThread-58 | HbmBinder | org.hibernate.cfg.HbmBinder 322 | Mapping class: com.ebates.csp.dto.Store -> merchants 17:37:43,465 | INFO | xtenderThread-58 | AnnotationConfiguration | nate.cfg.AnnotationConfiguration 369 | Hibernate Validator not found: ignoring 17:37:43,466 | INFO | xtenderThread-58 | AnnotationSessionFactoryBean | bernate3.LocalSessionFactoryBean 730 | Building new Hibernate SessionFactory 17:37:43,468 | INFO | xtenderThread-58 | rnateSearchEventListenerRegister | rnateSearchEventListenerRegister 53 | Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 17:37:43,469 | INFO | xtenderThread-58 | ConnectionProviderFactory | ection.ConnectionProviderFactory 95 | Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider 17:37:43,470 | WARN | xtenderThread-58 | JDBCExceptionReporter | rnate.util.JDBCExceptionReporter 100 | SQL Error: 0, SQLState: 08001 17:37:43,470 | ERROR | xtenderThread-58 | JDBCExceptionReporter | rnate.util.JDBCExceptionReporter 101 | No suitable driver found for jdbc:postgresql://uat- vm.ebates.com:5432/EBJASON 17:37:43,471 | WARN | xtenderThread-58 | SettingsFactory | rg.hibernate.cfg.SettingsFactory 133 | Could not obtain connection to query metadata java.sql.SQLException: No suitable driver found for jdbc:postgresql://myserver:5432/EBJASON -----Original Message----- From: Jason Chaffee [mailto:[email protected]] Sent: Mon 4/12/2010 3:23 PM To: [email protected]; [email protected] Subject: RE: error with osgi jax-rs service Ok, I have gotten further now. I installed the jpa-hibernate feature and now my only problem is getting the postgres driver in the classpath. I tried two different approaches and neither seemed to work. First, I tried wrapping it as a bundle and I tried to add it to the system directory and neither approach seemed to work. Any other suggestions? thanks, Jason -----Original Message----- From: Freeman Fang [mailto:[email protected]] Sent: Mon 4/12/2010 12:41 AM To: [email protected] Subject: Re: error with osgi jax-rs service Hi,I think you need take a look at FUSE ESB 4.2(which is based on Apache4.x). There's a jpa-hibernate feature with FUSE ESB 4.2 kit and provide hibernate bundles for you, also there's a jpa-osgi example with that kit. You can download the kit from [1] [1]http://repo.open.iona.com/maven2/org/apache/servicemix/apache-servicemix/4.2.0-fuse-01-00/ Freeman On 2010-4-12, at ??3:32, Jason Chaffee wrote:I am trying to deploy an osgi jax-rs service. It uses spring and hibernate to load data from a DB and into JAXB annotated classes that are used by the service. This service is working fine as a webapp, but I would like to deploy on servicemix 4.x as an osgi service. I have wrapped hibernate and other jars that being used and deployed, but I am still getting the error below. It is too cryptic for me to even know what the issue is, other than it can't find some dependency. Any help is greatly appreciated. 00:16:00,322 | INFO | xtenderThread-79 | DependencyServiceManager | startup.DependencyServiceManager 232 | OsgiBundleXmlApplicationContext(bundle=com.ebates.cbsp,config=osgibundle:/META-INF/spring/*.xml) is waiting for unsatisfieddependencies [[&osgiDestinationRegistry]] 00:21:00,333 | WARN | Timer-0 | WaiterApplicationContextExecutor | WaiterApplicationContextExecutor 453 | Timeout occurred before finding service dependencies for [OsgiBundleXmlApplicationContext(bundle=com.ebates.cbsp, config=osgibundle:/META-INF/spring/*.xml)] 00:21:00,334 | INFO | Timer-0 | DefaultListableBeanFactory | ort.DefaultSingletonBeanRegistry 421 | Destroying singletons in org .springframework.beans.factory.support.defaultlistablebeanfact...@2bc609cd: definingbeans [cxf ,org .apache .cxf .bus .spring .BusApplicationListener ,org .apache .cxf .bus .spring .BusWiringBeanFactoryPostProcessor ,org .apache .cxf .bus .spring .Jsr250BeanPostProcessor ,org .apache .cxf .bus .spring .BusExtensionPostProcessor ,org .apache .cxf .resource .ResourceManager ,org .apache .cxf .configuration .Configurer ,org .apache .cxf .binding .BindingFactoryManager ,org .apache .cxf .transport .DestinationFactoryManager ,org .apache .cxf .transport .ConduitInitiatorManager ,org .apache .cxf .wsdl .WSDLManager ,org .apache .cxf .phase .PhaseManager ,org .apache .cxf .workqueue .WorkQueueManager ,org .apache .cxf .buslifecycle .BusLifeCycleManager ,org .apache .cxf .endpoint .ServerRegistry ,org .apache .cxf .endpoint .ServerLifeCycleManager ,org .apache .cxf .endpoint .ClientLifeCycleManager ,org .apache .cxf .transports .http .QueryHandlerRegistry ,org .apache .cxf .endpoint .EndpointResolverRegistry ,org .apache .cxf .headers .HeaderManager ,org .apache .cxf .catalog .OASISCatalogManager ,org .apache .cxf .endpoint .ServiceContractResolverRegistry ,org .apache .cxf .jaxrs .JAXRSBindingFactory ,org .apache .cxf .binding .http .HttpBindingFactory ,org .apache .cxf .transport .servlet .ServletTransportFactory ,org .apache .cxf .transport .http_osgi .OsgiTransportFactory ,osgiDestinationRegistry ,org .springframework .beans .factory .annotation .AutowiredAnnotationBeanPostProcessor #0 ,storeService ,seiOutInterceptor ,seiInInterceptor ,cspService ,cxf .config ,cspDataSource ,transactionManager ,propertyConfigurer,cspSessionFactory,storeDAO,storeManager]; root of factory hierarchy 00:21:00,348 | ERROR | Timer-0 | WaiterApplicationContextExecutor | WaiterApplicationContextExecutor 432 | Unable to create application context for [com.ebates.cbsp], unsatisfied dependencies: Dependency on [(objectClass =org.apache.cxf.transport.http_osgi.OsgiDestinationRegistryIntf)] (from bean [&osgiDestinationRegistry])org.springframework.context.ApplicationContextException: Applicationcontext initialization for 'com.ebates.cbsp' has timed out at org .springframework .osgi .extender .internal .dependencies .startup .DependencyWaiterApplicationContextExecutor .timeout(DependencyWaiterApplicationContextExecutor.java:462) at org .springframework .osgi .extender .internal .dependencies .startup.DependencyWaiterApplicationContextExecutor.access $000(DependencyWaiterApplicationContextExecutor.java:51) at org .springframework .osgi .extender .internal .dependencies.startup.DependencyWaiterApplicationContextExecutor $WatchDogTask.run(DependencyWaiterApplicationContextExecutor.java: 108) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) 00:21:00,349 | ERROR | Timer-0 | ContextLoaderListener | BundleApplicationContextListener 50 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=com.ebates.cbsp, config=osgibundle:/META-INF/spring/*.xml))org.springframework.context.ApplicationContextException: Applicationcontext initialization for 'com.ebates.cbsp' has timed out at org .springframework .osgi .extender .internal .dependencies .startup .DependencyWaiterApplicationContextExecutor .timeout(DependencyWaiterApplicationContextExecutor.java:462) at org .springframework .osgi .extender .internal .dependencies .startup.DependencyWaiterApplicationContextExecutor.access $000(DependencyWaiterApplicationContextExecutor.java:51) at org .springframework .osgi .extender .internal .dependencies.startup.DependencyWaiterApplicationContextExecutor $WatchDogTask.run(DependencyWaiterApplicationContextExecutor.java: 108) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) thanks, Jason-- Freeman Fang ------------------------ Open Source SOA: http://fusesource.com-- Freeman Fang ------------------------ Open Source SOA: http://fusesource.com-- Freeman Fang ------------------------ Open Source SOA: http://fusesource.com
-- Freeman Fang ------------------------ Open Source SOA: http://fusesource.com
