You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Ritesh Dubey <ri...@emirates.com> on 2007/10/30 07:23:55 UTC

Trying to deploy OpenJpa code

Hi , I am trying to deploy open jpa code provided with the release as a
JEE application but the error is as under : -

When I try it as stanalone application it is working fine 

<4|true|0.9.7> org.apache.openjpa.persistence.ArgumentException: A JDBC
Driver or DataSource class name must be specified in the
ConnectionDriverName property.
	at
org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourc
eFactory.java:67)
	at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFacto
ry(JDBCConfigurationImpl.java:797)
	at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstan
ce(JDBCConfigurationImpl.java:563)
	at
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingR
epository.java:1182)
	at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurati
ons.java:447)
	at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurati
ons.java:372)
	at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:99)
	at
kodo.conf.CachingMetaDataRepositoryPlugin.instantiate(CachingMetaDataRep
ositoryPlugin.java:29)
	at
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:76)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryIn
stance(OpenJPAConfigurationImpl.java:828)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryIn
stance(OpenJPAConfigurationImpl.java:823)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBro
kerFactory.java:536)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker
Factory.java:154)
	at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr
okerFactory.java:139)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:187)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:140)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:52)
	at hellojpa.Main.main(Main.java:43)
	at jsp_servlet.__test._jspService(__test.java:97)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
	at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(St
ubSecurityHelper.java:226)
	at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH
elper.java:124)
	at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:2
83)
	at
weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStu
bImpl.java:391)
	at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:3
09)
	at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:1
75)
	at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
un(WebAppServletContext.java:3370)
	at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)
	at weblogic.security.service.SecurityManager.runAs(Unknown
Source)
	at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ
letContext.java:2117)
	at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont
ext.java:2023)
	at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java
:1359)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)

This is my persistence.xml

<?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.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"/>
            -->
        </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>

 

Re: Trying to deploy OpenJpa code

Posted by Patrick Linskey <pl...@gmail.com>.
Hi,

I think that you may need to specify a non-jta data source in your
configuration; do you have any configured data sources in JNDI?

-Patrick

On Oct 29, 2007 11:23 PM, Ritesh Dubey <ri...@emirates.com> wrote:
> Hi , I am trying to deploy open jpa code provided with the release as a
> JEE application but the error is as under : -
>
> When I try it as stanalone application it is working fine
>
> <4|true|0.9.7> org.apache.openjpa.persistence.ArgumentException: A JDBC
> Driver or DataSource class name must be specified in the
> ConnectionDriverName property.
>         at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourc
> eFactory.java:67)
>         at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFacto
> ry(JDBCConfigurationImpl.java:797)
>         at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstan
> ce(JDBCConfigurationImpl.java:563)
>         at
> org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingR
> epository.java:1182)
>         at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurati
> ons.java:447)
>         at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurati
> ons.java:372)
>         at
> org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:99)
>         at
> kodo.conf.CachingMetaDataRepositoryPlugin.instantiate(CachingMetaDataRep
> ositoryPlugin.java:29)
>         at
> org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:76)
>         at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryIn
> stance(OpenJPAConfigurationImpl.java:828)
>         at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryIn
> stance(OpenJPAConfigurationImpl.java:823)
>         at
> org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBro
> kerFactory.java:536)
>         at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker
> Factory.java:154)
>         at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr
> okerFactory.java:139)
>         at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:187)
>         at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:140)
>         at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:52)
>         at hellojpa.Main.main(Main.java:43)
>         at jsp_servlet.__test._jspService(__test.java:97)
>         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
>         at
> weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(St
> ubSecurityHelper.java:226)
>         at
> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH
> elper.java:124)
>         at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:2
> 83)
>         at
> weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStu
> bImpl.java:391)
>         at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:3
> 09)
>         at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:1
> 75)
>         at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
> un(WebAppServletContext.java:3370)
>         at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
> bject.java:321)
>         at weblogic.security.service.SecurityManager.runAs(Unknown
> Source)
>         at
> weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ
> letContext.java:2117)
>         at
> weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont
> ext.java:2023)
>         at
> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java
> :1359)
>         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
>         at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
>
> This is my persistence.xml
>
> <?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.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"/>
>             -->
>         </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>
>
>
>



-- 
Patrick Linskey
202 669 5907