G
Gast2
Gast
Ich glaub mit Equinox geht es nicht ich find auch nirgends ein Tutorial dazu...
I would recommend trying dmServer - or at least its samples which contain EclipseLink - ORMs under OSGi tend to be tricky due to lazy loading, dynamic class creation which conflict with the modularity boundaries imposed by OSGi.
Naja ich hab noch nie die Eclipse Plugin Dinger benutzt für OSGi BundleDafür gibt es Maven *hust*
Spring DM Server ist ein fertiger Server. Wir benutzen ServiceMix 4, ein SpringDM ähnlicher Server der aber nicht Equinox nutzt sondern Apache Karaf.
Ja klar kann manWir verwenden auch ne Kombi aus Tomcat und ServiceMix
Was kein OSGi braucht, muss auch keins haben. Ein ESB dazwischen stellt dann die Verbindung her (bzw bei und ein ActiveMQ).
Nein du kannst einmal einen Webcontainer (den brauchst du z.B. für JSPs) im OSGi Server laufen lassen. Da gibt es z.B. ein fertiges Jetty-Bundle aber ich glaub auch einen Tomcat basierten.
Das ist aber (aus meiner Sicht) unnötiger Ballast, sowas auf OSGi zu deployen. Entweder kann ich ein Webapp im Tomcat reloaden oder eben nicht (weil z.B. ein HA-Frontend, das nicht mal eben so verschwinden kann) davon abhängt. In letzterem Fall bringt mir aber auch OSGi dann nichts, da ich auch hier nicht eben das Bundle neuladen darf (oder nur unter festen Bedingungen).
OSGi brauche ich wirklich nur dann, wenn ich Komponenten lose koppeln kann und darauf achte, ob ein Service vielleicht mal gerade nicht erreichbar ist, weil er z.B. geupdated wird.
Zur Verbindung zwischen Tomcat und ServiceMix nutzen wir wie gesagt einen redundanten ActiveMQ Server und greifen auf beiden Seiten per SpringRemoting darauf zu. Damit hast du ein RCP ähnliches Invoker System welches auch asynchron arbeiten kann.
Mar 1, 2010 11:17:23 PM org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'jpaVendorAdapter' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Mar 1, 2010 11:17:24 PM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory
INFO: Building JPA container EntityManagerFactory for persistence unit 'hello.jpa'
[EL Config]: The access type for the persistent class [class internal.impl.KundeImpl] is set to [PROPERTY].
[EL Config]: The alias name for the entity class [class internal.impl.KundeImpl] is being defaulted to: KundeImpl.
[EL Config]: The table name for entity [class internal.impl.KundeImpl] is being defaulted to: KUNDEIMPL.
[EL Config]: The column name for element [method getId] is being defaulted to: ID.
[EL Config]: The column name for element [method getName] is being defaulted to: NAME.
Mar 1, 2010 11:17:26 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@136e10e: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,entityManagerFactory,jpaVendorAdapter,transactionManager,factory,kundenFactory]; root of factory hierarchy
Mar 1, 2010 11:17:26 PM org.springframework.osgi.extender.internal.support.DefaultOsgiBundleApplicationContextListener onOsgiApplicationEvent
SEVERE: Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=DBObjectTest.impl, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL [bundleentry://1077.fwk3874616/META-INF/spring/db-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://1077.fwk3874616/META-INF/spring/db-context.xml]: Invocation of init method failed; nested exception is java.lang.reflect.UndeclaredThrowableException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1044)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:542)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:486)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:336)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://1077.fwk3874616/META-INF/spring/db-context.xml]: Invocation of init method failed; nested exception is java.lang.reflect.UndeclaredThrowableException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:386)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:266)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79)
at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:99)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1391)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
... 13 more
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy2.addTransformer(Unknown Source)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:228)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1400)
... 28 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager$Jpa2PersistenceUnitInfoDecorator.invoke(DefaultPersistenceUnitManager.java:433)
... 34 more
Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:109)
... 39 more
Mar 1, 2010 11:17:42 PM org.springframework.osgi.extender.internal.activator.ContextLoaderListener shutdown
INFO: Stopping [org.springframework.osgi.extender] bundle v.[1.2.1]
Mar 1, 2010 11:17:42 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in
Joar so in etwa, nur das EclipseLink schon ein OSGi Bundle ist.
ORMs under OSGi tend to be tricky due to lazy loading, dynamic class creation which conflict with the modularity boundaries imposed by OSGi.