openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MikoĊ‚aj Gierulski" <>
Subject Using custom ValueHandler
Date Fri, 11 Apr 2008 14:39:49 GMT
I am trying to use a custom ValueHandler to map custom objects to columns.
I have implemented a class
extends org.apache.openjpa.jdbc.meta.strats.AbstractValueHandler

In my entities I use it as follows:
    @Column(name = "OPTION")
    private ConfigurationOption option;

The problem is, an org.apache.openjpa.persistence.ArgumentException is
thrown on the first attempt to access the entity, where the root of
the problem is:

"" declared custom value
handler "",
but this handler cannot be instantiated.
	at org.apache.openjpa.jdbc.meta.MappingRepository.namedHandler(
	at org.apache.openjpa.jdbc.meta.MappingRepository.defaultStrategy(
	at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(
	at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(
	at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(
	at org.apache.openjpa.meta.MetaDataRepository.preMapping(
	at org.apache.openjpa.meta.MetaDataRepository.resolve(
	... 83 more
Caused by: <1.0.0 fatal user error>
org.apache.openjpa.persistence.ArgumentException: The class name
used in a metadata extension on field
"" is not valid.
	at org.apache.openjpa.meta.JavaTypes.classForName(
	at org.apache.openjpa.meta.JavaTypes.classForName(
	at org.apache.openjpa.jdbc.meta.MappingRepository.namedHandler(
	... 91 more

I did some debugging and found out, that the problem seems to be, that
the method
org.apache.openjpa.lib.meta.CFMetaDataParser.classForName(String name,
String pkg, boolean resolve, ClassLoader loader)
called by
org.apache.openjpa.meta.JavaTypes.classForName(String name,
ClassMetaData meta, Class dec, ValueMetaData vmd, ClassLoader loader)

returns null instead of my ConfigurationOptionValueHandler class.

If I call this method from within my application though, with
classloader set to null and other arguments the same, it works
properly and returns desired class.

I am using bea weblogic 10.0.1 with openjpa 1.0.0
The ConfigurationOptionValueHandler class is located in the same jar
file, as the TestEntity class.
This jar file is located in a lib folder of a war installed as a
library on the server.
My application is also installed as a war and depends on that library.

My guess is the value handler should be located somewhere else, but I
don't know where this should be.

Any suggestions will be much appreciated.

Best regards,

View raw message