As an aside, this is clearly a configuration item for Spring. From my application context....

    <bean id="persistenceUnitManager"
class = "org .springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
        <property name="persistenceXmlLocations">
            <list>
                <value>classpath:META-INF/persistence.xml</value>
            </list>
        </property>
        <property name="loadTimeWeaver">
<bean class ="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>
        </property>
    </bean>

This was derived from several JPA+Spring+Wicket examples. The weaver is non-optional with the way I've gotten this all working as far as it is.

-David

On May 30, 2008, at 3:20 PM, David Nedrow wrote:


On May 30, 2008, at 2:26 PM, James Carman wrote:

Take a look at what classloaders loaded each of the classes.  If the
class names are the same, then that means that they were loaded by two different classloaders. How are you setting up your application? Are
all jars in your WEB-INF/lib directory?

I added the following to just before line that causes the cast failure...

java.lang.ClassLoader ctxCl = Thread.currentThread().getContextClassLoader(); java.lang.ClassLoader tcCl = Protocol.class.getClassLoader(); java.lang.ClassLoader soCl = item.getModelObject().getClass().getClassLoader();

               System.out.println("ctxCl=" + ((ctxCl == null)
                                              ? "null"
                                              : ctxCl.toString()));
               System.out.println("tcCl=" + ((tcCl == null)
                                             ? "null"
                                             : tcCl.toString()));
               System.out.println("soCl=" + ((soCl == null)
                                             ? "null"
                                             : soCl.toString()));

Below is the run output, which would appear to show WebAppClassloader for the target, and a Spring loader for the source. Isn't the whole point of Spring to do exactly that? Load classes dynamically? In any case, any suggestions, or should I hit the Spring forum now that it appear to be Spring specific?

-David

[TopLink Info]: 2008.05.30 03:07:21.737--ServerSession(878231)-- file:/Users/dnedrow/Developer/NetBeansProjects/FilterRequest/build/ web/WEB-INF/classes/-NetConfPU login successful
finding all Protocol instances
ctxCl=WebappClassLoader
 delegate: true
 repositories:
   /WEB-INF/classes/
----------> Parent Classloader:
EJBClassLoader :
urlSet = []
doneCalled = false
Parent -> [EMAIL PROTECTED]
tcCl=WebappClassLoader
 delegate: true
 repositories:
   /WEB-INF/classes/
----------> Parent Classloader:
EJBClassLoader :
urlSet = []
doneCalled = false
Parent -> [EMAIL PROTECTED]
soCl = org .springframework [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to