I created the following JIRA:

https://issues.apache.org/jira/browse/OPENJPA-2052

/Bengt

2011/9/13 Bengt Rodehav <be...@rodehav.com>

> Hello,
>
> Just wanted to check if you've had any chance to look at this Pinak.
>
> /Bengt
>
>
> 2011/9/8 Bengt Rodehav <be...@rodehav.com>
>
>> Hello again,
>>
>> I'm not familiar with the class resolver plugin but I did the following:
>>
>> - I created a resolver (code is at the end of the mail)
>> - I configured my persistence.xml to use that resolver (persistence.xml at
>> the end of the mail)
>>
>> The above does not throw any exceptions on startup. On the other hand, I'm
>> not sure whether it's used. I added a System.out logging in
>> the getClassLoader() method but the output never shows up in runtime but it
>> does seem to show up during build time when I run the PCEnhancer ant task.
>>
>> I then tried to move my resolver into a package that I do not export (in
>> OSGi). I thought that even if the getClassLoader() method wasn't called,
>> OpenJPA might still want to find the class and then fail. But I still get no
>> errors regarding the class resolver in runtime (under OSGi). Note that at
>> this point I'm not really using OpenJPA in the container, I'm just loading
>> and initalising it.
>>
>> Not sure if this proves your point Pinaki - you be the judge.
>>
>> /Bengt
>>
>> *MyClassResolver.java*
>>
>>> *package se.digia.maia.resolver;
>>> import org.apache.openjpa.util.ClassResolver;
>>> public class MyClassResolver implements ClassResolver {
>>>   @Override
>>>   public ClassLoader getClassLoader(Class<?> theArg0, ClassLoader
>>> theArg1) {
>>>     System.out.println("***Calling MyClassResolver***");
>>>     return null;
>>>   }
>>> }*
>>
>>
>> *persistence.xml*
>>
>>> *<?xml version="1.0" encoding="UTF-8"?>
>>> <persistence xmlns="http://java.sun.com/xml/ns/persistence"; xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance";
>>>   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
>>>   version="2.0">
>>>   <persistence-unit name="maiaPU" transaction-type="JTA">
>>>
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>     <jta-data-source>osgi:service/javax.sql.DataSource/(
>>> osgi.jndi.service.name=jdbc/maiajta)</jta-data-source>
>>>     <class>se.digia.maia.common.persistence.EntityBase</class>
>>>     <class>se.digia.maia.common.security.domain.User</class>
>>>     <class>se.digia.maia.common.auditlog.domain.AuditLogEntry</class>
>>>     <class>se.digia.maia.core.bu.domain.BusinessUnit</class>
>>>     <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>     <validation-mode>NONE</validation-mode>
>>>     <properties>
>>>       <property name="openjpa.ClassResolver"
>>> value="se.digia.maia.resolver.MyClassResolver" />
>>>       <property name="openjpa.ConnectionFactoryMode" value="managed" />
>>>       <property name="openjpa.jdbc.SynchronizeMappings"
>>> value="buildSchema(ForeignKeys=true)" />
>>>       <property name="openjpa.jdbc.DBDictionary"
>>> value="org.apache.openjpa.jdbc.sql.MySQLDictionary" />
>>>       <property name="openjpa.jdbc.UpdateManager" value="operation-order"
>>> />
>>>       <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"
>>> />
>>> <!--      <property name="openjpa.Auditor"
>>> value="se.digia.maia.common.auditlog.impl.MaiaAuditor" />-->
>>> <!--      <property name="openjpa.InitializeEagerly" value="true" />-->
>>>       <!--property name="openjpa.Auditor" value="default"/-->
>>>     </properties>
>>>   </persistence-unit>
>>> </persistence>*
>>
>>
>>
>>
>> 2011/9/7 Pinaki Poddar <ppod...@apache.org>
>>
>>> The auditor is plugged-in in an unusual way than other plug-ins. So that
>>> might be causing this failure. But please do the following:
>>> 1. Configure any other OpenJPA plugin that takes a fully-qualified class
>>> name as property value e.g. [1]
>>> 2. Supply a org.acme.Foo class for it and package exactly the way you
>>> have
>>> packaged the Auditor implementation class.
>>> 3. Verify if the plugged-in class is loaded
>>>
>>> We will know whether it is a generic failure with loading plug-in in OSGi
>>> environment or specific to Auditor.
>>>
>>> [1]
>>>
>>> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#openjpa.ClassResolver
>>>
>>> -----
>>> Pinaki Poddar
>>> Chair, Apache OpenJPA Project
>>> --
>>> View this message in context:
>>> http://openjpa.208410.n2.nabble.com/Auditor-and-OSGi-tp6759170p6769605.html
>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>
>>
>>
>

Reply via email to