I am using Java jre 1.8 on SUSE linux and i am getting exception on sun/security/tools/keytool/CertAndKeyGen class . I have build my code with JDK 1.8 with maven argument
<compilerArgument>-XDignore.symbol.file<compilerArgument>
for sun/security/tools/keytool/ on java 8 . Build was successful . After deploying it on jboss , i am getting the error with java.lang.NoClassDefFoundError . This is the complete stack trace :
JBWEB000309: type JBWEB000066: Exception report
JBWEB000068: message Handler processing failed; nested exception is java.lang.NoClassDefFoundError: sun/security/tools/keytool/CertAndKeyGen
JBWEB000069: description JBWEB000145: The server encountered an internal error that prevented it from fulfilling this request.
JBWEB000070: exception
java.lang.NoClassDefFoundError: sun/security/tools/keytool/CertAndKeyGen
com.sample.test.security.certificate.OracleJDKCertificateHelper.resetCertificate(OracleJDKCertificateHelper.java:68)
com.sample.test.service.singleton.CertificateService.resetCertificate(CertificateService.java:229)
com.sample.test.service.singleton.CertificateService.resetCertificate(CertificateService.java:219)
com.sample.test.service.singleton.LicenseService.postSaveOrUpdate(LicenseService.java:138)
com.sample.test.service.singleton.LicenseService.postSaveOrUpdate(LicenseService.java:54)
com.sample.test.service.singleton.SingletonServiceImpl.saveOrUpdate(SingletonServiceImpl.java:102)
com.sample.test.web.controllers.singleton.BaseSingletonController$2.doInSyncMode(BaseSingletonController.java:110)
com.sample.test.web.controllers.singleton.BaseSingletonController.doIfNotAsyncAction(BaseSingletonController.java:143)
com.sample.test.web.controllers.singleton.BaseSingletonController.processSubmit(BaseSingletonController.java:103)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
I have extracted rt.jar from SUSE Jre1.8 . I can see that rt.jar\sun\security\tools\keytool\CertAndKeyGen.class is existing in it . Then why i am getting java.lang.NoClassDefFoundError ?
Any help or suggestions ?
Related
I am using eclipse photon and i am getting error 500, i have got some solution but not for my specific problem,that is-
java.lang.NoClassDefFoundError: java/sql/Driver
i dont understand how to remove java/sql/Driver type of error.
Here is my Error-
HTTP Status 500 – Internal Server Error
Type Exception Report
Message Servlet execution threw an exception
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.lang.NoClassDefFoundError: java/sql/Driver
java.base/java.lang.ClassLoader.findBootstrapClass(Native Method)
java.base/java.lang.ClassLoader.findBootstrapClassOrNull(Unknown Source)
java.base/java.lang.System$2.findBootstrapClassOrNull(Unknown Source)
java.base/jdk.internal.loader.ClassLoaders$BootClassLoader.loadClassOrNull(Unknown Source)
java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
java.base/java.lang.ClassLoader.loadClass(Unknown Source)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1247)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
java.base/java.lang.Class.forName0(Native Method)
java.base/java.lang.Class.forName(Unknown Source)
com.login.LoginCDao.getLoginC(LoginCDao.java:12)
com.login.GetLogin.doGet(GetLogin.java:23)
`javax.servlet.http.HttpServlet.service(HttpServlet.java:634`)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/9.0.13
Make sure you have driver jar set in classpath properly. For instance mysql-connector in case you are using mysql.
In case of oracle, Download the appropriate ojdbc6.jar JDBC driver file for your database version here
HTTP Status 500 - Internal Server Error
exception
javax.servlet.ServletException: java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
root cause
java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.0 logs.
Try to add the jar-library with the missing driver-class to the glassfish-runtime.
This is a duplicate to:
java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Exception occurring. Why?
I am having the following error when starting up the tomcat server 7 in Eclipse Mars, but the same tomcat server reconfigured in Eclipse Luna is started fine.
org.apache.catalina.startup.Bootstrap initClassLoaders SEVERE: Class loader creation threw exception java.io.IOException: Invalid argument at
java.io.WinNTFileSystem.canonicalize0(Native Method) at
java.io.WinNTFileSystem.canonicalize(Unknown Source) at
java.io.File.getCanonicalPath(Unknown Source) at
java.io.File.getCanonicalFile(Unknown Source) at
org.apache.catalina.startup.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:173) at
org.apache.catalina.startup.Bootstrap.createClassLoader(Bootstrap.java:139) at
org.apache.catalina.startup.Bootstrap.initClassLoaders(Bootstrap.java:80) at
org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:199) at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
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.
I am trying to implement recoemmender code in java dynamic web application using direct approach. i can compile the code but when i run the application on server i am getting following error:
type
Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: org/apache/mahout/cf/taste/model/DataModel
com.demoMahout.HelperRecommender.getUserBasedRecommendation(HelperRecommender.java:96)
com.demoMahout.HelperRecommender.doPost(HelperRecommender.java:53)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: org.apache.mahout.cf.taste.model.DataModel
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
com.demoMahout.HelperRecommender.getUserBasedRecommendation(HelperRecommender.java:96)
com.demoMahout.HelperRecommender.doPost(HelperRecommender.java:53)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
How can i resolve this issue?
It means just what it says: you don't have the Mahout classes included in your web app! put the JAR files in WEB-INF/lib as you need to do with any other library a web app needs.