Linkage error:Loader Constraint violation: previously initiated loading for a different type with name "org/w3c/dom/Type Info" - grails-2.0

I am using java1.6,grails 2.0. I want to process Docx documents.For this i have added jars poi-ooxml-3.5-FINAL.jar,ooxml-schemas-1.1.jar.
But in code line this.document = new XWPFDocument(buffInputStream);
i got below error
Class java.lang.ClassNotFoundException
Message org.apache.xmlbeans.XmlOptions
I am trying to add jars either xmlbeans-2.5.0.jar or xbean-2.1.0.jar.
I am getting below error
| Error Fatal error during compilation
org.apache.tools.ant.BuildException: java .lang.LinkageError: loader
constraint violation: loader (instance of bootloader)
previously initiated loading for a different type with name "org/w3c/dom/Type Info" (Use --stacktrace to see the full trace)
If i verify my Jre System Library, rt.jar contains this TypeInfo class. how
to solve this problem? Please advice. Thank you.
Hi,
I have tried removing library and used jarscan to search this class. But i didn't find any where. Please help out to figure out how else i can find where is this class and how to resolve this

This happened to me with the JMX MBeanServer class. Groovy was loading one of them with its classloader and so was the JVM.
In your case it sounds like the TypeInfo class exists in rt.jar just fine, but another class loader loads it from that jar (or another jar) again.
Running the JRE with "-verbose:class" showed that double load behavior. Then I moved the offending jar out of my classpath and it worked just fine with the one loaded by Groovy.
I would recommend moving rt.jar out of your classpath, or if you need other classes inside of rt.jar try unjaring and rejaring it without the Type class. That way the classloaders will be forced to use the ones in xmlbeans-2.5.0.jar or xbean-2.1.0.jar.

Related

No main manifest attribute, Netbeans

I have the following problem when trying to launch a .jar file of my program in cmd: no main manifest attribute, in path/filename.jar
I tried to add the Main-Class to the MANIFEST.MF file, but then it says Error: Could not find or load main class.
In NetBeans I have set the Main Class at Properties->Run->Main Class to the one, which holds the function main(String[] args) in my case "com.nxp.vda_with_gui_1.version.App". I have also added VM Options for the JavaFX modules like the following:
--module-path C:\NetbeansJavaFX --add-modules javafx.controls,javafx.base,javafx.fxml,javafx.graphics,javafx.media
In NetBeans I can build and launch up my program without any errors, but when I try to "Run File" (Shift + F6) a different error will be put out:
Error: JavaFX runtime components are missing, and are required to run this application Command execution failed.
Any tips how to solve it?
Below you can find a picture of my file/package structure and some other information, maybe it helps finding a solution quicker:
file/package structure
JDK version: 16
JavaFX version: 18.0.2
OS: Windows

Unable to run unit tests in corda 4

I was running my unit test in corda 4from intellij but getting this error.
Error opening zip file or JAR manifest missing : lib/quasar.jar-Dco.paralleluniverse.fibers.verifyInstrumentation
Error occurred during initialization of VMagent library failed to init: instrument
think the path is probably wrong and it cant find the quasar.jar. Also there should be a space between quasar.jar and -dco.parallel.... Try use an absolute path instead.
It happened to me also found that is was the wrong path of [lib/quasar.jar] on the what did was point it to the main project path and it worked.
The full path to the jar in my IDE run config in this image.

Karaf: Missing Constraint in bundle

I am trying to wrap dnsjava as a bundle in Karaf. When I try to start the bundle I get a "Missing Constraint" error. I looked in the dnsjava code and found that the only place android is referenced is in a Class.forName. So I am wondering what causes this problem and how can I get around it. I am pretty certain that the class is not referenced in the code anywhere.
Here is the exception:
opendaylight-user#root>bundle:start 288
Error executing command: Error executing command on bundles:
Unable to execute command on bundle 288: The bundle "dnsjava_2.1.8 [288]" could not be resolved. Reason: Missing Constraint: Import-Package: android.os; version="0.0.0"
I believe I found the answer. There is an Import in the MANIFEST.MF that requires android.os.

Error in Groovy installation

I have install Groovy 2.1.1 in my unix box. While executing groovysh getting the below error.
Exception in thread "main" java.lang.NoClassDefFoundError: error:
Caused by: java.lang.ClassNotFoundException: error:
at java.net.URLClassLoader.findClass(URLClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:346)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
Could not find the main class: error:. Program will exit.
What could be the possible root cause for this error...???
Somewhere, you try to use the class error: (and yes, Groovy thinks that the colon is part of the class name), either in the script you execute (i.e. there must be new error: somewhere) or you wrote something like groovysh error: or you import error: (maybe indirectly)
Since you are using IBM J9, according to the Grails FAQ, the J9 need an argument to work well with Groovy, otherwise you may get a NoClassDefFound error:
Add -Xverify:none to JVM arguments
Download Groovy Binary From http://groovy.codehaus.org/Download
Download zip: Binary Release
Extract Local Disk say D;\GROOVY\ groovy-2.3.9
It contains the Folder Structure
D:.
├───bin
├───conf
├───embeddable
├───indy
├───lib
└───META-INF
Go to Control Panel\User Accounts\User Accounts  Change My Environment Variables
Set/new GROOVY_HOME = D:\GROOVY\groovy-2.3.9 (don’t put : semicolon)
Set PATH = C:\Program Files\Java\jdk1.8.0_25\bin;%GROOVY_HOME%\bin;
Add groovy-all.jar to CLASSPATH
D:\ GROOVY\ \groovy-2.3.9\embeddable\groovy-all-2.3.9.jar;.
Close and Open Command and Say –groovy
For console -groovyConsole

Crawler4j - Getting exception java.lang.NoSuchMethodError

I am trying to setup crawler4j via eclipse(juno).
When I run it, I am getting the below exception(even though the program keeps running without logging anything):
"Exception in thread "main" java.lang.NoSuchMethodError:
com.sleepycat.je.EnvironmentConfig.setAllowCreate(Z)Lcom/sleepycat/je/EnvironmentConfig;
at
edu.uci.ics.crawler4j.crawler.CrawlController.(CrawlController.java:90)
at
packCrawler.BasicCrawlController.main(BasicCrawlController.java:81)"
error?. I am also getting the same error. When I clicked on
(CrawlController.java:90)"
I could see that there is no source attached for CrawlController in crawler4j-3.4.jar. So I can't make out whether there is method "setAllowCreate" or not.
There is similar post at : NoSuchMethodError in crawler4j CrawelController class
But it does not exactly say how the problem got fixed. Does anybody have any suggestion?
Thanks very much for your time.
Neha
Look at the new crawler4j github: https://github.com/yasserg/crawler4j
Use the maven dependency system and all of your trouble will be gone!:
<dependency>
<groupId>edu.uci.ics</groupId>
<artifactId>crawler4j</artifactId>
<version>4.2</version>
</dependency>
You will get the latest version (now on github instead of google code)
Using an Dependency Management Tool such as Maven, you will automatically escape all classpath hell...

Resources