[CONTROLLER-111] NullPointerException thrown by md-sal for routed RPCs Created: 10/Jan/14  Updated: 25/Jul/23  Resolved: 24/Jul/14

Status: Resolved
Project: controller
Component/s: mdsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Maros Marsalek Assignee: Tony Tkacik
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


External issue ID: 279

 Description   

Stack trace:
java.lang.NullPointerException
at org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator$3$1$1.process(RuntimeCodeGenerator.java:234)
at org.opendaylight.controller.sal.binding.codegen.util.JavassistUtils.implementMethodsFrom(JavassistUtils.java:111)
at org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator$3$1.process(RuntimeCodeGenerator.java:307)
at org.opendaylight.controller.sal.binding.codegen.util.JavassistUtils.createClass(JavassistUtils.java:129)
at org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator$3.call(RuntimeCodeGenerator.java:332)
at org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator$3.call(RuntimeCodeGenerator.java:191)
at org.opendaylight.yangtools.concepts.util.ClassLoaderUtils.withClassLoaderAndLock(ClassLoaderUtils.java:42)
at org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator.getRouterFor(RuntimeCodeGenerator.java:344)
at org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl.getRpcRouter(RpcProviderRegistryImpl.java:123)
at org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl.addRoutedRpcImplementation(RpcProviderRegistryImpl.java:62)
at org.opendaylight.controller.sal.binding.impl.OsgiProviderContext.addRoutedRpcImplementation(OsgiProviderContext.java:43)
at org.opendaylight.protocol.integration.pcep.PcepRpcServicesRoutingTest$7.onSessionInitiated(PcepRpcServicesRoutingTest.java:206)
at org.opendaylight.controller.sal.binding.impl.BindingAwareBrokerImpl.registerProvider(BindingAwareBrokerImpl.java:96)
at org.opendaylight.protocol.integration.pcep.PcepRpcServicesRoutingTest.testRoutedRpcTopologyTunnelPcepProgrammingService(PcepRpcServicesRoutingTest.java:214)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:67)
at org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:37)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.invokeViaJUnit(JUnitProbeInvoker.java:123)
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.findAndInvoke(JUnitProbeInvoker.java:96)
at org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.call(JUnitProbeInvoker.java:72)
at org.ops4j.pax.exam.nat.internal.NativeTestContainer.call(NativeTestContainer.java:108)
at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:109)
at org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:278)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:112)
at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

This exception only occurs if the definition of yang structures used for routing is located in other yang module than the rpcs.

Routing structures:

grouping topology-identifier {
leaf topology-identifier

{ ext:context-reference "topology-context"; type topology-ref; }

}

typedef topology-ref

{ type instance-identifier; }

identity topology-context

{ description "Identity used to mark topology context. Used for routed rpcs"; }

Rpc with routing structures:

rpc pcep-create-p2p-tunnel {
input

{ uses tp:topology-identifier; //... }

output

{ //... }

}

A draft in bgpcep project contains the whole code needed for reproduction (https://git.opendaylight.org/gerrit/#/c/4136/ patch set 2).

Reproduce by:
Rebuild the bgpcep project with mvn clean install.
Run test PcepRpcServicesRoutingTest in integration-tests module.
Test case testRoutedRpcTopologyTunnelPcepProgrammingService should fail.

Note1: If the routing structures are located in the same module as rpcs, the exception is not thrown and everything works as expected (As demonstrated by the two other test cases located in PcepRpcServicesRoutingTest )



 Comments   
Comment by Maros Marsalek [ 13/Jan/14 ]

After debugging, I was able to find the problem.

This error occurs only if the definition for yang routing structures is located in other bundle than the definition for yang rpcs. There is a problem with md-sal, which expects the org.opendaylight.yangtools.yang.binding.annotations.RoutingContext annotation to be on the classpath of "rpcs bundle".

For a workaround, add an Import-package dependency to the "rpcs bundle" bundle plugin:

<Import-Package>
org.opendaylight.yangtools.yang.binding,
org.opendaylight.yangtools.yang.binding.annotations,
...
</Import-Package>

Comment by Debolina Bandyopadhyay [ 24/Apr/14 ]

Is this issue fixed or is someone working on it?

Comment by Maros Marsalek [ 24/Apr/14 ]

Last time I checked with Tony Tkacik, it was not fixed, nor was anyone working on it.

Comment by Tony Tkacik [ 22/Jul/14 ]

https://git.opendaylight.org/gerrit/#/c/9221/

Generated at Wed Feb 07 19:52:13 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.