如何修复错误“java.lang.ClassNotFoundException: sun.io.ByteToCharConverter"
我有一个在 WebSphere 7.0 上的项目.目前我将它带到 EAP 6.4.Java 版本是 1.6.
I have a project which was on WebSphere 7.0. Currently I am carrying it to EAP 6.4. Java version is 1.6.
DB2 是我使用的数据库.我之前在 websphere 中使用的驱动程序是在 jboss 的模块下设置的.数据库连接正常.但是在 Executequery 方法运行后我得到了错误
DB2 is the database I use. And the same driver that I used earlier in websphere is set under modules of jboss. Database connection is OK. But after Executequery method run I get the error
JBWEB000289: Servlet InitServlet threw load() exception:
java.lang.ClassNotFoundException: sun.io.ByteToCharConverter from
我用谷歌搜索了很多,我发现我尝试过的唯一解决方案是设置
I googled it a lot and the only solution I found that I tried is setting
-Ddb2.jcc.charsetDecoderEncoder=3
我在运行时的 VM 参数下设置了这个,jboss eap 6.4.
I set this under VM arguments of runtime, jboss eap 6.4.
我还尝试将此道具设置为我在数据库执行之前设置的属性.
I also tried to set this prop to properties that I set before database execution.
props.setProperty("db2.jcc.charsetDecoderEncoder", "3");
但问题仍然存在.
这是我收到的错误消息.它仍然存在.
This is the error message that I get. And it still exists.
JBWEB000289: Servlet InitServlet threw load() exception:
java.lang.ClassNotFoundException: sun.io.ByteToCharConverter from
这是完整的日志:
14:41:38,389 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cantekWeb]] (ServerService Thread Pool -- 62)
JBWEB000289: Servlet InitServlet threw load() exception: java.lang.ClassNotFoundException: sun.io.ByteToCharConverter from
[Module "deployment.cantek.ear.cantekWeb.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.6.Final-redhat-1]
at com.ibm.db2.jcc.b.r.a(r.java:157) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.c.d.a(d.java:986) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.c.fb.a(fb.java:1723) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.c.fb.a(fb.java:1651) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.c.fb.n(fb.java:570) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.c.fb.j(fb.java:257) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.c.fb.c(fb.java:57) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.c.s.c(s.java:42) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.c.wb.h(wb.java:169) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.b.id.p(id.java:1246) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.b.jd.a(jd.java:2275) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.b.jd.V(jd.java:505) [db2jcc-0.0.1.jar:]
at com.ibm.db2.jcc.b.jd.executeQuery(jd.java:488) [db2jcc-0.0.1.jar:]
at com.cimmy.service.data.Talep.loadSikayetKonular(Talep.java:138) [classes:]
at com.cimmy.service.servlet.InitServlet.sikayetKonulari(InitServlet.java:472) [classes:]
at com.cimmy.service.servlet.InitServlet.load(InitServlet.java:412) [classes:]
at com.cimmy.service.servlet.InitServlet.init(InitServlet.java:220) [classes:]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1194) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1100) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3593) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3802) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:61) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [rt.jar:1.8.0_211]
at java.util.concurrent.FutureTask.run(Unknown Source) [rt.jar:1.8.0_211]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_211]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_211]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_211]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
推荐答案
我做了以上所有的更改,这些更改也是需要的.但我面临的真正问题与 JBoss EAP 6.4 JRE 设置有关.它使用的是 1.8,并且由于此版本中没有需要的类,因此引发了此错误.所以我对该设置进行了更改,并使其看起来像 1.7.之后这个问题就解决了.
I made all the above changes which are also needed. But the real problem I faced was related to JBoss EAP 6.4 JRE settings. It was using 1.8 and since this version does not have needed classes in it it was throwing this error. So I made changes on that setting and made it to look at 1.7. After that this problem is solved.
感谢您的帮助.
相关文章