質問編集履歴
1
ソースとエラー文を修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,8 +9,6 @@
|
|
9
9
|
#症状
|
10
10
|
|
11
11
|
Java servletでLuceneを利用しようとしたところ、実行時に以下のメッセージとともに500エラーが返ってきました。
|
12
|
-
|
13
|
-
|
14
12
|
|
15
13
|
|
16
14
|
|
@@ -40,13 +38,33 @@
|
|
40
38
|
|
41
39
|
> java.lang.NoClassDefFoundError: org/apache/lucene/search/spell/LevensteinDistance
|
42
40
|
|
43
|
-
> servlet.index1.doGet(index1.java:2
|
41
|
+
> servlet.index1.doGet(index1.java:26)
|
44
42
|
|
45
43
|
> javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
|
46
44
|
|
47
45
|
> javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
|
48
46
|
|
49
47
|
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
|
48
|
+
|
49
|
+
> 原因
|
50
|
+
|
51
|
+
>
|
52
|
+
|
53
|
+
> java.lang.ClassNotFoundException: org.apache.lucene.search.spell.LevensteinDistance
|
54
|
+
|
55
|
+
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
|
56
|
+
|
57
|
+
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
|
58
|
+
|
59
|
+
> servlet.index1.doGet(index1.java:26)
|
60
|
+
|
61
|
+
> javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
|
62
|
+
|
63
|
+
> javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
|
64
|
+
|
65
|
+
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
|
66
|
+
|
67
|
+
|
50
68
|
|
51
69
|
|
52
70
|
|
@@ -72,6 +90,8 @@
|
|
72
90
|
|
73
91
|
```java
|
74
92
|
|
93
|
+
|
94
|
+
|
75
95
|
package servlet;
|
76
96
|
|
77
97
|
|
@@ -79,6 +99,8 @@
|
|
79
99
|
import java.io.IOException;
|
80
100
|
|
81
101
|
import java.io.PrintWriter;
|
102
|
+
|
103
|
+
|
82
104
|
|
83
105
|
import javax.servlet.ServletException;
|
84
106
|
|
@@ -90,6 +112,8 @@
|
|
90
112
|
|
91
113
|
import javax.servlet.http.HttpServletResponse;
|
92
114
|
|
115
|
+
|
116
|
+
|
93
117
|
import org.apache.lucene.search.spell.LevensteinDistance;
|
94
118
|
|
95
119
|
|
@@ -98,7 +122,7 @@
|
|
98
122
|
|
99
123
|
public class index1 extends HttpServlet {
|
100
124
|
|
101
|
-
|
125
|
+
private static final long serialVersionUID = 1L;
|
102
126
|
|
103
127
|
|
104
128
|
|
@@ -116,7 +140,9 @@
|
|
116
140
|
|
117
141
|
|
118
142
|
|
143
|
+
|
144
|
+
|
119
|
-
|
145
|
+
LevensteinDistance levensteinAlgorithm = new LevensteinDistance();
|
120
146
|
|
121
147
|
PrintWriter out = response.getWriter();
|
122
148
|
|
@@ -132,11 +158,7 @@
|
|
132
158
|
|
133
159
|
out.println("<h1>Hello World!</h1>");
|
134
160
|
|
135
|
-
|
136
161
|
|
137
|
-
//ここから追加
|
138
|
-
|
139
|
-
LevensteinDistance levensteinAlgorithm = new LevensteinDistance();
|
140
162
|
|
141
163
|
out.println("結果①:" + levensteinAlgorithm.getDistance("resolution", "revolution"));
|
142
164
|
|
@@ -147,8 +169,6 @@
|
|
147
169
|
out.println("結果④:" + levensteinAlgorithm.getDistance("let it go", "let's and go"));
|
148
170
|
|
149
171
|
out.println("結果⑤:" + levensteinAlgorithm.getDistance("mountaingorilla", "fish"));
|
150
|
-
|
151
|
-
//ここまで追加
|
152
172
|
|
153
173
|
|
154
174
|
|