You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by "KARR, DAVID (ATTCINW)" <dk...@att.com> on 2009/12/16 20:41:41 UTC

Can't run Ant enhancer from Eclipse

I've alluded to this before, but I need to fully address this now.

I've got my build using build-time enhancement.  It appears to work fine
from the command line, but when I run the same Ant task from Eclipse, I
get the output that follows this.  Following the build output is the
relevant portion of my build.xml file.  My persistence.xml file is in
"src/java/META-INF/persistence.xml", which is covered in the classpath.

What could I be doing wrong here?

Ant build from Eclipse:
------------
enhance.classpath[C:\Documents and
Settings\dk068x\workspace3\DynamicContent\lib\openjpa-1.2.1.jar;C:\Docum
ents and
Settings\dk068x\workspace3\DynamicContent\lib\geronimo-jpa_3.0_spec-1.0.
jar;C:\Documents and
Settings\dk068x\workspace3\DynamicContent\lib\geronimo-jta_1.1_spec-1.1.
jar;C:\Documents and
Settings\dk068x\workspace3\DynamicContent\lib\commons-lang-2.4.jar;C:\Do
cuments and
Settings\dk068x\workspace3\DynamicContent\lib\commons-collections-3.2.1.
jar;C:\Documents and
Settings\dk068x\workspace3\DynamicContent\lib\serp-1.13.1.jar;C:\Documen
ts and Settings\dk068x\workspace3\DynamicContent\src\java;C:\Documents
and Settings\dk068x\workspace3\DynamicContent\build\classes]
     [java] ProductDerivations: 4
     [java] 1. org.apache.openjpa.jdbc.conf.JDBCProductDerivation: OK
     [java] 2.
org.apache.openjpa.persistence.PersistenceProductDerivation: OK
     [java] 3.
org.apache.openjpa.persistence.jdbc.JDBCPersistenceProductDerivation: OK
     [java] 4. org.apache.openjpa.slice.ProductDerivation: OK
 [openjpac] <openjpa-1.2.1-r752877:753278 fatal user error>
org.apache.openjpa.util.MetaDataException: MetaDataFactory could 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 it 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 <config> element. This
can also occur if your OpenJPA distribution jars are corrupt, or if your
security policy is overly strict.
 [openjpac] 	at
org.apache.openjpa.meta.MetaDataRepository.initializeMetaDataFactory(Met
aDataRepository.java:1567)
 [openjpac] 	at
org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepo
sitory.java:1558)
 [openjpac] 	at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurati
ons.java:505)
 [openjpac] 	at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurati
ons.java:430)
 [openjpac] 	at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103
)
 [openjpac] 	at
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepo
sitoryValue.java:68)
 [openjpac] 	at
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
 [openjpac] 	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryIn
stance(OpenJPAConfigurationImpl.java:863)
 [openjpac] 	at
org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:88)
 [openjpac] 	at
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
 [openjpac] 	at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
 [openjpac] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
 [openjpac] 	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
 [openjpac] 	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
 [openjpac] 	at java.lang.reflect.Method.invoke(Method.java:585)
 [openjpac] 	at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:1
06)
 [openjpac] 	at org.apache.tools.ant.Task.perform(Task.java:348)
 [openjpac] 	at org.apache.tools.ant.Target.execute(Target.java:357)
 [openjpac] 	at
org.apache.tools.ant.Target.performTasks(Target.java:385)
 [openjpac] 	at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
 [openjpac] 	at
org.apache.tools.ant.Project.executeTarget(Project.java:1306)
 [openjpac] 	at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:41)
 [openjpac] 	at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTar
gets(EclipseDefaultExecutor.java:32)
 [openjpac] 	at
org.apache.tools.ant.Project.executeTargets(Project.java:1189)
 [openjpac] 	at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt
Runner.java:423)
 [openjpac] 	at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAn
tRunner.java:137)
------------

Relevant part of build.xml:
-------------
<project name="DynamicContent" default="build" basedir=".">
	
	<property file="build-dyncontent.properties"/>
	
	<path id="enhance.classpath">
		<pathelement location="${openjpa.jar}"/>
		<pathelement location="${jpa.jar}"/>
        <pathelement location="${jta.jar}"/>
        <pathelement location="${commons-lang.jar}"/>
		<pathelement location="${commons-collections.jar}"/>
		<pathelement location="${serp.jar}"/>
		<pathelement location="src/java"/>
	    <pathelement location="build/classes"/>
	</path>
	
	<path id="build.classpath">
        <pathelement location="${openjpa.jar}"/>
		<pathelement location="${jackson-mapper.jar}"/>
        <pathelement location="${jackson-core-asl.jar}"/>
        <pathelement location="${jackson-jaxrs.jar}"/>
        <pathelement location="${jackson-xc.jar}"/>
        <pathelement location="${aspectjrt.jar}"/>
        <pathelement location="${aspectjweaver.jar}"/>
        <pathelement location="${commons-lang.jar}"/>
        <pathelement location="${commons-logging.jar}"/>
        <pathelement location="${commons-beanutils.jar}"/>
        <pathelement location="${commons-collections.jar}"/>
        <pathelement location="${serp.jar}"/>
        <pathelement location="${cxf.jar}"/>
        <pathelement location="${jaxb-api.jar}"/>
        <pathelement location="${jaxb-impl.jar}"/>
        <pathelement location="${jsr311-api.jar}"/>
        <pathelement location="${spring.jar}"/>
        <pathelement location="${cglib.jar}"/>
        <pathelement location="${wsdl4j.jar}"/>
        <pathelement location="${XmlSchema.jar}"/>
		<pathelement location="${jpa.jar}"/>
        <pathelement location="build/classes"/>
	</path>
	
	<path id="test.classpath">
        <pathelement location="${derby.jar}"/>
        <pathelement location="${junit.jar}"/>
        <pathelement location="${jta.jar}"/>
		<pathelement location="build/testclasses"/>
		<path refid="build.classpath"/>
	</path>
	
	<target name="build"
depends="compile,enhance-classes,assemble-war,assemble-ear">
	</target>
	
	<target name="compile">
		<delete dir="build"/>
		<mkdir dir="build/classes"/>
		<javac destdir="build/classes" debug="true"
failonerror="true">
			<src path="src/java"/>
			<classpath refid="build.classpath"/>
		</javac>
	</target>
		
	<taskdef classpathref="enhance.classpath" name="openjpac"
classname="org.apache.openjpa.ant.PCEnhancerTask"/>
	
	<target name="enhance-classes">
		<pathconvert property="echo.enhance.classpath"
refid="enhance.classpath"/>
		<echo
message="enhance.classpath[${echo.enhance.classpath}]"/>
		<java
classname="org.apache.openjpa.lib.conf.ProductDerivations">
			<classpath refid="enhance.classpath"/>
		</java>
		<openjpac directory="build/enhancedClasses"
enforcepropertyrestrictions="true">
			<classpath refid="enhance.classpath"/>
			<fileset dir="src/java">
			    <include name="**/domain/*.java"/>
			</fileset>
		</openjpac>
	</target>
</project>
-----------