Are you getting any exceptions?<br><br><div class="gmail_quote">On Fri, Mar 2, 2012 at 11:22 AM, Max Schwaab <span dir="ltr"><<a href="mailto:max.schwaab@akquinet.de">max.schwaab@akquinet.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey there,<br>
<br>
I've got another tricky problem with my hibersap plugin<br>
<br>
I'm using the HibersapJaxbXmlParser to parse a hibersap.xml file.<br>
What the parser does is the following:<br>
<br>
* creating a JAXB context [ jaxbContext = JAXBContext.newInstance(<br>
HibersapConfig.class ); ]<br>
* creating a JAXB unmarshaller [ unmarshaller =<br>
jaxbContext.createUnmarshaller(); ]<br>
* unmarshall the given resource stream [ unmarshalledObject =<br>
unmarshaller.unmarshal( resourceStream ); ]<br>
<br>
The problem is:<br>
It unmarshalles the file to the correct class, but some content gets lost.<br>
<br>
The funny thing:<br>
If I try this in a seperate test without forge, it works!<br>
The test is part of the plugin and can be found at the github repo<br>
(<a href="https://github.com/forge/plugin-hibersap" target="_blank">https://github.com/forge/plugin-hibersap</a>)<br>
<br>
What I want it to do:<br>
Unmarshall a hibersap.xml file and recognize the hibersap config AND the<br>
session manager in the config.<br>
Within Forge it seems to recognize only the hibersap config and not the<br>
session manager.<br>
<br>
The hibersap.xml is something like this:<br>
<br>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><br>
<hibersap xmlns="<a href="http://hibersap.org/xml/ns/hibersap-config" target="_blank">http://hibersap.org/xml/ns/hibersap-config</a>"><br>
<session-manager name="SM001"><br>
<context>org.hibersap.execution.jco.JCAContext</context><br>
.<br>
.<br>
.<br>
</session-manager><br>
</hibersap><br>
<br>
Here is the code from the HibersapJaxbXmlParser:<br>
<br>
public HibersapConfig parseResource( final InputStream resourceStream,<br>
final String resourceName )<br>
throws HibersapParseException<br>
{<br>
Unmarshaller unmarshaller;<br>
try<br>
{<br>
unmarshaller = jaxbContext.createUnmarshaller();<br>
}<br>
catch ( final JAXBException e )<br>
{<br>
throw new InternalHiberSapException( "Cannot create an<br>
unmarshaller. ", e );<br>
}<br>
<br>
Object unmarshalledObject;<br>
try<br>
{<br>
unmarshalledObject = unmarshaller.unmarshal( resourceStream );<br>
}<br>
catch ( final JAXBException e )<br>
{<br>
throw new HibersapParseException( "Cannot parse the<br>
resource " + resourceName, e );<br>
}<br>
if ( unmarshalledObject == null )<br>
{<br>
throw new HibersapParseException( "Resource " +<br>
resourceName + " is empty." );<br>
}<br>
if ( !( unmarshalledObject instanceof HibersapConfig ) )<br>
{<br>
throw new HibersapParseException( "Resource " + resourceName<br>
+ " does not consist of a hibersap specification. I<br>
found a "<br>
+ unmarshalledObject.getClass().getSimpleName() );<br>
}<br>
return ( HibersapConfig ) unmarshalledObject;<br>
}<br>
<br>
<br>
Thank you for your help and best regards<br>
<br>
Max<br>
<br>
_______________________________________________<br>
forge-users mailing list<br>
<a href="mailto:forge-users@lists.jboss.org">forge-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-users" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Lincoln Baxter, III<br><a href="http://ocpsoft.com">http://ocpsoft.com</a><br><a href="http://scrumshark.com">http://scrumshark.com</a><br>"Keep it Simple"<br>