Problem with unmarshalling resource with jaxb unmarshaller
by Max Schwaab
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
12 years, 9 months
As7 Deploy command is failing for me...
by Anand S. Anandan
I am new Forge as well as Java and JBoss. When I execute the as7 deploy command I get the following error. I am assuming forge will download and install JBoss AS7 image. Or should I install JBoss AS7 before hand for this command to work. I appreciate any help. As well if you can point me to any documentation on this, I will appreciate it. Thank you.
[INFO] Executing goal deploy on server localhost (127.0.0.1) port 9999.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.683s
[INFO] Finished at: Sat Mar 03 10:27:49 CST 2012
[INFO] Final Memory: 25M/61M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.1.0.
CR1:deploy (default-cli) on project stest: Could not execute goal deploy on stes
t.war. Reason: java.net.ConnectException: JBAS012174: Could not connect to remot
e://localhost:9999. The connection failed: Connection refused: no further inform
ation -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
[stest] stest $
12 years, 9 months