Hi,

I believe the infinite loop indicates that your schema have circular import/include, you need figure it out and remove the circular.

Also I can't understand how your patch works here.

//Added by abdo----start
if(inlineList.contains(schemaLocation))continue;
else
inlineList.add( schemaLocation );
//Added by abdo----end

Is the inlineList used somewhere else but you forget to mention?

If you wanna append a patch, create a jira ticket and append a diff patch is easy for review and apply.

Freeman
On 2012-7-7, at 上午3:18, abdo wrote:

Thanks Freeman for the quick response. Actually, that was the first action that I did: to increase the allocated memory. However this did not fix my
issue. So I did take a look at the source code in
servicemix-cxf-bc-2011.02-sources: org.apache.servicemix.cxfbc.SchemaUtil
The code was going in an infinite loop in this function:

private void inlineTransformer(String key, Element inlineSchema, Element
outerSchema, boolean isInclude) {
       NodeList nl = null;
       if (isInclude) {
           nl = outerSchema.getElementsByTagNameNS(
                   "http://www.w3.org/2001/XMLSchema";, "include");
       } else {
           nl = outerSchema.getElementsByTagNameNS(
                   "http://www.w3.org/2001/XMLSchema";, "import");
       }

//Comment by Abdo: this loop can go infinite!!!!
       for (int j = 0; j < nl.getLength(); j++) {

           String schemaLocation =
((Element)nl.item(j)).getAttribute("schemaLocation");

//Added by abdo----start
if(inlineList.contains(schemaLocation))continue;
else
inlineList.add( schemaLocation );
//Added by abdo----end


if (schemaLocation != null && getXsdFileName(schemaLocation,
"/").
                   equals(getXsdFileName(key, "/"))) {

               outerSchema.removeChild(nl.item(j));


               for (int i = 0; i <
inlineSchema.getChildNodes().getLength(); i++) {
                   outerSchema.appendChild(
                           outerSchema.getOwnerDocument().importNode(
                               inlineSchema.getChildNodes().item(i),
true));
               }
               outerSchema.setPrefix("xs");
               outerSchema.setAttribute("xmlns:xs",
"http://www.w3.org/2001/XMLSchema";);
           }
       }
   }

Even this patch fixed my issue for now, I don't think its the best solution.
let me know what you think.

Thanks.
Abdo.



--
View this message in context: 
http://servicemix.396122.n5.nabble.com/cxfbc-java-lang-OutOfMemoryError-Java-heap-space-tp5713838p5713856.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042










Reply via email to