Hmm ... it looks like the Spring classes for Castor XML don't work with code on SVN trunk currently, as we have made quites some changes. Not sure what to do about this, as we are approaching a release in a few weeks time, and it's too early to think about all (external) dependencies already.

Werner

Jozef Kubov wrote:
Hallo Werner!

I was tried to use svn snapshot, but with no results. Am I doing somthing worng? I chcked out trunk directoy and run ant task "jar.all"... Can you look my last post? There is all in.

what does you mean under SVN Head?

Thank for your help.

Schoenen Gruss!

Jozef

On 10/16/07, *Jozef Kubov* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hello!

    So I am using spring for loading castor mapping files.

    this is my spring config:
    
/-----------------------------------------------------------------------------------

    <bean id="MyResolver"
            class="com.ibs.rdc.util.castor.MyCastorResolverFactoryBean">
            <property name="mappingLocations">
                <list>
                    <value>
                        /WEB-INF/mapping/attachment- mapping.xml
                    </value>
                    <value>
                        /WEB-INF/mapping/attachmentOriginator-mapping.xml
                    </value>
..... many .... </list>
            </property>
        </bean>


        <bean id="DefaultUnmarshaller"
            class="org.castor.spring.xml.CastorUnmarshallerFactoryBean">
            <property name="resolver">
                <ref local="MyResolver" />
            </property>
        </bean>

        <bean id="DefaultMarshaller"
            class=" org.castor.spring.xml.CastorMarshallerFactoryBean">
            <property name="resolver">
                <ref local="MyResolver" />
            </property>
        </bean>

        <bean id="MarshallerHelper"
            class="com.ibs.rdc.util.castor.MarshallerHelper">
            <constructor-arg>
                <ref bean="DefaultMarshaller" />
            </constructor-arg>
        </bean>

        <bean id="MarshallerFacade"
            class="com.ibs.rdc.util.castor.MarshallerFacade">
            <property name="unmarshaller">
                <ref local="DefaultUnmarshaller" />
            </property>
            <property name="helper">
                <ref local="MarshallerHelper" />
            </property>
        </bean>
<bean id="MarshallerManager"
    class="com.ibs.rdc.util.castor.MarshallerManager">
            <property name="marshallerFacade" ref="MarshallerFacade" />
        </bean>

    
/--------------------------------------------------------------------------------------------
    this is class MyCastorResolverFactoryBean

    public class MyCastorResolverFactoryBean extends
    CastorResolverFactoryBean implements FactoryBean, InitializingBean {

        /**
         * Spring resource defining Castor properties
         */
        private Properties castorProperties;

        /**
         * Spring resource defining mapping file locations
         */
        private List mappingLocations;

        /**
         * XMlClassDescriptorResolver interface
         */
        private XMLClassDescriptorResolver resolver;

        /**
         * [EMAIL PROTECTED]
         *
         * @see
    org.springframework.beans.factory.InitializingBean#afterPropertiesSet ()
         */
        @Override
        public void afterPropertiesSet() throws Exception {
            this.resolver = (XMLClassDescriptorResolver)
    ClassDescriptorResolverFactory
                    .createClassDescriptorResolver( BindingType.XML);

            String mappingLocation = null;
            if (mappingLocations != null && mappingLocations.size() > 0) {
                Iterator iter = mappingLocations.iterator();
                try {
                    Mapping mapping = new Mapping();
                    while (iter.hasNext()) {
                        mappingLocation = ((String) iter.next()).trim();
                        RDCLogger.getLogger().info("Loading: " +
    mappingLocation);
                        mapping.loadMapping(new
    InputSource(SpringUtils.getInputStream(mappingLocation)));
                    }
                    Resource resource =
    SpringUtils.getWebApplicationContext().getResource("/");
                    URL url = resource.getURL();
                    String path = url.toExternalForm() +
    Constants.MAPPING_FILE_LOACTION_PREFIX;
                    mapping.setBaseURL(path);

                    MappingUnmarshaller mappingUnmarshaller = new
    MappingUnmarshaller();
                    MappingLoader loader =
    mappingUnmarshaller.getMappingLoader(mapping, BindingType.XML);

                    this.resolver.setMappingLoader(loader);
                } catch (MappingException e) {
                    RDCLogger.logException(e);
                    throw e;
                }
            }
        }

        /**
         * [EMAIL PROTECTED]
         *
         * @see org.springframework.beans.factory.FactoryBean#getObject()
         */
        public Object getObject() throws Exception {
            return this.resolver;
        }

        /**
         * [EMAIL PROTECTED]
         *
         * @see
    org.springframework.beans.factory.FactoryBean#getObjectType()
         */
        public Class getObjectType() {
            if (this.resolver == null) {
                return ClassDescriptorResolver.class;
            }

            return this.resolver.getClass();
        }

        /**
         * [EMAIL PROTECTED]
         *
         * @see org.springframework.beans.factory.FactoryBean#isSingleton()
         */
        public boolean isSingleton() {
            return true;
        }

        public void setCastorProperties(Properties castorProperties) {
            this.castorProperties = castorProperties;
        }

        /**
         * Sets a collection of mapping (file) locations.
         *
         * @param mappingLocations
         *            A collection of mapping (file) locations.
         */
        public void setMappingLocations(List mappingLocations) {
            this.mappingLocations = mappingLocations;
        }

    }
    //
    
