com.inductiveautomation.xopc.driver.api.configuration.DriverType

Hello,
I’m trying to convert a legacy Driver from v7.9 to v8 and im getting the following Java error after installing the driver in Ignition v8 Gateway.

I realize that the class “com.inductiveautomation.xopc.driver.api.configuration.DriverType” cannot be loaded due to the changes made with the newer version however I don’t know how to get around this without rewriting my entire driver. i’m hoping there’s a 1:1 class that i can remap to but i’m sure its not that easy.

I’ve hunted trough the new programming guide supplied for v8 but haven’t had any luck yet.
Any help would be greatly appreciated!!

com.inductiveautomation.ignition.common.modules.ModuleLoadException: Unable to load hook class “”.
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2299)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.load(ModuleManagerImpl.java:1994)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.startupModule(ModuleManagerImpl.java:1164)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$2.call(ModuleManagerImpl.java:733)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.executeModuleOperation(ModuleManagerImpl.java:905)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.installModuleInternal(ModuleManagerImpl.java:695)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$InstallCommand.execute(ModuleManagerImpl.java:1851)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$Receiver.receiveCall(ModuleManagerImpl.java:1801)
at com.inductiveautomation.ignition.gateway.redundancy.QueueableMessageReceiver.receiveCall(QueueableMessageReceiver.java:47)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl.dispatchMessage(RedundancyManagerImpl.java:813)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl$ExecuteTask.run(RedundancyManagerImpl.java:849)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:518)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/inductiveautomation/xopc/driver/api/configuration/DriverType
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at driver.GatewayHook.(GatewayHook.java:22)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.base/java.lang.Class.newInstance(Unknown Source)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2279)
… 17 more
Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.xopc.driver.api.configuration.DriverType
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
… 34 more

8.0.2 (b2019060511)
Azul Systems, Inc. 11.0.3

That DriverType class does exist in v8. However, the OPC/UA server module name changed from xopc to com.inductiveautomation.opcua. Make sure you’ve made that adjustment in your build, or your module won’t be pulled into the classloader that has access to DriverType and all the other stuff you will need.

However, you are going to have a significant rewrite. All of the classes under com.inductiveautomation.opcua.* in v7.9 are gone. Most have replacements under org.eclipse.milo.opcua.stack.* or org.eclipse.milo.opcua.sdk.* in v8.0. There are semantic changes, too.

@Kevin.Herron, do you have a porting guide? I recall some suffering when doing this for my Ethernet/IP driver.

DriverType still exists and is defined at that location.

My guess is that your module isn’t being loaded underneath the OPC UA module’s ClassLoader any more because the module id changed from “xopc” to “com.inductiveautomation.opcua” but your module.xml is still referencing “xopc” as its dependency.

edit: lol, I just realized you already said this @pturmel. I didn’t read your post close enough :slight_smile:

As far as porting goes, there’s definitely some work that needs to be done. You can still use your existing driver written against the Driver interface because of the adapter/bridge I wrote, but as @pturmel mentioned there’s a lot of OPC UA related imports that need updating.

Get your module compiling against the 8.0 SDK APIs, start deleting broken imports, and let your IDE help you start importing the new classes. Post here when you have questions.

Fantastic! That worked.
OK, now after successfully loading the module into my gateway i am not able to see the driver in the driver list when adding a new device. Could this be a class mismatch issue as well?

Check to see if the module is faulted and if there’s a bunch of errors in your gateway logs or not.

The module is not faulted and there are no errors in the gateway log.

Guess you just need to start debugging/troubleshooting then. Maybe add some logging to your module hook and ensure that getDriverTypes() is being called for starters.

@Blynch How did you solve that problem?
I got a similar problem, the Looger said “Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.xopc.driver.api.DriverContext”. I know that DriverContext are in “com.inductiveautomation.opcua:opc-ua-gateway-api” package now. But my Intellij ide still recommend “com.inductiveautomation.xopc.driver.api.DriverContext”.

Thank you for your time!

Hi @Kevin.Herron

I am trying to import driver related classes in Ignition8.1.

I have added opc-ua-gateway-api-9.1.13.jar jar in my dependencies libs/.
But my IDE is only recognizing com.inductiveautomation.xopc.driver.api classes instead of com.inductiveautomation.opcua.

I am able to generate a signed modl file (with imports as com.inductiveautomation.xopc.driver.api.) but when installed on Ignition server driver state is Faulted with below error

Error loading hook classes
com.inductiveautomation.ignition.common.modules.ModuleLoadException: Unable to load hook class "com.amazon.rme.castalia.GwHook" for module "com.amazon.rme.castalia".
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2363)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.load(ModuleManagerImpl.java:2036)
at java.base/java.lang.Thread.run(Unknown Source)

> Caused by: java.lang.NoClassDefFoundError: com/inductiveautomation/xopc/driver/common/AbstractDriverModuleHook

1Q. Can you please provide complete class for one Driver API (eg : AbstractDriverModuleHook)

2Q. Can you please elaborate more on how to pull xopc driver APIs in v8.1.

Why don’t you start by looking at the device example and seeing what dependencies it uses vs the ones you use: ignition-sdk-examples/pom.xml at master · inductiveautomation/ignition-sdk-examples · GitHub

You should also make sure your driver module declares its dependency on the OPC UA module: ignition-sdk-examples/pom.xml at ddf234b4a900f28835bf16a350faf265e39f93df · inductiveautomation/ignition-sdk-examples · GitHub