openimaj / openimaj

The OpenIMAJ source code repository
http://www.openimaj.org
Other
330 stars 116 forks source link

XmlPullParserException #198

Open x21L opened 4 years ago

x21L commented 4 years ago

Hi team,

I am always getting an org.xmlpull.v1.XmlPullParserException: resource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory make sure that parser implementing XmlPull API is available.

It happens if I want to instantiate a HaarCascadeDetector or a KLTHaarFaceTracker inside the beforeUpdate method of the VideoDisplayListener. The display is instantiated with a JComponent. The video stream itself works fine. Just the SandeepFaceDetector does work unfortunately, it does not suit my needs, I want to use the KLTHaarFaceTracker if it is possible...

jonhare commented 4 years ago

It looks like you don't have the dependencies of the object-detection library on your class path. I'd expect to see xpp3 and xmlpull:

[INFO] | - org.openimaj:object-detection:jar:1.4-SNAPSHOT:compile [INFO] | +- xpp3:xpp3_min:jar:1.1.4c:compile [INFO] | - xmlpull:xmlpull:jar:1.1.3.1:compile

x21L commented 4 years ago

Thank you very much for this fast reply. I added the object-detection library with Maven. Is there anything additional configuration I need to do?

jonhare commented 4 years ago

That should be all that’s needed. You can run mvn dependency:tree to see what dependencies are being pulled in transitively.

On 30 Jul 2020, at 13:39, Lukas notifications@github.com<mailto:notifications@github.com> wrote:

I added the object-detection library with Maven. Is there anything additional configuration I need to do?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenimaj%2Fopenimaj%2Fissues%2F198%23issuecomment-666339550&data=01%7C01%7Cjsh2%40ecs.soton.ac.uk%7C51652d06544f46e9637008d83485a5be%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=m20YgA%2BSMOaxrwBsY3AgRu5CcBh2XEVdFgiClPVsR5I%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAIWYV5ELIXNZAOMFN7COWLR6FSZHANCNFSM4PNSSALA&data=01%7C01%7Cjsh2%40ecs.soton.ac.uk%7C51652d06544f46e9637008d83485a5be%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=YAOAKlOS5NvAr%2FI0pbuC0NcoUS3M%2F4fyFeUIRv%2BKj%2FE%3D&reserved=0.

x21L commented 4 years ago

In the tree, I can see the jars you mentioned above. I think it is something related to JavaFX, since I am going to try to embed the JPanel in my FX application with SwingNode. The video stream is working fine, but as soon as I instantiate a HaarCascadeDetector in my video listener I get those strange exceptions.

I tried it in plain Swing, it worked fine there.

Thank you very much for your fast help

jonhare commented 4 years ago

how are you running the application - just from an IDE or from a fat jar or something else? The specific error says that a resource called /META-INF/services/org.xmlpull.v1.XmlPullParserFactory couldn't be found - I'd expect that one of the two dependency jars provides that, but maybe the usage of javafx does something funky to the class loader or the packaging breaks things...

x21L commented 4 years ago

I am running it from an IDE - IntelliJ CE 2020.2 to be exact. Yeah, it is really strange...

jonhare commented 4 years ago

Hmm, if possible I’d add a breakpoint on org.xmlpull.v1.XmlPullParserException and run it in the debugger to find where that error originates (one would assume as a result of a .getResource or .getResourceAsStream in a try-catch block) and then try to find out what the class loader is. The only thing that comes to mind is that the classloader being used by the javafx app is different to the swing app, and for some reason can’t find those files...

On 30 Jul 2020, at 21:46, Lukas notifications@github.com<mailto:notifications@github.com> wrote:

I am running it from an IDE - IntelliJ CE 2020.2 to be exact. Yeah, it is really strange...

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenimaj%2Fopenimaj%2Fissues%2F198%23issuecomment-666685062&data=01%7C01%7Cjsh2%40ecs.soton.ac.uk%7Cd053179904c54e4e382808d834c99b7b%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=0e0ihqNWdDFZqqK248BsftaktmWP1cO7PBV6zsfhR9o%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAIWYV5ZUQWO53PIUMFTM7LR6HLZRANCNFSM4PNSSALA&data=01%7C01%7Cjsh2%40ecs.soton.ac.uk%7Cd053179904c54e4e382808d834c99b7b%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=ytVO%2Fb1LlGdIOcVcMXlzI1CJhrJwa9U%2BWZbPKt8CTeE%3D&reserved=0.