milg0 / onvif-java-lib

ONVIF (Open Network Video Interface Forum) is a community to standardize communication between IP-based security products (like cameras). I developed a Java library for the ONVIF spezification. It helps you with the basics (you don't need to learn SOAP e.g.) but you may need to learn a few basics about the ONVIF spezification. As far as I know, this is the first public Java project for the ONVIF spezification.
http://www.milgo.de/onvif/java-library
Apache License 2.0
215 stars 132 forks source link

Instructions for running in java 11+? #27

Closed Bhlowe closed 11 months ago

Bhlowe commented 2 years ago

Anyone have a solution for running this on java 11+ that has depreciated a lot of the soap and ee calls? Sure wish onvif was a json based protocol! I hate having things break due to a compile time class not found.

Currently getting:

javax.xml.ws.WebServiceException: org.apache.cxf.binding.soap.SoapFault: Problem writing SAAJ model to stream: Unable to create message factory for SOAP: Unable to create SAAJ meta-factory: Provider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
    at org.apache.cxf.jaxws.JaxWsClientProxy.mapException(JaxWsClientProxy.java:193)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
    at com.sun.proxy.$Proxy80.getCapabilities(Unknown Source)
    at de.onvif.soap.OnvifDevice.init(OnvifDevice.java:139)
    at de.onvif.soap.OnvifDevice.<init>(OnvifDevice.java:88)
    at de.onvif.soap.OnvifDevice.<init>(OnvifDevice.java:103)
    at com.nuspectra.siteproxy.cam.onvif.OnvifCommander.<init>(OnvifCommander.java:371)
ianrenton commented 11 months ago

Hi, I don't suppose you ever found a solution to this, did you? I am currently porting some software that uses this library from Java 8 to Java 17 and things are not working, wondering if I have the same issue as you.

ianrenton commented 11 months ago

In case anyone else discovers this issue for similar reasons, I added the following Maven dependencies based on this semi-related StackOverflow thread. That got it to work for me in Java 17, YMMV in other versions.

        <dependency>
            <groupId>com.sun.xml.messaging.saaj</groupId>
            <artifactId>saaj-impl</artifactId>
            <version>1.5.3</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.soap</groupId>
            <artifactId>saaj-api</artifactId>
            <version>1.3.5</version>
        </dependency>