<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    No exceptions..<br>
    <br>
    In a way the unmarshalling is successful, but some content (session
    manager) is missing<br>
    <br>
    Am 02.03.2012 17:27, schrieb Lincoln Baxter, III:
    <blockquote
cite="mid:CAEp_U4EwsftF==ZXp-hoh1H+8c=keMKP_hv2cUJguc4GpboqkA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      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">&lt;<a moz-do-not-send="true"
            href="mailto:max.schwaab@akquinet.de">max.schwaab@akquinet.de</a>&gt;</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 moz-do-not-send="true"
            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>
          &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;<br>
          &lt;hibersap xmlns="<a moz-do-not-send="true"
            href="http://hibersap.org/xml/ns/hibersap-config"
            target="_blank">http://hibersap.org/xml/ns/hibersap-config</a>"&gt;<br>
          &lt;session-manager name="SM001"&gt;<br>
&lt;context&gt;org.hibersap.execution.jco.JCAContext&lt;/context&gt;<br>
          &nbsp; &nbsp; &nbsp; &nbsp; .<br>
          &nbsp; &nbsp; &nbsp; &nbsp; .<br>
          &nbsp; &nbsp; &nbsp; &nbsp; .<br>
          &lt;/session-manager&gt;<br>
          &lt;/hibersap&gt;<br>
          <br>
          Here is the code from the HibersapJaxbXmlParser:<br>
          <br>
          public HibersapConfig parseResource( final InputStream
          resourceStream,<br>
          final String resourceName )<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throws HibersapParseException<br>
          &nbsp; &nbsp; {<br>
          &nbsp; &nbsp; &nbsp; &nbsp; Unmarshaller unmarshaller;<br>
          &nbsp; &nbsp; &nbsp; &nbsp; try<br>
          &nbsp; &nbsp; &nbsp; &nbsp; {<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unmarshaller = jaxbContext.createUnmarshaller();<br>
          &nbsp; &nbsp; &nbsp; &nbsp; }<br>
          &nbsp; &nbsp; &nbsp; &nbsp; catch ( final JAXBException e )<br>
          &nbsp; &nbsp; &nbsp; &nbsp; {<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new InternalHiberSapException( "Cannot
          create an<br>
          unmarshaller. ", e );<br>
          &nbsp; &nbsp; &nbsp; &nbsp; }<br>
          <br>
          &nbsp; &nbsp; &nbsp; &nbsp; Object unmarshalledObject;<br>
          &nbsp; &nbsp; &nbsp; &nbsp; try<br>
          &nbsp; &nbsp; &nbsp; &nbsp; {<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unmarshalledObject = unmarshaller.unmarshal(
          resourceStream );<br>
          &nbsp; &nbsp; &nbsp; &nbsp; }<br>
          &nbsp; &nbsp; &nbsp; &nbsp; catch ( final JAXBException e )<br>
          &nbsp; &nbsp; &nbsp; &nbsp; {<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new HibersapParseException( "Cannot parse
          the<br>
          resource " + resourceName, e );<br>
          &nbsp; &nbsp; &nbsp; &nbsp; }<br>
          &nbsp; &nbsp; &nbsp; &nbsp; if ( unmarshalledObject == null )<br>
          &nbsp; &nbsp; &nbsp; &nbsp; {<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new HibersapParseException( "Resource " +<br>
          resourceName + " is empty." );<br>
          &nbsp; &nbsp; &nbsp; &nbsp; }<br>
          &nbsp; &nbsp; &nbsp; &nbsp; if ( !( unmarshalledObject instanceof HibersapConfig )
          )<br>
          &nbsp; &nbsp; &nbsp; &nbsp; {<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new HibersapParseException( "Resource " +
          resourceName<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + " does not consist of a hibersap
          specification. I<br>
          found a "<br>
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +
          unmarshalledObject.getClass().getSimpleName() );<br>
          &nbsp; &nbsp; &nbsp; &nbsp; }<br>
          &nbsp; &nbsp; &nbsp; &nbsp; return ( HibersapConfig ) unmarshalledObject;<br>
          &nbsp; &nbsp; }<br>
          <br>
          <br>
          Thank you for your help and best regards<br>
          <br>
          Max<br>
          <br>
          _______________________________________________<br>
          forge-users mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:forge-users@lists.jboss.org">forge-users@lists.jboss.org</a><br>
          <a moz-do-not-send="true"
            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 moz-do-not-send="true" href="http://ocpsoft.com">http://ocpsoft.com</a><br>
      <a moz-do-not-send="true" href="http://scrumshark.com">http://scrumshark.com</a><br>
      "Keep it Simple"<br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
forge-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:forge-users@lists.jboss.org">forge-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/forge-users">https://lists.jboss.org/mailman/listinfo/forge-users</a>
</pre>
    </blockquote>
  </body>
</html>