Hi,

  Any Castor users here? I'd like to ask an offtopic(?) question about using
Castor in a JBoss environment..

  My current task is to feed Cocoon with XML data coming from EJBs, all that
running in JBoss. I thought it'd be easy to use Castor on my CMP entity
beans, therefore having an xml representation of them, which can be passed
in a string to Cocoon and render it to any appropriate form. I'm not sure if
my concept is right, or I can do that..

I've tried implementing it this way from a session bean (PersonAgentBean),
on PersonBean (I've used the usual naming concept: Person and PersonHome for
the interfaces, and PersonBean for the bean itself):
 
Person[] person = findAllPerson();
StringWriter xmlsw = new StringWriter();
try {
    Marshaller marshaller = new Marshaller(xmlsw);
    marshaller.marshal(person[0], xmlsw);
    xmlsw.close();
} catch (Exception e) {}
return xmlsw.toString();


Now deploying this into JBoss, and running an example client to call this
function on my session bean, to get the entity bean in a String, I get a
fewhundred kilobytes of JBoss logs, something like that (I'm trying to show
the interesting parts only):

[PersonBean] Activated bean PersonBean with id = 0
[PersonBean] TRANSACTION ROLLBACK EXCEPTION:id may not be null; nested
exception is: java.lang.Error: id may not be null

..

[PersonBean]    at $Proxy33.getEJBObject(Unknown Source)
[PersonBean]    at java.lang.reflect.Method.invoke(Native Method)
[PersonBean]    at
org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(FieldHandlerImpl.java:372)
[PersonBean]    at
org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:945)[PersonBean]
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:980)

..*repeat this _last_line_ a fewhundred times*..

[PersonBean]    at
org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:538)[PersonBean]
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:458)[PersonBean]
at org.dyn.PersonAgentBean.toXMLAllPerson(PersonAgentBean.java:67)


I feel stuck. I'm not sure even if I can use Castor to get my entity bean
transformed to XML, as 'Person' is an interface actually, not a class.. If
the problem mainly relies here, then how should I use Castor the correct way
to transform my EJB data to an XML string?

Thanks much in advance,
Regards

Christopher
-- 
.Digital.Yearning.for.Networked.Assassination.and.Xenocide

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to