Hello Werner,
Thanx..i'll do it...
Just one minor isse: there have been many posts recently about
Where the 0.9.5.6 can be downloaded...
I assume I have to go thru 'FTP access', correct?
Thanx and regards
marco
-----Original Message-----
From: Werner Guttmann [mailto:[EMAIL PROTECTED]
Sent: 09 November 2004 19:16
To: [EMAIL PROTECTED]
Subject: Re: [castor-user] classLoading problem with Castor 0.9.5.3?
Marco,
as far as I remember, there's been a problem reported for this 'feature'
shortly after the 0.9.5.3 release. If you're willing to consider using
the 0.9.6 release
candidate, I am 100% sure that this has been fixed.
Werner
On Tue, 9 Nov 2004 09:13:06 -0000, Marco Mistroni wrote:
>
>Hello all,
> I am experiencing ClassLoading problems with Castor 0.9.5.3.
>In my CastorPersistenceManager class, I am loading database.xml &
>Mapping.xml 'dynamically' with following code
>
> _mapping = new Mapping( getClass().getClassLoader() );
> _mapping.setLogWriter(new PrintWriter(System.out) );
> InputStream stream =
>this.getClass().getResourceAsStream(mapping);
> _mapping.loadMapping(new InputSource( stream ) );
> _jdo = new JDO();
> _jdo.setLogWriter(new PrintWriter(System.out));
> URL url =
>this.getClass().getClassLoader().getResource("/database.xml");
> _jdo.loadConfiguration(url.toString());
> _jdo.setDatabaseName( "test" );
>
>In this way, I don't have to specify the 'absolute' path of my mapping
>files..
>
>The values of mapping.xml and databae.xml is '/mapping.xml'
>
>Issue is, when I run my program with castor 0.9.5.2, everything gets
>loaded
>Without any problems..
>
>When I moved to castor 0.9.5.3, then it looks like castor is trying to
>find the file in my directory, instead of loading from classes
>
>Anyone can give me help, or suggestion on what can be wrong?
>
>Thanx in advance and regard
> marco
>
>
>
>
>-----Original Message-----
>From: Marco Mistroni [mailto:[EMAIL PROTECTED]
>Sent: 08 November 2004 21:40
>To: Marco Mistroni
>Subject: RE: [castor-user] SourceGenerator issue /2
>
>--- error in initializing
>org.exolab.castor.mapping.MappingException: Nested error:
>java.io.FileNotFoundEx
>ception: C:\Sw\Budget-Project\Backend\target\mapping.xml (The system
>cannot
>find
> the file specified)
>2004-11-08 21:38:41,187 ERROR com.myapp.castor.CastorFactory [main] -
>Error in
> initializing castor!
>
>java.lang.Exception: Error in initializing
>cpmgr!org.exolab.castor.mapping.Mappi
>ngException: Nested error: java.io.FileNotFoundException:
>C:\Sw\Budget-Project\B
>ackend\target\mapping.xml (The system cannot find the file specified)
> at
>com.myapp.castor.CastorPersistenceManager.init(CastorPersistenceManag
>er.java:88)
> at com.myapp.castor.CastorFactory.<init>(CastorFactory.java:26)
> at
>com.myapp.castor.CastorPersistenceManagerTest.setUp(CastorPersistence
>ManagerTest.java:69)
> at junit.framework.TestCase.runBare(TestCase.java:125)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUni
>tTestRunner.java:325)
> at
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JU
>nitTask.java:848)
> at
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitT
>ask.java:556)
> at
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitT
>ask.java:532)
> at org.apache.tools.ant.Task.perform(Task.java:341)
> at
>org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)
> at
>org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
> at
>org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
> at
>org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
> at
org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)
> at
>org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
> at
>org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
> at
>org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
> at
>com.werken.werkz.jelly.GoalTag$1.performAction(GoalTag.java:128)
> at com.werken.werkz.Goal.fire(Goal.java:639)
> at com.werken.werkz.Goal.attain(Goal.java:575)
> at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
> at com.werken.werkz.Goal.attain(Goal.java:573)
> at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
> at com.werken.werkz.Goal.attain(Goal.java:573)
> at
>com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
> at
>com.werken.werkz.jelly.AttainGoalTag.doTag(AttainGoalTag.java:134)
> at
>org.apache.maven.jelly.tags.werkz.LazyAttainGoalTag.doTag(LazyAttainG
>oalTag.java:107)
> at
>org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
> at
>org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
> at
>org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
> at
>com.werken.werkz.jelly.GoalTag$1.performAction(GoalTag.java:128)
> at com.werken.werkz.Goal.fire(Goal.java:639)
> at com.werken.werkz.Goal.attain(Goal.java:575)
> at
>org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:
>448)
> at
>org.apache.maven.MavenSession.attainGoals(MavenSession.java:360)
> at
>org.apache.maven.jelly.tags.maven.ReactorTag.doTag(ReactorTag.java:37
>8)
> at
>org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
> at
>org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
> at
>org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
> at
>com.werken.werkz.jelly.GoalTag$1.performAction(GoalTag.java:128)
> at com.werken.werkz.Goal.fire(Goal.java:639)
> at com.werken.werkz.Goal.attain(Goal.java:575)
> at
>org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:
>448)
> at
>org.apache.maven.MavenSession.attainGoals(MavenSession.java:348)
> at org.apache.maven.cli.App.doMain(App.java:543)
> at org.apache.maven.cli.App.main(App.java:1109)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>java:39)
> at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>sorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at com.werken.forehead.Forehead.run(Forehead.java:551)
> at com.werken.forehead.Forehead.main(Forehead.java:581)
>2004-11-08 21:38:41,187 DEBUG
>com.myapp.castor.CastorPersistenceManagerTest
>[ma
>in] - Exception in CastorEntryTest.setup()
>com.myapp.exceptions.PersistenceException: java.lang.Exception: Error
in
>initial
>izing cpmgr!org.exolab.castor.mapping.MappingException: Nested error:
>java.io.Fi
>leNotFoundException: C:\Sw\Budget-Project\Backend\target\mapping.xml
>(The
>system
> cannot find the file specified)
>2004-11-08 21:38:41,187 ERROR
>com.myapp.castor.CastorPersistenceManagerTest
>[ma
>in] - Exception in testQueryExpenseType
>java.lang.NullPointerException
> at
>com.myapp.castor.CastorPersistenceManagerTest.testQueryExpenseType(Ca
>storPersistenceManagerTest.java:165)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>java:39)
> at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>sorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
>
>-----Original Message-----
>From: Marco Mistroni [mailto:[EMAIL PROTECTED]
>Sent: 08 November 2004 11:48
>To: [EMAIL PROTECTED]
>Subject: FW: [castor-user] SourceGenerator issue /2
>
>
>
>
>-----Original Message-----
>From: Keith Visco [mailto:[EMAIL PROTECTED]
>Sent: 05 November 2004 21:05
>To: [EMAIL PROTECTED]
>Subject: Re: [castor-user] SourceGenerator issue /2
>
>
>
>Hi Marco,
>
>I think you can use something like:
>
>.
> <xsd:complexType>
> <xsd:sequence>
> <xsd:any minOccurs="0" maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:complexType>
>.
>
>--Keith
>
>
>Marco Mistroni wrote:
>> Hello,
>> Sorry to spam the list but I have sent a message last week about
>> one
>> Issue with SourceGenerator and didn't get any reply
>> I have to write a schema for an object that behaves like a java
>> Collection,
>> Meaning that It should contain 'Objects'
>>
>> Basically, I want (castor to generate) a class with following method
>>
>> public void addValue(Object object)
>>
>> from an XML schema
>>
>> problem is that there is no way to write a schema that says 'this
>> complexType should hold a collection of objects of type 'object'.
>> I have checked, I could use xsd:anyType or xsd:IDREF.. it's ok in
>> putting
>> Values into my class, but whenever I retrieve the object that I have
>> put, I get back a String representation.
>>
>> Any suggestions on how to overcome htat problem? Writing custom
Fields
>> Handler? Custom Types?
>>
>> Regards
>> Marco
>>
>> FOR THOSE WHO ARE PATIENT, HERE IS THE BACKGROUND
>>
>> I am using Castor together with Axis for marshalling/unmarshalling
>> objects.
>> My axis WS will use a 'PersistenceManager' class which is in charge
of
>> interacting with a database.
>> In case of a query, I am passing a set of parameters with which the
>> Query should be populated. Since I want to keep my code 'not
>dependent'
>> on the query or on the type of objects, I am passing to my
Persistence
>> manager an array of Objects. The PersistenceManager picks those
>objects
>> and populate the query. (there's an article in javaworld by ryan
>daigle
>> for stuff like that)
>> For using this code inside my webservice, I need Castor to create me
>an
>> object that behaves like a Collection, that holds Objects and not
>> specific types..
>> So far I haven't been able to get away with it.
>>
>>
>>
>>
>> -----Original Message-----
>> From: Werner Guttmann [mailto:[EMAIL PROTECTED]
>> Sent: 05 November 2004 09:29
>> To: [EMAIL PROTECTED]
>> Subject: Re: [castor-user] Re: Date Format jdo and xml
>>
>>
>> Charles,
>>
>> there's one more alternative that just crossed my mind. Let's assume
>you
>> have a property x of type String in a class named X, along the lines
>of
>>
>> class X {
>>
>> private String x;
>>
>> public void setX (String x) { ...}
>>
>> public String getX() { .. }
>>
>> }
>>
>> You could add two more methods
>>
>> public Date getXasDate () { .. }
>>
>> public void setX (Date x) { ... }
>>
>> and make Castor use the newly defined getter/setter by declaring
>> get-method and set-method attributes on the >field> element.
>>
>> Werner
>>
>> On Fri, 5 Nov 2004 09:18:18 GMT, Charles Abell wrote:
>>
>>
>>>Thanks Werner,
>>>I had read it, but assumed it referred to a date stored as characters
>>
>> in a database, to be converted to date in the object.
>>
>>>Anyway the example gives me :
>>>org.exolab.castor.mapping.MappingException: The SQL type d, is not
>>
>> supported in this release
>>
>>>Maybe it's easier to change the format using xsl.
>>>
>>>Charles
>>>
>>>
>>>>Charles,
>>>>
>>>>have you ever read about parameterized type conversion at
>>>>
>>>>http://castor.exolab.org/types.html#Parameterized-Type-Convertors
>>>>
>>>>This might be a possible solution for your case.
>>>>
>>>>Werner
>>>>
>>>>On Thu, 4 Nov 2004 12:49:17 GMT, Charles Abell wrote:
>>>>
>>>>
>>>>>Martin,
>>>>>
>>>>>Many thanks for the example, but regretfully not. I suspect the
>>>>>difference is my mapping has the extra line :
>>>>><sql name="QU_DATE" type="date" dirty="ignore" />
>>>>>
>>>>>Stack trace is below.
>>>>>
>>>>>Best regards
>>>>>
>>>>>Charles
>>>>>
>>>>>org.exolab.castor.mapping.MappingException: No convertor exists
>>>>>for converting type java.lang.String to type java.sql.Date
>>>>>
>>>>>at
>>>>>
>>
>> org.exolab.castor.jdo.engine.SQLTypes.getConvertor(SQLTypes.java:475)
>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.jdo.engine.JDOMappingLoader.getTypeInfo(JDOMappingLo
>>
>>>>>ader.java:223)
>>>>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc(Mapping
>>
>>>>>Loader.java:632)
>>>>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.jdo.engine.JDOMappingLoader.createFieldDesc(JDOMappi
>>
>>>>>ngLoader.java:246)
>>>>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(Mappin
>>
>>>>>gLoader.java:519)
>>>>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(Mappin
>>
>>>>>gLoader.java:343)
>>>>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(JDOMapp
>>
>>>>>ingLoader.java:147)
>>>>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoad
>>
>>>>>er.java:212)
>>>>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(JDOMappingLo
>>
>>>>>ader.java:295)
>>>>>
>>>>>at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:278)
>>>>>
>>>>>at
>>>>>
>>
>>
org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseReg
>>
>>>>>istry.java:289)
>>>>>
>>>>>at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:559)
>>>>
>>>>
>
>
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
> unsubscribe castor-user
>
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user