RestComm / gmlc

Restcomm Location Server
http://www.restcomm.com/
GNU Affero General Public License v3.0
17 stars 37 forks source link

MLP request failing due to JiBX error related to org.oma.protocols.mlp.svc_result.SvcResult #44

Closed angrygreenfrogs closed 8 years ago

angrygreenfrogs commented 8 years ago

Sending a basic MLP request to the running GMLC is producing an XML binding error from JiBX.

Send a test request via MLP XML POST:
vi mlpreq.txt
<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE svc_init SYSTEM "MLP_SVC_INIT_310.DTD">
 <svc_init xmlns="MLP_SVC_INIT_310.dtd">
   <hdr>
     <client>
       <id>USERNAME</id>
       <pwd>PASSWORD</pwd>
       <serviceid>SERVICEID</serviceid>
     </client>
   </hdr>
   <slir>
     <msids>
       <msid type="MSISDN">MSISDN OF TARGET</msid>
     </msids>
     <eqop>
        <resp_timer>15</resp_timer>
     </eqop>
   </slir>
 </svc_init>
curl -X POST -d @mlpreq.txt http://192.168.60.128:8080/mobicents
11:20:54,822 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1) Unable to access binding information for class org.oma.protocols.mlp.svc_result.SvcResult
Make sure the binding has been compiled
11:20:54,823 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1) java.lang.NoSuchFieldException: JiBX_bindingList
11:20:54,824 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at java.lang.Class.getDeclaredField(Class.java:1961)
11:20:54,825 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.jibx.runtime.BindingDirectory.getBindingList(BindingDirectory.java:68)
11:20:54,825 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:211)
11:20:54,826 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.mobicents.gmlc.slee.mlp.MLPResponse.generateSystemErrorXML(MLPResponse.java:313)
11:20:54,827 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.mobicents.gmlc.slee.mlp.MLPResponse.getSystemErrorResponseXML(MLPResponse.java:263)
11:20:54,827 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.mobicents.gmlc.slee.MobileCoreNetworkInterfaceSbb.handleLocationResponse(MobileCoreNetworkInterfaceSbb.java:546)
11:20:54,828 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.mobicents.gmlc.slee.MobileCoreNetworkInterfaceSbb.onPost(MobileCoreNetworkInterfaceSbb.java:385)
11:20:54,829 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:20:54,829 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
11:20:54,829 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:20:54,829 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at java.lang.reflect.Method.invoke(Method.java:606)
11:20:54,829 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.mobicents.slee.runtime.sbbentity.SbbEntityImpl.invokeEventHandler(SbbEntityImpl.java:479)
11:20:54,829 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.routeQueuedEvent(EventRoutingTaskImpl.java:379)
11:20:54,829 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.run(EventRoutingTaskImpl.java:126)
11:20:54,829 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at org.mobicents.slee.runtime.eventrouter.EventRouterExecutorImpl$EventRoutingTaskStatsCollector.run(EventRouterExecutorImpl.java:72)
11:20:54,831 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
11:20:54,831 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
11:20:54,831 ERROR [STDERR] (SLEE-EventRouterExecutor-2-thread-1)       at java.lang.Thread.run(Thread.java:745)
11:20:54,832 INFO  [MobileCoreNetworkInterfaceSbb] (SLEE-EventRouterExecutor-2-thread-1) Exception while marshalling XML response data: Unable to access binding information for class org.oma.protocols.mlp.svc_result.SvcResult
Make sure the binding has been compiled
11:20:54,833 INFO  [MobileCoreNetworkInterfaceSbb] (SLEE-EventRouterExecutor-2-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="1">SYSTEM FAILURE</result>
    <add_info>Internal IO or parsing error occurred</add_info>
  </slia>
</svc_result>
11:20:54,834 INFO  [MobileCoreNetworkInterfaceSbb] (SLEE-EventRouterExecutor-2-thread-1) HTTP Request received and response sent.
angrygreenfrogs commented 8 years ago

I think this is something to do with the recent pom/build changes, and something has happened to the jibx compile binding stage:

[INFO] --- jibx-maven-plugin:1.2.6:bind (compile-binding) @ sbbs ---
[INFO] Not running JiBX binding compiler (single-module mode) - no binding files
[INFO] 
angrygreenfrogs commented 8 years ago

Basically I found that there's a problem with the jibx-maven-plugin's "compile-binding" task. It was producing a "Should never be called with null root" error when doing the binding process.

I'm fairly certain at this point that the plugin itself has a bug which is not easily resolved without creating a fork of it and further diagnosing the issue.

The plugin is somewhat unmaintained as the most recent release was in Dec 2015.

I've put a work-around (perhaps a permanent one) by directly including a copy of the JiBX tools in tools/jibx, and just directly executing it via maven like this:

<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
    <execution>
        <id>JiBX Compile Bindings</id>
        <phase>process-classes</phase>
        <goals>
            <goal>exec</goal>
        </goals>
        <configuration>
            <executable>java</executable>
            <workingDirectory>${basedir}/target/classes</workingDirectory>
            <arguments>
                <argument>-cp</argument>
                <argument>.:${basedir}/../../../../tools/jibx/support.jar:${basedir}/../../../../tools/jibx/jibx-bind.jar</argument>
                <argument>org.jibx.binding.Compile</argument>
                <argument>${basedir}/target/generated-sources/binding.xml</argument>
            </arguments>
        </configuration>
    </execution>
</executions>
</plugin>
angrygreenfrogs commented 8 years ago

Resolved in https://github.com/RestComm/gmlc/commit/1e7379ee5431987bea029833cba4c096beb08e91

I'm on the fence about this fix, but the system was unusable at present, so I wanted to put a work-around in place. The downside is that I've directly included the JiBX jar files in tools/jibx, which I would have preferred to avoid, but it was the most direct way to resolve the issue.

I added another issue to discuss a longer-term solution here: https://github.com/RestComm/gmlc/issues/48

jaimecasero commented 8 years ago

@angrygreenfrogs I noticed you were not matching any binding file. But my conf matches 1...

--- jibx-maven-plugin:1.2.6:bind (JiBX Compile Bindings) @ sbbs --- Running JiBX binding compiler (single-module mode) on 1 binding file(s)

Did you have a copy of the plugin conf you were using?