gmlc icon indicating copy to clipboard operation
gmlc copied to clipboard

MLP DTD files should not be copied to the server bin directory if we can avoid it

Open angrygreenfrogs opened this issue 8 years ago • 1 comments

This is in reference to https://github.com/RestComm/gmlc/issues/12, where a fix was applied to copy in some missing DTD files that the GMLC was looking for.

The error originally occurred during unmarshalling of the incoming MLP XML request, like this:

16:29:51,912 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1) Error parsing document (line 1, col 40)
16:29:51,913 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1) com.ctc.wstx.exc.WstxParsingException: (was java.io.FileNotFoundException) /home/eross/RestComm/jboss-5.1.0.GA/bin/MLP_SVC_INIT_310.DTD
 at [row,col {unknown-source}]: [1,88]
16:29:51,913 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:630)
16:29:51,914 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:461)
16:29:51,915 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at com.ctc.wstx.sr.ValidatingStreamReader.findDtdExtSubset(ValidatingStreamReader.java:475)
16:29:51,916 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at com.ctc.wstx.sr.ValidatingStreamReader.finishDTD(ValidatingStreamReader.java:358)
16:29:51,917 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at com.ctc.wstx.sr.BasicStreamReader.skipToken(BasicStreamReader.java:3349)
16:29:51,918 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1988)
16:29:51,919 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
16:29:51,919 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.jibx.runtime.impl.StAXReaderWrapper.next(StAXReaderWrapper.java:293)
16:29:51,919 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.jibx.runtime.impl.UnmarshallingContext.toStart(UnmarshallingContext.java:446)
16:29:51,920 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2750)
16:29:51,920 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2900)
16:29:51,920 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.mobicents.gmlc.slee.mlp.MLPRequest.parseRequest(MLPRequest.java:47)
16:29:51,920 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.mobicents.gmlc.slee.MobileCoreNetworkInterfaceSbb.onPost(MobileCoreNetworkInterfaceSbb.java:375)
16:29:51,920 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:29:51,920 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
16:29:51,921 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
16:29:51,921 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at java.lang.reflect.Method.invoke(Method.java:606)
16:29:51,921 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.mobicents.slee.runtime.sbbentity.SbbEntityImpl.invokeEventHandler(SbbEntityImpl.java:479)
16:29:51,921 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.routeQueuedEvent(EventRoutingTaskImpl.java:379)
16:29:51,922 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.run(EventRoutingTaskImpl.java:126)
16:29:51,923 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at org.mobicents.slee.runtime.eventrouter.EventRouterExecutorImpl$EventRoutingTaskStatsCollector.run(EventRouterExecutorImpl.java:72)
16:29:51,923 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
16:29:51,923 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
16:29:51,924 ERROR [STDERR] (SLEE-EventRouterExecutor-5-thread-1)       at java.lang.Thread.run(Thread.java:745)
16:29:51,924 INFO  [MobileCoreNetworkInterfaceSbb] (SLEE-EventRouterExecutor-5-thread-1) Exception while unmarshalling XML request data: Error parsing document (line 1, col 40)
16:29:51,925 INFO  [MobileCoreNetworkInterfaceSbb] (SLEE-EventRouterExecutor-5-thread-1) Generated response XML: <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svc_result SYSTEM "MLP_SVC_RESULT_310.DTD">
<svc_result xmlns="MLP_SVC_RESULT_310.dtd" ver="3.1.0">
    <slia ver="3.1.0">
        <result resid="105">FORMAT ERROR</result>
        <add_info>System Failure: Invalid XML received: Error parsing document (line 1, col 40)</add_info>
    </slia>
</svc_result>
16:29:51,932 INFO  [MobileCoreNetworkInterfaceSbb] (SLEE-EventRouterExecutor-5-thread-1) HTTP Request received and response sent.

The fix was to add the missing DTD files and copy them in to the jboss bin directory like this in build.xml

        <echo>Copy MLP DTD files</echo>
        <copy todir="${release.dir}/jboss-5.1.0.GA/bin" failonerror="true">
            <fileset dir="${restcomm.gmlc.dir}/core/bootstrap/src/main/config/dtd">
                    <include name="**" />
            </fileset>
        </copy>

This seems like an inefficient solution, so although it works for right now, we should eventually try to find a better way.

angrygreenfrogs avatar Jul 11 '16 06:07 angrygreenfrogs

There's a related issue with external DTD files perhaps attempting to be loaded, which we should avoid for security and efficiency reasons.

I've seen mention of a setting like this: unmarshaller.setProperty(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD, false);

angrygreenfrogs avatar Jul 11 '16 06:07 angrygreenfrogs