Help me on this exception , Occurs during calling wcf webservice
Log by netbeans
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy32.logon(Unknown Source)
at newtestclient.NewTestClient.main(NewTestClient.java:92)
Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.<clinit>(SOAPFaultBuilder.java:533)
... 5 more
Java Result: 1
The exception says :
java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext.
It's a common error that appears when there is a conflict between libraries and its dependencies. You should try to execute your code in a test project with only the libraries from JAX-RPC, and then add one by one the rest of your app libraries.
Also, you should check your server libraries to discard any kind of conflict for having the same library (or its dependencies) in your app and in your server with different versions.
Related
I've been trying to send an email using the JavaMail API and Gmail SMTP. I am using IntelliJ IDEA Community Edition 2020.3.3. After following this tutorial and using this code (the one about Gmail SMTP with TLS), I keep getting the same error:
1st link - error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataHandler
at mainPackage.JavaMailUtil.prepareMessage(JavaMailUtil.java:40)
at mainPackage.JavaMailUtil.sendMail(JavaMailUtil.java:28)
at mainPackage.JavaMail.main(JavaMail.java:5)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 3 more
2nd link - error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataHandler
at lukemaster06.emailPackage.SendEmailTLS.main(SendEmailTLS.java:30)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
Since I'm fairly new to Java programming, I don't understand what I'm doing wrong. Thank you in advance for the help.
To see the IntelliJ IDEA projects, visit this GitHub page. If anything does wrong with them, let me know. You can also email me for more discussion-based conversations: public.lukemaster06#gmail.com
Which version of Java are you using? It's possible that since the DataHandler comes from JavaBeans Activation Framework you may not have it, since the last version of Java that included it was Java 1.8.
If that's the case you need to include this library in your project:
https://mvnrepository.com/artifact/com.sun.activation/javax.activation/1.2.0
I have been trying to run the archetype example and another project I am trying to upgrade from 6.5 to 7.0.0, but I have failed to do so.
The archetype example runs ok on jetty and the project I was trying to upgrade runs ok both in jetty and was 8.5.5.7, but after changing the dependencies I keep getting the exception below and I am not quite sure if it is a problem with configuration (as everything worked ok with 6.5), with wicket 7.0.0 as the exception comes from inside wicket or from WAS8.5.5.7.
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [wicket-servlet] in application [blahblah]: javax.servlet.ServletException: java.lang.ClassCastException: com.ibm.ws.artifact.url.internal.WSJarURLStreamHandler$WSJarURLConnectionImpl cannot be cast to java.net.JarURLConnection
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:455)
at org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:271)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332)
at [internal classes]
Caused by: java.lang.ClassCastException: com.ibm.ws.artifact.url.internal.WSJarURLStreamHandler$WSJarURLConnectionImpl cannot be cast to java.net.JarURLConnection
at org.apache.wicket.Application.collectWicketProperties(Application.java:503)
at org.apache.wicket.Application.initializeComponents(Application.java:593)
at org.apache.wicket.Application.initApplication(Application.java:918)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:429)
... 4 more
[ERROR ] SRVE0315E: An exception occurred: java.lang.Throwable: javax.servlet.ServletException: java.lang.ClassCastException: com.ibm.ws.artifact.url.internal.WSJarURLStreamHandler$WSJarURLConnectionImpl cannot be cast to java.net.JarURLConnection
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4900)
at [internal classes]
Caused by: javax.servlet.ServletException: java.lang.ClassCastException: com.ibm.ws.artifact.url.internal.WSJarURLStreamHandler$WSJarURLConnectionImpl cannot be cast to java.net.JarURLConnection
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:455)
at org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:271)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332)
... 1 more
Caused by: java.lang.ClassCastException: com.ibm.ws.artifact.url.internal.WSJarURLStreamHandler$WSJarURLConnectionImpl cannot be cast to java.net.JarURLConnection
at org.apache.wicket.Application.collectWicketProperties(Application.java:503)
at org.apache.wicket.Application.initializeComponents(Application.java:593)
at org.apache.wicket.Application.initApplication(Application.java:918)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:429)
... 4 more
UPDATE------------ as of wicket 7.1.0 there isn't an issue anymore.
As mentioned in #klopfdreh answer there was a compatibility issue, I am accepting that answer, because I think the discussion in the comments may have helped the wicket team fix/pinpoint the issue in the 7.1.0 release.
It is only an assumption, but it appears that the problem seems to be close to this one:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430180
As of one comment, can you try to set the following options at your "jvm.options":
-Dcom.ibm.websphere.persistence.DisableJpaFormatUrlProtocol=true
To implement it without disable the "wsjar" protocol we need more input about the implementation of "WSJarURLConnectionImpl" - the only method called from the "JarURLConnection" is "getJarFile()", so the question here is: Does "WSJarURLConnectionImpl" also provide this method and returns it a JarFile? Then we may use reflections at this place.
I'm not familiar with stanford coreNLP. I want to use one of its classes Evalb. I've imported all packages (although many of them have errors). class Evalb doesn't have any error. when I run it I got this exception :
Exception in thread "main" java.lang.ExceptionInInitializerError
at edu.stanford.nlp.international.Language.<clinit>(Language.java:15)
at edu.stanford.nlp.parser.metrics.Evalb.usage(Evalb.java:136)
at edu.stanford.nlp.parser.metrics.Evalb.main(Evalb.java:163)
Caused by: java.lang.RuntimeException: Uncompilable source code - package java.util.function does not exist
at edu.stanford.nlp.parser.lexparser.AbstractTreebankParserParams.<clinit>(AbstractTreebankParserParams.java:13)
... 3 more
Java Result: 1
I have installed JDK 1.8
How can I fix this?
While running a groovy script I get this exception:
Caught: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
Caused by: java.lang.SecurityException: Prohibited package name: java.util.concurrent
I noticed a library in my classpath high-scale-lib-1.0.6.jar which has a class java.util.concurrent.ConcurrentHashMap.class in the library.
I need this library so what can I do to get groovy scripts running? I read something about whitelists for such cases.
Any ideas on how I could solve this issue ?
I am trying to run RestClient .From this code I deleted all Loggers related code.But I kept classpath for log4j same. Then run the application ,it gives following two exceptions
java.lang.NoClassDefFoundError: org/apache/log4j/Level
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
Please give reason for those exceptions.
Other jars that you use most likely will use log4j. Also, make sure you remove imports of log4j, not just the code that uses it.