从jsp而不是从Java类调用错误方法

时间:2018-06-21 09:10:16

标签: java mysql jsp jdbc

在我的jsp文件中使用以下代码,我尝试调用java方法并提供输出

Crashed: Thread
0  base.apk                       0xcee52642 (Missing)
1  base.apk                       0xcee5ab31 (Missing)
2  base.apk                       0xcee56e01 (Missing)
3  base.apk                       0xcee57eab (Missing)
4  base.apk                       0xcee3d305 (Missing)
5  libc.so                        0xf59c3a9b (Missing)
6  libc.so                        0xf5a1b406 (Missing)
7  libc.so                        0xf5a0b1cf (Missing)
8  libc.so                        0xf59fcaef (Missing)
9  base.apk                       0xcee477b7 (Missing)
10 base.apk                       0xcee4907f (Missing)
11 base.apk                       0xcee5ab3d (Missing)
12 base.apk                       0xcee56f43 (Missing)
13 base.apk                       0xcee5aaff (Missing)
14 libandroid_runtime.so          0xf42179e4 (Missing)
15 (Missing)                      0x12dfbe1e (Missing)
16 system@framework@boot.oat      0x746ba1cb (Missing)
17 (Missing)                      0x707670de (Missing)
18 (Missing)                      0x7019f11e (Missing)
19 (Missing)                      0x12dfbe1e (Missing)
20 (Missing)                      0x13329a9e (Missing)
21 system@framework@boot.oat      0x746bc661 (Missing)
22 (Missing)                      0x7076792a (Missing)
23 (Missing)                      0x7020cafe (Missing)
24 (Missing)                      0x7059a21a (Missing)
25 (Missing)                      0x12e3a7fe (Missing)
26 (Missing)                      0x13329a9e (Missing)
27 (Missing)                      0x12dfbe1e (Missing)
28 (Missing)                      0x13288926 (Missing)
29 (Missing)                      0x12e3a7fe (Missing)
30 system@framework@boot.oat      0x7465d88d (Missing)
31 (Missing)                      0x7059b04e (Missing)
32 (Missing)                      0x130bebfe (Missing)
33 (Missing)                      0x705a103a (Missing)
34 (Missing)                      0x12e3a3fe (Missing)
35 system@framework@boot.oat      0x746a23d5 (Missing)
36 (Missing)                      0x705a103a (Missing)
37 (Missing)                      0x131631c6 (Missing)
38 system@framework@boot.oat      0x74638d41 (Missing)
39 libc.so                        0xf59f7027 (Missing)
40 (Missing)                      0x13154bee (Missing)
41 (Missing)                      0x12d0d04e (Missing)
42 (Missing)                      0x130bebfe (Missing)
43 libc.so                        0xf5a04331 (Missing)
44 (Missing)                      0x12d0d04e (Missing)
45 (Missing)                      0x70598ae6 (Missing)
46 system@framework@boot.oat      0x746614ef (Missing)
47 (Missing)                      0x7059c686 (Missing)
48 (Missing)                      0x13288926 (Missing)
49 (Missing)                      0x12e3a7fe (Missing)
50 system@framework@boot.oat      0x746605f3 (Missing)
51 (Missing)                      0x7059c07a (Missing)
52 (Missing)                      0x12e3a3fe (Missing)
53 (Missing)                      0x12e3a7fe (Missing)
54 (Missing)                      0x13288926 (Missing)
55 (Missing)                      0x130bebfe (Missing)
56 (Missing)                      0x12e3a3fe (Missing)
57 (Missing)                      0x12e3a7fe (Missing)
58 system@framework@boot.oat      0x74660393 (Missing)
59 (Missing)                      0x7059c00e (Missing)
60 (Missing)                      0x70585b62 (Missing)
61 (Missing)                      0x12e3a7fe (Missing)
62 system@framework@boot.oat      0x746601fb (Missing)
63 (Missing)                      0x7059bfa2 (Missing)

不幸的是,我收到以下错误消息:

  

java.lang.ClassNotFoundException:com.mysql.jdbc.Driver

在同一项目中,我创建了文件Main.java并调用了效果很好的相同方法:

<%@page import="lostmusicadmin.Jobs"%>
<% Jobs j = new Jobs(); String a = j.getDBTime(); %> <%=a%> //reject2

我的Jobs.java

public static void main(String[] args) {
        Jobs j = new Jobs();
        System.out.println(j.getDBTime()); //2018-06-21 11:08:23.0
}

构建路径中没有缺少类

编辑: 解决方案是将CLASS从Tomcat添加到文件夹LIB

1 个答案:

答案 0 :(得分:0)

将mysql-jdbc.jar放置在项目的/ WEB-INF / lib目录中。