gpt4 book ai didi

mysql - Karaf 4.0.0 M2 和 Hibernate 4.3.6.Final

转载 作者:行者123 更新时间:2023-11-28 23:58:53 25 4
gpt4 key购买 nike

我正在尝试将 Hibernate 4.3.6.Final 与 Karaf 4.0.0 M2 和 MySQL v5.1.35 一起使用,但出现以下错误:

karaf@root()> log:display
2015-06-05 11:14:32,068 | WARN | nsole user karaf | container | 120 - org.apache.aries.jpa.container - 1.0.2 | There are no suitable providers for the provider class name org.hibernate.jpa.HibernatePersistenceProvider and version range null to support the bundle leonard-orm-native/1.0.0.
2015-06-05 11:14:32,072 | WARN | nsole user karaf | container | 120 - org.apache.aries.jpa.container - 1.0.2 | There are no suitable providers for the provider class name org.hibernate.jpa.HibernatePersistenceProvider and version range null to support the bundle leonard-orm-native/1.0.0.
2015-06-05 11:14:32,073 | WARN | nsole user karaf | container | 120 - org.apache.aries.jpa.container - 1.0.2 | There are no suitable providers for the provider class name org.hibernate.jpa.HibernatePersistenceProvider and version range null to support the bundle leonard-orm-native/1.0.0.
2015-06-05 11:14:32,078 | ERROR | nsole user karaf | aries | 119 - org.apache.aries.jpa.blueprint.aries - 1.0.4 | No org.apache.aries.jpa.container.sync.Synchronization service registered.
2015-06-05 11:14:32,080 | INFO | nsole user karaf | BlueprintContainerImpl | 10 - org.apache.aries.blueprint.core - 1.4.2 | Bundle leonard-orm-native is waiting for dependencies [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=Leonard))(objectClass=javax.persistence.EntityManagerFactory))]
2015-06-05 11:14:32,081 | WARN | nsole user karaf | container | 120 - org.apache.aries.jpa.container - 1.0.2 | There are no suitable providers for the provider class name org.hibernate.jpa.HibernatePersistenceProvider and version range null to support the bundle leonard-orm-native/1.0.0.
2015-06-05 11:19:32,082 | ERROR | rint Extender: 3 | BlueprintContainerImpl | 10 - org.apache.aries.blueprint.core - 1.4.2 | Unable to start blueprint container for bundle leonard-orm-native due to unresolved dependencies [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=Leonard))(objectClass=javax.persistence.EntityManagerFactory))]

可以在此处找到我为使此工作正常进行所遵循的说明: http://www.liquid-reality.de/display/liquid/2012/01/13/Apache+Karaf+Tutorial+Part+6+-+Database+Access

我的项目中包含数据源配置文件,Christian 好心提供。

我已经做了重要的调查来解决问题,但我觉得我一定遗漏了一些非常简单的东西。欢迎提出想法和贡献。

各种文件和karaf配置如下。

谢谢,兰迪伦纳德


蓝图.xml

<?xml version="1.0" encoding="UTF-8"?>
<blueprint default-activation="eager" xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"

xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance
http://aries.apache.org/xmlns/jpa/v1.0.0 http://aries.apache.org/xmlns/jpa/v1.0.0
http://aries.apache.org/xmlns/transactions/v1.0.0 http://aries.apache.org/xmlns/transactions/v1.0.0 ">

<bean id="personService" class="net.lr.tutorial.karaf.db.examplejpa.impl.PersonServiceImpl">
<jpa:context unitname="Leonard" property="entityManager" />
<tx:transaction method="*" value="Required" />
</bean>

<service ref="personService" interface="net.lr.tutorial.karaf.db.examplejpa.PersonService" />

<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
<command name="person/add">
<action class="net.lr.tutorial.karaf.db.examplejpa.command.AddPersonCommand">
<property name="personService" ref="personService" />
</action>
</command>
<command name="person/list">
<action class="net.lr.tutorial.karaf.db.examplejpa.command.ListPersonsCommand">
<property name="personService" ref="personService" />
</action>
</command>
<command name="person/deleteAll">
<action class="net.lr.tutorial.karaf.db.examplejpa.command.DeleteAllPersonsCommand">
<property name="personService" ref="personService" />
</action>
</command>
</command-bundle>
</blueprint>