------------------------------------------------------------------------------------


    when i am using last release castor 1.1.2.1 <http://1.1.2.1> all run
    good, but i become output with
    <hibernate-lazy-initializer>....</...> tag.

    I have tried to copy snapshot from svn, I have checked out a trunk
    directory and then run ant task " jar.all". Then i have taken castor
    1.1.2.1 <http://1.1.2.1> from "dist" directory and involved in my
    project instead last stable release.

    biut it does not work. i become this warning:

    14:12:12,356 INFO  [STDOUT] 14:12:12,356 [http-127.0.0.1-8080-2]
    WARN  castor.xml.XMLMappingLoader : Internal context or class
    descriptor resolver within are not valid

    and then an exception is thrown:

      org.springframework.beans.factory.BeanCreationException : Error
    creating bean with name 'MyResolver' defined in class path resource
    [castor-mapping.xml]: Invocation of init method failed; nested
    exception is java.lang.IllegalStateException: Internal context or
    class descriptor resolver within are not valid

    i have no idea.

    thanks for your help!



    On 10/16/07, *Ralf Joachim* < [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>> wrote:

        Hi Jozef,

        see my comments inline.

        Jozef Kubov schrieb:
        >  I have one more question...
        >
        >  If you look on the mapping files and output. For example the
        Language
        >  object has additional tags/attributtes after marshalling
        >  <hibernate-lazy-...></..>. But why object ProcessType has no such
        >  attribute? This object is hibernate pojo too.

        When Castor is not able to find a mapping for the class to
        marshal it
        uses introspection to find the properties to marshal. This
        causes Castor
        to also find methods of the proxy in addition to those of the
        proxied
        object. With SVN HEAD this additional properties should also
        disapear.

        >  I can't now exactly remember, but an the beginnig i have used only
        >  castor a i think there wasn't such problem with hibernate pojos
        >  marshalling... But later I make a decision to load mapping with
        >  castor-spring. Can be this a reason why i have such additional
        >  attributes in my output?
        >
        >  On the other side, I made changes in hibernate transaction
        handlig and
        >  lazy loading. so this can be reason too.

        Lazy loading is the point that makes hibernate use proxies.

        >  can you tell me pls when is next release of castor planned?
        >
        >  thaks!
        >
        >  jozef
        >
        >  On 10/15/07, *Jozef Kubov* <[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>
        >  <mailto: [EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>>> wrote:
        >
        >     Great! Thanks!
        >
        >     And when will be next release?
        >
        >
        >
        >
        >     On 10/15/07, *Werner Guttmann* < [EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>
        >     <mailto:[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>>> wrote:
        >
        >         This has been fixed already, and will be shipped with
        the next
        >         release.
        >         If you are intersted to get yourself acquainted with this,
        >         please feel
        >         free to look at the snapshot releases for 1.1.3.
        >
        >         Werner
        >
        >         Jozef Kubov wrote:
        >         >  Hello!
        >         >
        >         >  I have a following problem. I want to marshall
        hibernate pojo
        >         into xml.
        >         >
        >         >  this is my castor mapping files:
        >         >
        >         >  processType object
> > /----------------------------------------------------------
        >         >  <?xml version=" 1.0" encoding="UTF-8"?>
        >         >  <mapping>
        >         >
        >         >
        >         >     <class name="com.ibs.rdc.conf.bo.ProcessType"
        >         auto-complete="false">
        >         >         <description>Default mapping for class
        >         >  com.ibs.rdc.conf.bo.ProcessType </description>
        >         >         <map-to xml="processType"/>
        >         >          <field name="id" type="integer"
        required="false"
        >         direct="false"
        >         >  transient="false">
        >         >             <bind-xml name="id" node="element"
        reference="false"/>
        >         >         </field>
        >         >         <field name="isNonAutomatic" type="boolean"
        >         required="false"
        >         >             direct="false" transient="false">
        >         >             <bind-xml name="isNonAutomatic"
        node="element"
        >         >  reference="false"/>
        >         >         </field>
        >         >         <field name="tolerance" type="
        >         com.ibs.rdc.conf.bo.Tolerance"
        >         >             required="false" direct="false"
        transient="false">
        >         >             <bind-xml name="tolerance" node="element"
        >         reference="false"/>
        >         >         </field>
        >         >         <field name="processTypeId" type="string"
        required="false"
        >         >             direct="false" transient="false">
        >         >             <bind-xml name="processTypeId" node="element"
        >         >  reference="false"/>
        >         >         </field>
        >         >         <field name="description"
> > type="com.ibs.rdc.conf.bo.ProcessTypeDescription"
        >         >             required="false" direct="false"
        transient="false"
        >         >  collection="set">
        >         >             <bind-xml name="processTypeDescription"
        node="element"
        >         >                 location="processTypeDescriptionList"
        >         reference="false"/>
        >         >         </field>
        >         >         <field name="processServicesUri" type="string"
        >         required="false"
        >         >             direct="false" transient="false">
        >         >             <bind-xml name="processServicesUri"
        node="element"
        >         >  reference="false"/>
        >         >         </field>
        >         >         <field name="factoryCalendarId" type="string"
        >         required="false"
        >         >             direct="false" transient="false">
        >         >             <bind-xml name="factoryCalendarId"
        node="element"
        >         >  reference="false"/>
        >         >         </field>
        >         >         <field name="illicitProcessId" type="string"
        >         required="false"
        >         >             direct="false" transient="false">
        >         >             <bind-xml name="illicitProcessId"
        node="element"
        >         >  reference="false"/>
        >         >         </field>
        >         >     </class>
        >         >  </mapping>
        >         >
> ----------------------------------------------------------------------------------------------------------------------

        >
        >         >  procesTypeDescription:
        >         >
        >         >  <?xml version="1.0" encoding="UTF-8"?>
        >         >  <mapping>
        >         >
        >         >
        >         >     <class
        name="com.ibs.rdc.conf.bo.ProcessTypeDescription "
        >         >  auto-complete="true">
        >         >         <description>Default mapping for class
        >         >  com.ibs.rdc.conf.bo.ProcessTypeDescription</description>
        >         >         <map-to xml="processTypeDescription"/>
        >         >          <field name="id" type="integer"
        required="false"
        >         direct="false"
        >         >  transient="false">
        >         >             <bind-xml name="id" node="element"
        reference="false"/>
        >         >         </field>
        >         >         <field name="textline" type="string"
        required="false"
        >         >             direct="false" transient="false">
        >         >             <bind-xml name="textline" node="element"
        >         reference="false"/>
        >         >         </field>
        >         >         <!--
        >         >         -->
        >         >         <field name="language"
        type="com.ibs.rdc.conf.bo.Language"
        >         >             required="false" direct="false"
        transient="false">
        >         >             <bind-xml name="languages" node="element"
        >         reference="false"/>
        >         >         </field>
        >         >     </class>
        >         >  </mapping>
        >         >
> -----------------------------------------------------------------------------------------------------------------------------------
        >
        >         >  language object:
        >         >
        >         >  <?xml version="1.0" encoding="UTF-8"?>
        >         >  <mapping>
        >         >     <class name="com.ibs.rdc.conf.bo.Language "
        >         auto-complete="true">
        >         >         <description>
        >         >             Default mapping for class
        com.ibs.rdc.conf.bo.Language
        >         >         </description>
        >         >         <map-to xml="language" />
        >         >         <field name="languageKey" type="string"
        required="false"
        >         >             direct="false" transient="false">
        >         >             <bind-xml name="languageKey" node="element"
        >         >                 reference="false" />
        >         >         </field>
        >         >         <field name="id" type="integer" required="false"
        >         direct="false"
        >         >             transient="false">
        >         >             <bind-xml name="id" node="element"
        >         reference="false" />
        >         >         </field>
        >         >     </class>
        >         >  </mapping>
        >         >
> -------------------------------------------------------------------------------------------------------------------------------------

        >
        >         >
        >         >  So i try to marshall object processType. i awaits
        somthing
        >         like that:
        >         >
        >         >
        >         >         <processType>
        >         >             <isNonAutomatic>true</isNonAutomatic>
        >         >             <tolerance>
> > <isLaterRequested>true</isLaterRequested>
        >         >                         <toleratedDays>0</toleratedDays>
        >         >             </tolerance>
        >         >             <processTypeId>REQUESTLOAN</processTypeId>
        >         >             <processTypeDescriptionList>
        >         >                 <processTypeDescription>
        >         >                     <textline>loan request
        (market)</textline>
> > <languageKey>ENGLISH</languageKey>
        >         >                     </languages>
        >         >                 </processTypeDescription>
        >         >                 <processTypeDescription>
        >         >                     <textline>Krediterfassung im
        Markt</textline>
        >         >                     <languages>
> > <languageKey>DEUTSCH</languageKey> > > <language-key>DEUTSCH</language-key>
        >         >                     </languages>
        >         >                 </processTypeDescription>
        >         >             </processTypeDescriptionList>
> > <processServicesUri>local</processServicesUri>
        >         >             <factoryCalendarId></factoryCalendarId>
        >         >             <illicitProcessId></illicitProcessId>
        >         >         </processType>
        >         >
        >         >
        >         >  but i have become this:
        >         >
        >         >         <processType>
        >         >             <isNonAutomatic>true</isNonAutomatic>
        >         >             <tolerance
        >         >                 xmlns:xsi="
        >         http://www.w3.org/2001/XMLSchema-instance
        >         < http://www.w3.org/2001/XMLSchema-instance>"
        >         >                 is-later-requested="true"
        >         >  xsi:type="java:
        com.ibs.rdc.conf.bo.Tolerance_$$_javassist_17 ">
        >         >                 <hibernate-lazy-initializer
        unwrap="false"
        >         >                     uninitialized="false"
        >         >
> xsi:type="java:org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer">
        >         >
        >         >                     <implementation
        xsi:type="tolerance">
> > <isLaterRequested>true</isLaterRequested>
        >         >                         <toleratedDays>0</toleratedDays>
        >         >                     </implementation>
        >         >
        >         <entity-name>com.ibs.rdc.conf.bo.Tolerance</entity-name>
        >         >                 </hibernate-lazy-initializer>
        >         >                 <tolerated-days>0</tolerated-days>
        >         >             </tolerance>
        >         >             <processTypeId>REQUESTLOAN</processTypeId>
        >         >             <processTypeDescriptionList>
        >         >                 <processTypeDescription>
        >         >                     <textline>loan request
        (market)</textline>
        >         >                     <languages
        >         >
        >         >  xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance";
        >         >  xsi:type="java:
        com.ibs.rdc.conf.bo.Language_$$_javassist_11 ">
        >         >                         <hibernate-lazy-initializer
        unwrap="false"
        >         >                             uninitialized="false"
        >         >
> xsi:type="java:org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer
        >
        >         >  ">
        >         >                             <implementation
        xsi:type="language">
> > <languageKey>ENGLISH</languageKey>
        >         >                             </implementation>
        >         >
        >         >  <entity-name>com.ibs.rdc.conf.bo.Language</entity-name>
        >         >                         </hibernate-lazy-initializer>
> > <language-key>ENGLISH</language-key>
        >         >                     </languages>
        >         >                 </processTypeDescription>
        >         >                 <processTypeDescription>
        >         >                     <textline>Krediterfassung im
        Markt</textline>
        >         >                     <languages
        >         >
        >         >  xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance
        >         < http://www.w3.org/2001/XMLSchema-instance>"
        >         >  xsi:type="java:
        com.ibs.rdc.conf.bo.Language_$$_javassist_11 ">
        >         >                         <hibernate-lazy-initializer
        unwrap="false"
        >         >                             uninitialized="false"
        >         >
> xsi:type="java:org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer
        >
        >         >  ">
        >         >                             <implementation
        xsi:type="language">
> > <languageKey>DEUTSCH</languageKey>
        >         >                             </implementation>
        >         >
        >         >  <entity-name>com.ibs.rdc.conf.bo.Language</entity-name>
        >         >                         </hibernate-lazy-initializer>
> > <language-key>DEUTSCH</language-key>
        >         >                     </languages>
        >         >                 </processTypeDescription>
        >         >             </processTypeDescriptionList>
> > <processServicesUri>local</processServicesUri>
        >         >             <factoryCalendarId></factoryCalendarId>
        >         >             <illicitProcessId></illicitProcessId>
        >         >         </processType>
        >         >
        >         >
        >         >  there is some with hibernate proxies... and lazy
        loading. I
        >         have no idea
        >         >  how can fix it.
        >         >
        >         >  thanks for advice.
        >         >
        >         >  jozef
        >         >
        >         >
        >         >
        >
        >
> ---------------------------------------------------------------------
        >         To unsubscribe from this list please visit:
        >
        >             http://xircles.codehaus.org/manage_email
        >
        >
        >

        --

        Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
        Ralf Joachim
        Raiffeisenstraße 11
        72127 Kusterdingen
        Germany

        Tel.   +49 7071 3690 52
        Mobil: +49 173 9630135
        Fax    +49 7071 3690 98

        Internet: www.syscon.eu
        E-Mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

        Sitz der Gesellschaft: D-72127 Kusterdingen
        Registereintrag: Amtsgericht Stuttgart, HRB 382295
        Geschäftsleitung: Jens Joachim, Ralf Joachim

        ---------------------------------------------------------------------

        To unsubscribe from this list please visit:

            http://xircles.codehaus.org/manage_email
        <http://xircles.codehaus.org/manage_email>





---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to