[forge-users] Problem with unmarshalling resource with jaxb unmarshaller
Max Schwaab
max.schwaab at akquinet.de
Mon Mar 12 09:57:09 EDT 2012
Hey there,
we had a deeper look at the problem and it turns out that it was a
problem with the jaxb version.
Seems like the container provided a newer version than expected.
The Hibersap Framework is changed and a new 1.1.0 Beta released.
Thanks for your efforts anyway
I tagged a 1.0.0 Beta for the Hibersap plugin, basic functionality works
for me
Best regards
Max
Am 02.03.2012 17:34, schrieb Max Schwaab:
> No exceptions..
>
> In a way the unmarshalling is successful, but some content (session
> manager) is missing
>
> Am 02.03.2012 17:27, schrieb Lincoln Baxter, III:
>> Are you getting any exceptions?
>>
>> On Fri, Mar 2, 2012 at 11:22 AM, Max Schwaab <max.schwaab at akquinet.de
>> <mailto:max.schwaab at akquinet.de>> wrote:
>>
>> Hey there,
>>
>> I've got another tricky problem with my hibersap plugin
>>
>> I'm using the HibersapJaxbXmlParser to parse a hibersap.xml file.
>> What the parser does is the following:
>>
>> * creating a JAXB context [ jaxbContext = JAXBContext.newInstance(
>> HibersapConfig.class ); ]
>> * creating a JAXB unmarshaller [ unmarshaller =
>> jaxbContext.createUnmarshaller(); ]
>> * unmarshall the given resource stream [ unmarshalledObject =
>> unmarshaller.unmarshal( resourceStream ); ]
>>
>> The problem is:
>> It unmarshalles the file to the correct class, but some content
>> gets lost.
>>
>> The funny thing:
>> If I try this in a seperate test without forge, it works!
>> The test is part of the plugin and can be found at the github repo
>> (https://github.com/forge/plugin-hibersap)
>>
>> What I want it to do:
>> Unmarshall a hibersap.xml file and recognize the hibersap config
>> AND the
>> session manager in the config.
>> Within Forge it seems to recognize only the hibersap config and
>> not the
>> session manager.
>>
>> The hibersap.xml is something like this:
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>> <hibersap xmlns="http://hibersap.org/xml/ns/hibersap-config">
>> <session-manager name="SM001">
>> <context>org.hibersap.execution.jco.JCAContext</context>
>> .
>> .
>> .
>> </session-manager>
>> </hibersap>
>>
>> Here is the code from the HibersapJaxbXmlParser:
>>
>> public HibersapConfig parseResource( final InputStream
>> resourceStream,
>> final String resourceName )
>> throws HibersapParseException
>> {
>> Unmarshaller unmarshaller;
>> try
>> {
>> unmarshaller = jaxbContext.createUnmarshaller();
>> }
>> catch ( final JAXBException e )
>> {
>> throw new InternalHiberSapException( "Cannot create an
>> unmarshaller. ", e );
>> }
>>
>> Object unmarshalledObject;
>> try
>> {
>> unmarshalledObject = unmarshaller.unmarshal(
>> resourceStream );
>> }
>> catch ( final JAXBException e )
>> {
>> throw new HibersapParseException( "Cannot parse the
>> resource " + resourceName, e );
>> }
>> if ( unmarshalledObject == null )
>> {
>> throw new HibersapParseException( "Resource " +
>> resourceName + " is empty." );
>> }
>> if ( !( unmarshalledObject instanceof HibersapConfig ) )
>> {
>> throw new HibersapParseException( "Resource " +
>> resourceName
>> + " does not consist of a hibersap
>> specification. I
>> found a "
>> +
>> unmarshalledObject.getClass().getSimpleName() );
>> }
>> return ( HibersapConfig ) unmarshalledObject;
>> }
>>
>>
>> Thank you for your help and best regards
>>
>> Max
>>
>> _______________________________________________
>> forge-users mailing list
>> forge-users at lists.jboss.org <mailto:forge-users at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/forge-users
>>
>>
>>
>>
>> --
>> Lincoln Baxter, III
>> http://ocpsoft.com
>> http://scrumshark.com
>> "Keep it Simple"
>>
>>
>> _______________________________________________
>> forge-users mailing list
>> forge-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-users
>
>
> _______________________________________________
> forge-users mailing list
> forge-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-users/attachments/20120312/d7a2d4ef/attachment.html
More information about the forge-users
mailing list