ClassNotFoundException on maven Dependency
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
ClassNotFoundException on maven Dependency
Hello!
I added the "com.google.code.gson" dependency to use in my java code in a framework.
But when the method is called I am getting "ClassNotFoundException" error.
Is it necessary to do some configuration in the POM for the dependency to be recognized?
Error:
Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at ro.sync.basic.classloader.LateDelegationClassLoader.loadClass(LateDelegationClassLoader.java:192)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
I added the "com.google.code.gson" dependency to use in my java code in a framework.
But when the method is called I am getting "ClassNotFoundException" error.
Is it necessary to do some configuration in the POM for the dependency to be recognized?
Error:
Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at ro.sync.basic.classloader.LateDelegationClassLoader.loadClass(LateDelegationClassLoader.java:192)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: ClassNotFoundException on maven Dependency
Post by cristi_talau »
Hello,
Adding the dependency in Maven makes it available to your code at compile time.
To have it available also at runtime, you need to configure the classpath of your framework in the Document Type Configuration dialog box: https://www.oxygenxml.com/doc/versions/ ... ialog.html .
Best,
Cristian
Adding the dependency in Maven makes it available to your code at compile time.
To have it available also at runtime, you need to configure the classpath of your framework in the Document Type Configuration dialog box: https://www.oxygenxml.com/doc/versions/ ... ialog.html .
Best,
Cristian
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Re: ClassNotFoundException on maven Dependency
I had already made this association.
The part of the codes that use the Oxygen libraries is working.
But the external dependency is not being loaded.
The part of the codes that use the Oxygen libraries is working.
But the external dependency is not being loaded.
image.png
You do not have the required permissions to view the files attached to this post.
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: ClassNotFoundException on maven Dependency
Post by cristi_talau »
Hello,
As far as I can see you have only the JAR with the classes you wrote and a resources folder. You should also include JARs that are Maven dependencies, such as the gson library.
Best,
Cristian
As far as I can see you have only the JAR with the classes you wrote and a resources folder. You should also include JARs that are Maven dependencies, such as the gson library.
Best,
Cristian
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service