openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ян Программист <webautoma...@gmail.com>
Subject OPENJPA-1642
Date Sat, 08 May 2010 17:41:28 GMT
Your workaround, Michael, has no effect. Here is my persistence.xml
(updated):

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
<!--
        We need to enumerate each persistent class first in the
persistence.xml
        See: http://issues.apache.org/jira/browse/OPENJPA-78
    -->
    <persistence-unit name="none" transaction-type="RESOURCE_LOCAL">
        <mapping-file>reversemapping/orm.xml</mapping-file>
        <class>hellojpa.Message</class>
        <class>relations.Deity</class>
    </persistence-unit>

    <!--
        A persistence unit is a set of listed persistent entities as well
        the configuration of an EntityManagerFactory. We configure each
        example in a separate persistence-unit.
    -->
    <persistence-unit name="hellojpa" transaction-type="RESOURCE_LOCAL">
        <!--
            The default provider can be OpenJPA, or some other product.
            This element is optional if OpenJPA is the only JPA provider
            in the current classloading environment, but can be specified
            in cases where there are multiple JPA implementations available.
        -->
        <!--
        <provider>
            org.apache.openjpa.persistence.PersistenceProviderImpl
        </provider>
        -->

        <!-- We must enumerate each entity in the persistence unit -->
        <class>hellojpa.Message</class>

        <properties>
            <!--
                We can configure the default OpenJPA properties here. They
                happen to be commented out here since the provided examples
                all specify the values via System properties.
            -->
<property name="openjpa.DynamicEnhancementAgent" value="false"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported"/>
            <!--
            <property name="openjpa.ConnectionURL"
                value="jdbc:derby:openjpa-database;create=true"/>
            <property name="openjpa.ConnectionDriverName"
                value="org.apache.derby.jdbc.EmbeddedDriver"/>
            <property name="openjpa.ConnectionUserName"
                value="user"/>
            <property name="openjpa.ConnectionPassword"
                value="secret"/>
            -->
            <property name="openjpa.Sequence"
value="org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq"/>
        </properties>
    </persistence-unit>

    <!-- persistence unit for the "relations" example -->
    <persistence-unit name="relations" transaction-type="RESOURCE_LOCAL">
        <class>relations.Deity</class>
    </persistence-unit>

    <!-- persistence unit for the "reversemapping" example -->
    <persistence-unit name="reversemapping"
transaction-type="RESOURCE_LOCAL">
        <mapping-file>reversemapping/orm.xml</mapping-file>
    </persistence-unit>

    <persistence-unit name="embeddables" transaction-type="RESOURCE_LOCAL">

 <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <class>embeddables.Address</class>
        <class>embeddables.ContactInfo</class>
        <class>embeddables.Coordinates</class>
        <class>embeddables.Phone</class>
        <class>embeddables.User</class>
    </persistence-unit>

</persistence>

Exception trace:

1672  embeddables  ERROR  [main] openjpa.Runtime - Failed to create a
provider for "embeddables".
java.lang.RuntimeException: There were errors initializing your
configuration: java.lang.ClassCastException:
org.apache.openjpa.conf.OpenJPAConfigurationImpl cannot be cast to
org.apache.openjpa.jdbc.conf.JDBCConfiguration
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.setConfiguration(TableJDBCSeq.java:239)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:475)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:432)
at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getSequenceInstance(OpenJPAConfigurationImpl.java:1390)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:294)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1602)
at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCEnhancerAgent.java:185)
at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:145)
at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:98)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:324)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:100)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:154)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:65)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:150)
at Main.main(Main.java:32)

at
org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:308)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1602)
at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCEnhancerAgent.java:185)
at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:145)
at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:98)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:324)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:100)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:154)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:65)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:150)
at Main.main(Main.java:32)
Exception in thread "main" javax.persistence.PersistenceException: Explicit
persistence provider error(s) occurred for "embeddables" after trying the
following discovered implementations:
org.apache.openjpa.persistence.PersistenceProviderImpl from provider:
org.apache.openjpa.persistence.PersistenceProviderImpl
at
javax.persistence.Persistence.createPersistenceException(Persistence.java:242)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:184)
at Main.main(Main.java:32)
Caused by: java.lang.RuntimeException: There were errors initializing your
configuration: java.lang.ClassCastException:
org.apache.openjpa.conf.OpenJPAConfigurationImpl cannot be cast to
org.apache.openjpa.jdbc.conf.JDBCConfiguration
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.setConfiguration(TableJDBCSeq.java:239)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:475)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:432)
at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getSequenceInstance(OpenJPAConfigurationImpl.java:1390)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:294)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1602)
at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCEnhancerAgent.java:185)
at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:145)
at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:98)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:324)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:100)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:154)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:65)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:150)
at Main.main(Main.java:32)

at
org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:308)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1602)
at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCEnhancerAgent.java:185)
at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:145)
at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:98)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:324)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:100)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:154)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:65)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:150)
... 1 more

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message