Gert,

I have also tested this option but nothing changed :

Import-Package =
com.sun.jdi;resolution:=optional,com.sun.jdi.connect;resolution:=optional,com.sun.jdi.event;resolution:=optional,com.sun.jdi.request;resolution:=optional
,org.hibernate.proxy

Remark : in the hibernate bundle, the class javassist.util.proxy is well
imported

Regards,

Charles


Gert Vanthienen wrote:
> 
> Charles,
> 
> Just for testing purposes, to see if we're on the right track... could
> you add an explicit import for the org.hibernate.proxy package to your
> javassist bundle?
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/3/24 cmoulliard <[email protected]>:
>>
>> DynamicImport-Package does not change anything. The error is still there
>> even
>> If I add the following line to the MANIFEST file of javassist :
>>
>> DynamicImport-Package: org.hibernate.proxy.*,*
>>
>> Regards
>>
>>
>> cmoulliard wrote:
>>>
>>> No Gert.
>>>
>>> Here is what the bundle export :
>>>
>>> Javassist Java Programming Assistant (117)
>>> ------------------------------------------
>>> Specification-Title = Javassist
>>> Main-Class = javassist.CtClass
>>> Specification-Version = 3.9.0.GA
>>> Specification-Vendor = Shigeru Chiba, Tokyo Institute of Technology
>>> Export-Package =
>>> javassist;version="3.9.0.GA";uses:="javassist.bytecode,javassist.bytecode.annotation,javassist.compiler,javassist.compiler.ast,javassist.expr",javassist.
>>> bytecode;version="3.9.0.GA";uses:="javassist,javassist.bytecode.annotation",javassist.bytecode.analysis;version="3.9.0.GA";uses:="javassist,javassist.bytecode",javassist.
>>> bytecode.annotation;version="3.9.0.GA";uses:="javassist,javassist.bytecode",javassist.bytecode.stackmap;version="3.9.0.GA";uses:="javassist,javassist.bytecode",javassist.
>>> compiler;version="3.9.0.GA";uses:="javassist,javassist.bytecode,javassist.compiler.ast",javassist.compiler.ast;version="3.9.0.GA";uses:="javassist,javassist.compiler",jav
>>> assist.convert;version="3.9.0.GA";uses:="javassist,javassist.bytecode",javassist.expr;version="3.9.0.GA";uses:="javassist,javassist.bytecode,javassist.compiler,javassist.
>>> compiler.ast",javassist.runtime;version="3.9.0.GA",javassist.scopedpool;version="3.9.0.GA";uses:="javassist",javassist.tools;version="3.9.0.GA",javassist.tools.reflect;ve
>>> rsion="3.9.0.GA";uses:="javassist",javassist.tools.rmi;version="3.9.0.GA";uses:="javassist,javassist.tools.web",javassist.tools.web;version="3.9.0.GA";uses:="javassist",j
>>> avassist.util;version="3.9.0.GA";uses:="com.sun.jdi.connect,com.sun.jdi.event,com.sun.jdi.request",javassist.util.proxy;version="3.9.0.GA";uses:="javassist,javassist.byte
>>> code"
>>> Bundle-Classpath = .
>>> Bundle-Version = 3.9.0.GA
>>> Created-By = Shigeru Chiba, Tokyo Institute of Technology
>>> Bundle-ManifestVersion = 2
>>> Manifest-Version = 1.0
>>> Bundle-Vendor = SpringSource
>>> Bundle-Name = Javassist Java Programming Assistant
>>> Ant-Version = Apache Ant 1.7.0
>>> Import-Package =
>>> com.sun.jdi;resolution:=optional,com.sun.jdi.connect;resolution:=optional,com.sun.jdi.event;resolution:=optional,com.sun.jdi.request;resolution:=optional
>>>
>>> Bundle-SymbolicName = com.springsource.javassist
>>>
>>> I will modify the manifest in order to add Dynamic-Import : *
>>>
>>> Regards,
>>>
>>>
>>> Gert Vanthienen wrote:
>>>>
>>>> Charles,
>>>>
>>>> Do you have a Dynamic-Import or something in the Javassist bundle that
>>>> allow it to use the exported class?
>>>>
>>>> Regards,
>>>>
>>>> Gert Vanthienen
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>
>>>>
>>>>
>>>> 2009/3/24 cmoulliard <[email protected]>:
>>>>>
>>>>> Apparently "mappingDirectoryLocations" does not work when the
>>>>> configuration
>>>>> files are packages in a jar of a bundle separately.
>>>>>
>>>>> Nevertheless, mappingLocations works like this :
>>>>>
>>>>>                <property name="mappingLocations">
>>>>>                    <list>
>>>>>
>>>>> <value>classpath*:META-INF/org/apache/camel/example/reportincident/model/*.hbm.xml</value>
>>>>>                        </list>
>>>>>                </property>
>>>>>
>>>>> Unfortunalely, I have the following error now :
>>>>>
>>>>> Is it a bug in javassist (3.9.0.GA) who cannot load the
>>>>> org.hibernate.proxy.HibernateProxy class or a issue with felix
>>>>> classloading
>>>>> ?
>>>>>
>>>>> remark : org.apache.proxy package is well defined in my MANIFEST file
>>>>> (and
>>>>> of course expeorted by Hibernate 3.3.1.GA bundle)
>>>>>
>>>>> {code}
>>>>> Caused by: java.lang.RuntimeException: by
>>>>> java.lang.NoClassDefFoundError:
>>>>> org/hibernate/proxy/HibernateProxy
>>>>>        at
>>>>> javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:174)
>>>>>        at
>>>>> org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:162)
>>>>>        ... 58 more
>>>>> Caused by: javassist.CannotCompileException: by
>>>>> java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy
>>>>>        at
>>>>> javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:167)
>>>>>        at
>>>>> javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:170)
>>>>>        ... 59 more
>>>>> Caused by: java.lang.NoClassDefFoundError:
>>>>> org/hibernate/proxy/HibernateProxy
>>>>>        at java.lang.ClassLoader.defineClass1(Native Method)
>>>>>        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>>>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>        at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>        at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>        at
>>>>> javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:159)
>>>>>        ... 60 more
>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>> org.hibernate.proxy.HibernateProxy
>>>>>        at
>>>>> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:558)
>>>>>        at
>>>>> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
>>>>>        at
>>>>> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1427)
>>>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>>>>        at
>>>>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>>>> {code}
>>>>>
>>>>> cmoulliard wrote:
>>>>>>
>>>>>> Gert,
>>>>>>
>>>>>> Nobody from Spring-Hibernate has provided a feedback now. From my
>>>>>> point
>>>>>> of
>>>>>> view after digging the question since last friday, I'm convinced that
>>>>>> the
>>>>>> issue is not at all related to SMX4. I have created a ticket at
>>>>>> Spring
>>>>>> DM.
>>>>>>
>>>>>> I have been able to find a workaround using mappingResources instead
>>>>>> of
>>>>>> mappingLocations or mappingDirectoryLocations but this means that the
>>>>>> hbm.xml files (this is what spring team has done in their petclinic
>>>>>> example) must be put in the same bundle where the
>>>>>> org.springframework.orm.hibernate3.LocalSessionFactoryBean is
>>>>>> instantiated
>>>>>> :
>>>>>>
>>>>>>       <bean id="sessionFactory"
>>>>>> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>>>>>>
>>>>>>               <!-- Classloading does not work under OSGI -->
>>>>>>               <property name="mappingResources">
>>>>>>                       <list>
>>>>>>                               <value>Incident.hbm.xml</value>
>>>>>>                       </list>
>>>>>>               </property>
>>>>>>
>>>>>> For the moment, this is not blocking. So, I can continue to work and
>>>>>> I
>>>>>> have been able to integrate camel, cxf, spring and Hibernate (using
>>>>>> commons-dbcp and mysql) top of SMX4. I will start to write the second
>>>>>> of
>>>>>> my tutorial with the material that I have.
>>>>>>
>>>>>> Remark : You are right, the problem comes from a classloading issue
>>>>>> with
>>>>>> Hibernate or maybe between the name stored in the EntityPersister
>>>>>> object
>>>>>> (package name + class vs class name)
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Charles
>>>>>>
>>>>>>
>>>>>>
>>>>>> Gert Vanthienen wrote:
>>>>>>>
>>>>>>> Charles,
>>>>>>>
>>>>>>> Did you get an answer for this on the Spring-Hibernate forum or do
>>>>>>> you
>>>>>>> rather think it's more OSGi/ServiceMix Kernel related?
>>>>>>> From our angle, the most likely explanation would be a classloader
>>>>>>> mismatch or a missing import (probably dynamic-import) from the
>>>>>>> hibernate bundle to find the hbm files or link them to the correct
>>>>>>> class.  What imports/exports are you using?
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Gert Vanthienen
>>>>>>> ------------------------
>>>>>>> Open Source SOA: http://fusesource.com
>>>>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2009/3/20 cmoulliard <[email protected]>:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I don't if this is the good forum to post this issue. If this is
>>>>>>>> not
>>>>>>>> the
>>>>>>>> case, I will post my topic on spring-hibernate forum
>>>>>>>>
>>>>>>>> My issue is the following, Hibernate claims that entity Incident
>>>>>>>> does
>>>>>>>> not
>>>>>>>> exist.
>>>>>>>>
>>>>>>>> s...@root:osgi> org.hibernate.MappingException: Unknown entity:
>>>>>>>> org.apache.camel.example.reportincident.model.Incident
>>>>>>>>        at
>>>>>>>> org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
>>>>>>>>        at
>>>>>>>> org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1365)
>>>>>>>>        at
>>>>>>>> org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:203)
>>>>>>>>        at
>>>>>>>> org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:535)
>>>>>>>>        at
>>>>>>>> org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:103)
>>>>>>>>        at
>>>>>>>> org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
>>>>>>>>        at
>>>>>>>> org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534)
>>>>>>>>        at
>>>>>>>> org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526)
>>>>>>>>        at
>>>>>>>> org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:522)
>>>>>>>>        at
>>>>>>>> org.apache.camel.example.reportincident.dao.impl.IncidentDAOImpl.saveIncident(IncidentDAOImpl.java:101)
>>>>>>>>
>>>>>>>> This error occurs when Hibernate does not find or load the file
>>>>>>>> hbm.xml
>>>>>>>>
>>>>>>>> Here is my config  :
>>>>>>>>
>>>>>>>> As you can see I have used mappingLocations instead of
>>>>>>>> mappingResources
>>>>>>>> because they was an error during the load of the files with
>>>>>>>> mappingResources
>>>>>>>>
>>>>>>>>        <!--  Hibernate SessionFactory Definition -->
>>>>>>>>        <bean id="sessionFactory"
>>>>>>>> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>>>>>>>>
>>>>>>>>                <!-- Classloading does not work under OSGI -->
>>>>>>>>                <property name="mappingResources">
>>>>>>>>                        <list>
>>>>>>>>
>>>>>>>> <value>META-INF/org/apache/camel/example/reportincident/model/Incident.hbm.xml</value>
>>>>>>>>                        </list>
>>>>>>>>                </property>
>>>>>>>>
>>>>>>>>                <!-- see here
>>>>>>>>
>>>>>>>> http://www.carbonfive.com/community/archives/2007/05/using_classpath.html
>>>>>>>> and
>>>>>>>>                     http://jira.springframework.org/browse/SPR-3965
>>>>>>>>                     for more info about the classloading issue on
>>>>>>>> OSGI
>>>>>>>> -->
>>>>>>>>                <property name="mappingLocations">
>>>>>>>>                        <list>
>>>>>>>>
>>>>>>>> <value>classpath*:META-INF/org/apache/camel/example/reportincident/model/Incident.hbm.xml</value>
>>>>>>>>                        </list>
>>>>>>>>                </property>
>>>>>>>>
>>>>>>>>
>>>>>>>> Any idea ?
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> -----
>>>>>>>> Charles Moulliard
>>>>>>>> SOA Architect
>>>>>>>>
>>>>>>>> My Blog :  http://cmoulliard.blogspot.com/
>>>>>>>> http://cmoulliard.blogspot.com/
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/Issue-with-Hibernate-and-hbm.xml-files-%28SMX4%29-tp22623666p22623666.html
>>>>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -----
>>>>>>> ---
>>>>>>> Gert Vanthienen
>>>>>>> http://gertvanthienen.blogspot.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> -----
>>>>> Charles Moulliard
>>>>> SOA Architect
>>>>>
>>>>> My Blog :  http://cmoulliard.blogspot.com/
>>>>> http://cmoulliard.blogspot.com/
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Issue-with-Hibernate-and-hbm.xml-files-%28SMX4%29-tp22623666p22676649.html
>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>> -----
>>>> ---
>>>> Gert Vanthienen
>>>> http://gertvanthienen.blogspot.com
>>>>
>>>
>>>
>>
>>
>> -----
>> Charles Moulliard
>> SOA Architect
>>
>> My Blog :  http://cmoulliard.blogspot.com/
>> http://cmoulliard.blogspot.com/
>> --
>> View this message in context:
>> http://www.nabble.com/Issue-with-Hibernate-and-hbm.xml-files-%28SMX4%29-tp22623666p22677738.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 


-----
Charles Moulliard
SOA Architect

My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: 
http://www.nabble.com/Issue-with-Hibernate-and-hbm.xml-files-%28SMX4%29-tp22623666p22678184.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to