tags:

views:

310

answers:

2

I'm using the technique described here to register string values on the JNDI tree via an XML file deployed to JBoss.

This is working fine for my system constants (URLs and the like). However I am also trying to register the contents of a file which has been encoded to a Base64 string. The file is fairly large (about 400k), so the resulting string is very long.

When I try to deploy the XML file to JBoss, I get the following error:

DEPLOYMENTS IN ERROR:
  Deployment "vfsfile:/usr/local/jboss-5.1.0.GA/server/default/deploy/customers-service.xml" is in error due to the following reason(s): org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.

Is this likely to be because I am exceeding the maximum allowable length for the string value and hence it is only reading it to a certain point?

A: 
org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.

If the XML document itself is for certain valid, then this problem look like a buffer overflow or an incorrect interpretation of the content length which caused a shortened line without an end-tag being returned. This is likely a bug in the SAX parser in question. Which one are you using? I would recommend Xerces in its latest version.

BalusC
+1  A: 

According to documentation of the JNDI Binding Manager, the unmarshalling is actually peformed by the JBossXB (JBoss XML Binding) framework:

The JNDI binding manager service allows you to quickly bind objects into JNDI for use by application code. The MBean class for the binding service is org.jboss.naming.JNDIBindingServiceMgr. It has a single attribute, BindingsConfig, which accepts an XML document that conforms to the jndi-binding-service_1_0.xsd schema. The content of the BindingsConfig attribute is unmarshalled using the JBossXB framework.

But the documentation doesn't mention any limitation regarding the BindingsConfig or the JBossXB framework. And to be honest, I don't really get why there would be such a low limit (the size is pretty decent for a JDNI object but well, we are far from Java limits for a String).

So, if your are sure that your file is well formed and valid (and you should confirm that programmatically outside of JBoss), maybe you could proceed to some dichotomous testing: try with the 1/2 of the string size, then 3/4, etc. But this won't really solve your issue, it will just help the community, especially if you log something in JBoss Jira. And maybe you'll get more helpful hints there. This is what I would do.

Pascal Thivent