持久性.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="Leonard" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>osgi:service/Leonard</jta-data-source>
<class>net.lr.tutorial.karaf.db.examplejpa.Person</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>
</persistence-unit>
</persistence>

以及在 Karaf 4.0.0 M2 中加载的包列表

karaf@root()> bundle:list
START LEVEL 100 , List Threshold: 50
ID | State | Lvl | Version | Name
--------------------------------------------------------------------------------------
144 | Active | 80 | 3.2.1 | Commons Collections
145 | Active | 80 | 2.6 | Commons Lang
146 | Active | 80 | 1.6.0 | Commons Pool
147 | Active | 80 | 1.1.1 | geronimo-jms_1.1_spec
152 | Active | 80 | 1.14.1.1 | Apache ServiceMix :: Bundles :: serp
153 | Active | 80 | 3.16.0 | Apache XBean :: ASM 4 shaded (repackaged)
154 | Active | 80 | 5.1.35 | Oracle Corporation's JDBC Driver for MySQL
155 | Active | 80 | 0.9.0 | ClassMate
156 | Active | 80 | 3.18.1.GA | Javassist
157 | Active | 80 | 2.0.1 | Apache Commons DBCP
158 | Active | 80 | 2.2.0 | Apache Commons Pool
159 | Active | 80 | 1.8.2.2 | Apache ServiceMix :: Bundles :: ant
160 | Active | 80 | 2.7.7.5 | Apache ServiceMix :: Bundles :: antlr
161 | Active | 80 | 3.0.0.1 | Apache ServiceMix :: Bundles :: cglib
162 | Active | 80 | 1.6.1.5 | Apache ServiceMix :: Bundles :: dom4j
163 | Active | 80 | 4.0.4.Final | hibernate-commons-annotations
164 | Active | 100 | 4.3.6.Final | hibernate-core
165 | Active | 100 | 4.3.6.Final | hibernate-entitymanager
166 | Active | 100 | 4.3.6.Final | hibernate-osgi
167 | Active | 80 | 1.2.2.Final | Java Annotation Indexer
168 | Active | 80 | 3.1.4.GA | JBoss Logging 3
169 | Active | 80 | 1.0.2.Final | JACC 1.4 API
170 | Active | 80 | 0.5.0 | OPS4J Pax JDBC Config
171 | Active | 80 | 0.5.0 | OPS4J Pax JDBC MySQL Driver Adapter
172 | Active | 80 | 0.5.0 | OPS4J Pax JDBC Pooling support using Commons-DBCP2
173 | Active | 80 | 0.5.0 | OPS4J Pax JDBC org.osgi.service.jdbc
174 | Active | 80 | 1.9.0 | Apache ServiceMix :: Specs :: Stax API 1.0
175 | Active | 80 | 1.4 | Commons DBCP
176 | Active | 80 | 4.0.0.M2 | Apache Karaf :: JDBC :: Core
189 | Failure | 80 | 1.0.0 | leonard-orm-native

安装的功能列表如下:

