openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CASERO Jaime" <JCas...@covansys.com>
Subject RE: build time enhancement in an eclipse plug-in project
Date Mon, 20 Aug 2007 08:52:41 GMT
This the ant task I'm using

	<target name="enhance">
		
		<taskdef name="openjpac"
classname="org.apache.openjpa.ant.PCEnhancerTask">
		    <classpath id="jpa.classpath">
		      <fileset
dir="${project.path}\WebContent\WEB-INF\lib">
		        <include name="*.jar"/>
		      </fileset>
			  <fileset
dir="${project.path}\WebContent\WEB-INF\lib\xalan-j_2_7_0">
			     <include name="*.jar"/>
			  </fileset>		    	
			  <fileset
dir="${project.path}\WebContent\WEB-INF\lib\xerces-2_9_0">
				<include name="*.jar"/>
			  </fileset>		    	
		      <pathelement
location="${project.path}\build\classes"/> 
		    </classpath>			
		</taskdef>
		
		
		<openjpac tmpClassLoader="false"
directory="build\classes">
		    <classpath id="jpa.classpath">
		      <fileset
dir="${project.path}\WebContent\WEB-INF\lib">
		        <include name="*.jar"/>
		      </fileset>
				  <fileset
dir="${project.path}\WebContent\WEB-INF\lib\xalan-j_2_7_0">
				     <include name="*.jar"/>
				  </fileset>		    	
				  <fileset
dir="${project.path}\WebContent\WEB-INF\lib\xerces-2_9_0">
					<include name="*.jar"/>
				  </fileset>			    	
		      <pathelement
location="${project.path}\build\classes"/> 
		    </classpath>			
			<config
propertiesFile="build/classes/META-INF/persistence.xml"/>

		
		</openjpac>
	</target>


I'm using "propertiesFile" att instead of "properties" in the "config"
tag. Of course your problem is ant can not locate the persistence.xml
(something with the classpath and the proper path). Have you already try
to use an absolute path instead of relative?.

As you can see, I'm not file setting the classes to enhance. I found
that is better to list them one by one in the "persistence.xml" file (in
this case omit any file set tag in the enhance task).

-----Original Message-----
From: sudhakar [mailto:sudhakar@co.brazos.tx.us] 
Sent: Saturday, August 18, 2007 11:54 PM
To: users@openjpa.apache.org
Subject: build time enhancement in an eclipse plug-in project

Being unable to get the runtime enhancement working with my Eclipse
plug-in project I decided to try the build time enhancement. And am
running into some issues:

My project is an eclipse plug-in project with the following structure:
enhance.xml
src
src\META-INF
src\META-INF\persistence.xml

Here is my enhance.xml ant build file
<project name="brazos.voter.client" default="enhance">

    <target name="enhance">
        <!-- define the openjpac task; this can be done at the top of
the    -->
        <!-- build.xml file, so it will be available for all
targets      -->
        <taskdef name="openjpac"
classname="org.apache.openjpa.ant.PCEnhancerTask">
            <classpath>
                <pathelement
location="C:/libraries/openjpa/current/openjpa.jar" />
                <pathelement
location="C:/libraries/openjpa/current/commons-lang-2.1.jar" />
                <pathelement
location="C:/libraries/openjpa/current/geronimo-jta_1.0.1B_spec-1.0.1.ja
r"
/>
                <pathelement
location="C:/libraries/openjpa/current/geronimo-j2ee-connector_1.5_spec-
1.0.1.jar"
/>
                <pathelement
location="C:/libraries/openjpa/current/serp-1.11.0.jar" />
            </classpath>
        </taskdef>

        <openjpac>
            <fileset dir=".">
                <include name="**/domain/*.java" />
            </fileset>
            <!-- <config properties="bin/META-INF/persistence.xml" />
-->
        </openjpac>
    </target>
</project>


Here is my persistence.xml

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    version="1.0">
    <persistence-unit name="voterPU"
        transaction-type="RESOURCE_LOCAL">
        <provider>
            org.apache.openjpa.persistence.PersistenceProviderImpl
        </provider>
        <class>brazos.voter.client.lib.domain.Voter</class>
        <properties>
            <property name="openjpa.ConnectionDriverName"
                value="org.apache.derby.jdbc.EmbeddedDriver" />
            <property name="openjpa.ConnectionFactoryProperties"
                value="QueryTimeout=5000" />
            <property name="openjpa.ConnectionURL"
                value="jdbc:derby:C:/Elections/VoterDB" />
            <property name="openjpa.ConnectionUserName" value="app" />
            <property name="openjpa.ConnectionPassword" value="" />
            <property name="openjpa.Log" value="DefaultLevel=TRACE" ,
                Tool="INFO" , Runtime="TRACE" />
        </properties>
    </persistence-unit>
</persistence>

I added the ant builder to the project properties and added the bin
folder to the classpath for the ant builder.

When I launch my RCP application with the plugin I get an Ant Build
Failed dialog with the following message:

"org.apache.openjpa.util.MetaDataException: MetaDataFactory count not be
configured (conf.newMetaDataFactoryInstance() returned null). This might
mean that no configuration properties were found. Ensure that you have a
META-INF/persistence.xml file, that is available in your classpath, or
that the properties file you are using for configuration is available.
If you are using Ant, please see the <properties> or <propertiesFile>
attributes of the task's nested <cofig> element. This can also occur if
your OpenJPA distribution jars are corrupt, or if your security policy
is overly strict."

I've tried adding the following to the openjpac tag in the enhance.xml

<config properties="bin/META-INF/persistence.xml" />
<config properties="META-INF/persistence.xml" />
<config properties="src/META-INF/persistence.xml" />
<config propertiesFile="bin/META-INF/persistence.xml" />
<config propertiesFile="META-INF/persistence.xml" />
<config propertiesFile="src/META-INF/persistence.xml" />

None of this has fixed the issue. I'd appreciate any help getting this
to work.
-sud
 
Confidentiality Statement:
 
This message is intended only for the individual or entity to which it is addressed. It may
contain privileged, confidential information which is exempt from disclosure under applicable
laws. If you are not the intended recipient, please note that you are strictly prohibited
from disseminating or distributing this information (other than to the intended recipient)
or copying this information. If you have received this communication in error, please notify
us immediately by return email.
-----------------------------

Mime
View raw message