English 中文(简体)
JBoss JNDI Binding Manager - maximum length of value?
原标题:

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?

最佳回答

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.

问题回答
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.





相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签