karaf@root()> feature:list
Name | Version | Required | Installed | Repository | Description
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
transaction | 1.0.0 | | | enterprise-4.0.0.M2 | OSGi Transaction Manager
transaction | 1.0.1 | | | enterprise-4.0.0.M2 | OSGi Transaction Manager
transaction | 1.1.1 | x | x | enterprise-4.0.0.M2 | OSGi Transaction Manager
connector | 2.2.2 | | | enterprise-4.0.0.M2 | OSGi support for JCA Connector 1.5
connector | 3.1.1 | | | enterprise-4.0.0.M2 | OSGi support for JCA Connector 1.6
jpa | 2.0.0 | | x | enterprise-4.0.0.M2 | OSGi Persistence Container
jpa | 2.1.0 | x | x | enterprise-4.0.0.M2 | OSGi Persistence Container
openjpa | 2.2.2 | | | enterprise-4.0.0.M2 | Apache OpenJPA 2.2.x persistence engine support
openjpa | 2.3.0 | x | x | enterprise-4.0.0.M2 | Apache OpenJPA 2.3.x persistence engine support
hibernate | 3.3.2.GA | | | enterprise-4.0.0.M2 | Hibernate 3.x JPA persistence engine support
hibernate | 4.2.15.Final | | | enterprise-4.0.0.M2 | Hibernate 4.2.x JPA persistence engine support
hibernate-envers | 4.2.15.Final | | | enterprise-4.0.0.M2 | Hibernate Envers 4.2.x
hibernate | 4.3.6.Final | x | x | enterprise-4.0.0.M2 | Hibernate 4.3.x JPA persistence engine support
hibernate-envers | 4.3.6.Final | | | enterprise-4.0.0.M2 | Hibernate Envers 4.3.x
hibernate-validator | 5.0.3.Final | | | enterprise-4.0.0.M2 | Hibernate Validator support
jndi | 4.0.0.M2 | x | x | enterprise-4.0.0.M2 | OSGi Service Registry JNDI access
jdbc | 4.0.0.M2 | x | x | enterprise-4.0.0.M2 | JDBC service and commands
jms | 4.0.0.M2 | | | enterprise-4.0.0.M2 | JMS service and commands
application-without-isolation | 1.0.0 | x | x | enterprise-4.0.0.M2 | Provide EBA archive support
subsystems | 0.0.0.__aries_subsystem_version_ | | | enterprise-4.0.0.M2 | Support for OSGi subsystems
cxf-specs | 3.0.4 | | x | cxf-3.0.4 |
cxf-jaxb | 3.0.4 | | | cxf-3.0.4 |
cxf-abdera | 3.0.4 | | | cxf-3.0.4 |
wss4j | 2.0.3 | | | cxf-3.0.4 |
<!-- lots of cxf stuff -->
pax-jetty | 9.2.7.v20150116 | | x | org.ops4j.pax.web-4.1.0 | Provide Jetty engine support
pax-jetty-spdy | 4.1.0 | | | org.ops4j.pax.web-4.1.0 | Optional additional feature to run Jetty with SPDY
pax-http | 4.1.0 | | x | org.ops4j.pax.web-4.1.0 | Implementation of the OSGI HTTP Service
pax-http-whiteboard | 4.1.0 | | x | org.ops4j.pax.web-4.1.0 | Provide HTTP Whiteboard pattern support
pax-war | 4.1.0 | | x | org.ops4j.pax.web-4.1.0 | Provide support of a full WebContainer
pax-war-tomcat | 4.1.0 | | | org.ops4j.pax.web-4.1.0 | Provide support of a full WebContainer
pax-jsf-support | 4.1.0 | | | org.ops4j.pax.web-4.1.0 |
pax-cdi | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Provide CDI support
pax-cdi-1.1 | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Provide CDI 1.1 support
pax-cdi-1.2 | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Provide CDI 1.2 support
pax-cdi-weld | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Weld CDI support
pax-cdi-1.1-weld | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Weld CDI 1.1 support
pax-cdi-1.2-weld | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Weld CDI 1.2 support
pax-cdi-openwebbeans | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | OpenWebBeans CDI support
pax-cdi-web | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Web CDI support
pax-cdi-1.1-web | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Web CDI 1.1 support
pax-cdi-1.2-web | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Web CDI 1.2 support
pax-cdi-web-weld | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Weld Web CDI support
pax-cdi-1.1-web-weld | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Weld Web CDI 1.1 support
pax-cdi-1.2-web-weld | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Weld Web CDI 1.2 support
pax-cdi-web-openwebbeans | 0.12.0.SNAPSHOT | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | OpenWebBeans Web CDI support
deltaspike-core | 1.2.1 | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Apache Deltaspike core support
deltaspike-jpa | 1.2.1 | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Apache Deltaspike jpa support
deltaspike-partial-bean | 1.2.1 | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Apache Deltaspike partial bean support
deltaspike-data | 1.2.1 | | | org.ops4j.pax.cdi-0.12.0-SNAPSHOT | Apache Deltaspike data support
framework-security | 4.0.0.M2 | | | standard-4.0.0.M2 | OSGi Security for Karaf
service-security | 4.0.0.M2 | | | standard-4.0.0.M2 | Services Security for Karaf
aries-proxy | 4.0.0.M2 | | x | standard-4.0.0.M2 | Aries Proxy
aries-blueprint | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Aries Blueprint
aries-annotation | 4.0.0.M2 | | | standard-4.0.0.M2 | Aries Annotations
feature | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Features Support
shell | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Karaf Shell
shell-compat | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Karaf Shell Compatibility
deployer | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Karaf Deployer
wrapper | 4.0.0.M2 | | | standard-4.0.0.M2 | Provide OS integration
service-wrapper | 4.0.0.M2 | | | standard-4.0.0.M2 | Provide OS integration (alias to wrapper feature)
obr | 4.0.0.M2 | | x | standard-4.0.0.M2 | Provide OSGi Bundle Repository (OBR) support
bundle | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide Bundle support
config | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide OSGi ConfigAdmin support
diagnostic | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide Diagnostic support
instance | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide Instance support
jaas | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide JAAS support
log | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide Log support
package | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Package commands and mbeans
service | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide Service support
system | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide System support
http | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Implementation of the OSGI HTTP Service
http-whiteboard | 4.0.0.M2 | | x | standard-4.0.0.M2 | Provide HTTP Whiteboard pattern support
war | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Turn Karaf as a full WebContainer
jetty | 9.2.7.v20150116 | | | standard-4.0.0.M2 |
kar | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide KAR (KARaf archive) support
webconsole | 4.0.0.M2 | | | standard-4.0.0.M2 | Base support of the Karaf WebConsole
ssh | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide a SSHd server on Karaf
management | 4.0.0.M2 | x | x | standard-4.0.0.M2 | Provide a JMX MBeanServer and a set of MBeans in K
scheduler | 4.0.0.M2 | | | standard-4.0.0.M2 | Provide a scheduler service in Karaf to fire event
eventadmin | 4.0.0.M2 | | | standard-4.0.0.M2 | OSGi Event Admin service specification for event-b
jasypt-encryption | 4.0.0.M2 | | | standard-4.0.0.M2 | Advanced encryption support for Karaf security
scr | 4.0.0.M2 | | | standard-4.0.0.M2 | Declarative Service support
blueprint-web | 4.0.0.M2 | | | standard-4.0.0.M2 | Provides an OSGI-aware Servlet ContextListener for
wrap | 0.0.0 | x | x | standard-4.0.0.M2 | Wrap URL handler
profile | 4.0.0.M2 | | | standard-4.0.0.M2 | Profiles support
jolokia | 1.2.4.SNAPSHOT | | | standard-4.0.0.M2 | Jolokia monitoring support
<!-- lots of spring stuff -->
gemini-blueprint | 1.0.2.RELEASE | | | spring-4.0.0.M2 | Gemini Blueprint Extender
pax-jdbc-spec | 0.5.0 | | x | org.ops4j.pax.jdbc-0.5.0 | Provides OSGi JDBC Service spec
pax-jdbc | 0.5.0 | | | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC Service support
pax-jdbc-config | 0.5.0 | x | x | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC Config support
pax-jdbc-derby | 0.5.0 | | | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC Derbi DataSourceFactory
pax-jdbc-h2 | 0.5.0 | | | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC H2 DataSourceFactory
pax-jdbc-mariadb | 0.5.0 | | | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC Mariadb DataSourceFactory
pax-jdbc-mysql | 0.5.0 | x | x | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC MySQL DataSourceFactory
pax-jdbc-oracle | 0.5.0 | | | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC Oracle DataSourceFactory
pax-jdbc-postgresql | 0.5.0 | | | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC PostgreSQL DataSourceFactory
pax-jdbc-sqlite | 0.5.0 | | | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC SQLite DataSourceFactory
pax-jdbc-pool-dbcp2 | 0.5.0 | x | x | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC Pooling DataSourceFactory
pax-jdbc-pool-aries | 0.5.0 | | | org.ops4j.pax.jdbc-0.5.0 | Provides JDBC Pooling DataSourceFactory using Arie

关于最后一点,我注意到似乎同时加载了 jpa/2.0.0 和 jpa/2.1.0。我尝试卸载旧版本的 jpa,但得到以下信息:

karaf@root()> feature:uninstall jpa/2.0.0
Error executing command: Feature named 'jpa/2.0.0' is not installed

最佳答案

Karaf 运行时同时安装了 jpa/2.0.0 和 jpa/2.1.0。以下命令没有删除旧的 jpa 版本:

karaf@root()> feature:uninstall jpa/2.0.0
Error executing command: Feature named 'jpa/2.0.0' is not installed

所以我启动了一个新的 Karaf 4.0.0 M2 实例并从头开始安装了所需的组件。 jpa/2.0.0 未安装,但 jpa/2.1.0 已安装。因此,我收到的错误消息已得到解决。

关于mysql - Karaf 4.0.0 M2 和 Hibernate 4.3.6.Final,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30674530/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com