Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unmanaged-jpa demo doesn't work #8

Open
PavelTurk opened this issue May 4, 2016 · 1 comment
Open

unmanaged-jpa demo doesn't work #8

PavelTurk opened this issue May 4, 2016 · 1 comment

Comments

@PavelTurk
Copy link

PavelTurk commented May 4, 2016

I used karaf 4.0.5. I completed all steps that are provided in instructions. This is my bundle list:

karaf@root()> bundle:list
START LEVEL 100 , List Threshold: 50

ID | State | Lvl | Version | Name

52 | Active | 80 | 3.18.1.GA | Javassist
53 | Active | 80 | 1.1.1 | geronimo-jta_1.1_spec
54 | Active | 80 | 2.7.7.5 | Apache ServiceMix :: Bundles :: antlr
55 | Active | 80 | 1.6.1.5 | Apache ServiceMix :: Bundles :: dom4j
56 | Active | 80 | 5.0.0.Final | hibernate-commons-annotations
57 | Active | 80 | 5.0.0.Final | hibernate-core
58 | Active | 80 | 5.0.0.Final | hibernate-entitymanager
59 | Active | 80 | 1.0.0.Final | hibernate-jpa-2.1-api
60 | Active | 80 | 5.0.0.Final | hibernate-osgi
61 | Active | 80 | 1.2.2.Final | Java Annotation Indexer
62 | Active | 80 | 3.3.0.Final | JBoss Logging 3
63 | Active | 80 | 1.3.170 | H2 Database Engine
64 | Active | 80 | 1.0.0 | unmanaged-jpa

This is the result:
karaf@root()> dp:addJPA Nick
Error executing command: Unable to locate persistence units

This is from log:
executing command

javax.persistence.PersistenceException: Unable to locate persistence units
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:84)[58:org.hibernate.entitymanager:5.0.0.Final]
    at org.hibernate.osgi.OsgiPersistenceProvider.createEntityManagerFactory(OsgiPersistenceProvider.java:78)[60:org.hibernate.osgi:5.0.0.Final]
    at org.hibernate.osgitest.HibernateUtil.getEntityManagerFactory(HibernateUtil.java:53)[64:org.hibernate.osgi.unmanaged-jpa:1.0.0]
    at org.hibernate.osgitest.HibernateUtil.getEntityManager(HibernateUtil.java:41)[64:org.hibernate.osgi.unmanaged-jpa:1.0.0]
    at org.hibernate.osgitest.DataPointServiceImpl.add(DataPointServiceImpl.java:37)[64:org.hibernate.osgi.unmanaged-jpa:1.0.0]
    at org.hibernate.osgitest.command.AddCommand.execute(AddCommand.java:40)[64:org.hibernate.osgi.unmanaged-jpa:1.0.0]
    at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:34)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.karaf.shell.compat.CommandTracker$1.execute(CommandTracker.java:112)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)[44:org.apache.karaf.shell.core:4.0.5]
    at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:270)[44:org.apache.karaf.shell.core:4.0.5]
    at java.lang.Thread.run(Thread.java:745)[:1.8.0_45-internal]
Caused by: org.hibernate.internal.util.xml.XsdException: Unable to locate schema [org/hibernate/jpa/persistence_1_0.xsd] via classpath
    at org.hibernate.jpa.boot.internal.PersistenceXmlParser.resolveLocalSchema(PersistenceXmlParser.java:408)[58:org.hibernate.entitymanager:5.0.0.Final]
    at org.hibernate.jpa.boot.internal.PersistenceXmlParser.v1Schema(PersistenceXmlParser.java:398)[58:org.hibernate.entitymanager:5.0.0.Final]
    at org.hibernate.jpa.boot.internal.PersistenceXmlParser.validate(PersistenceXmlParser.java:333)[58:org.hibernate.entitymanager:5.0.0.Final]
    at org.hibernate.jpa.boot.internal.PersistenceXmlParser.loadUrl(PersistenceXmlParser.java:290)[58:org.hibernate.entitymanager:5.0.0.Final]
    at org.hibernate.jpa.boot.internal.PersistenceXmlParser.parsePersistenceXml(PersistenceXmlParser.java:94)[58:org.hibernate.entitymanager:5.0.0.Final]
    at org.hibernate.jpa.boot.internal.PersistenceXmlParser.doResolve(PersistenceXmlParser.java:84)[58:org.hibernate.entitymanager:5.0.0.Final]
    at org.hibernate.jpa.boot.internal.PersistenceXmlParser.locatePersistenceUnits(PersistenceXmlParser.java:66)[58:org.hibernate.entitymanager:5.0.0.Final]
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:80)[58:org.hibernate.entitymanager:5.0.0.Final]
    ... 17 more
dreab8 pushed a commit to dreab8/hibernate-demos that referenced this issue Mar 28, 2018
create account and other minor changes
@kalungedamaji
Copy link

kalungedamaji commented Mar 24, 2019

I am also facing same issue.
My POM.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>JPA</groupId>
    <artifactId>JPA</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <version>1.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.6.Final</version>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate.javax.persistence</groupId>
                    <artifactId>hibernate-jpa-2.1-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc</artifactId>
            <version>12.1.0.2</version>
            <scope>system</scope>
            <systemPath>D:/Jar/ojdbc7.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>5.2.2.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.java-persistence</groupId>
            <artifactId>jpa-api</artifactId>
            <version>2.0-cr-1</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.2.2.Final</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

</project>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants