开发者

page import="javax.event.*" "The import javax.event cannot be resolved" error

I received a legacy JSP system where Eclipse mark "The import javax.event cannot be resolved" error on every occurrence of the following code:

<%@ page import="javax.event.*" %>

Here's my java version:

shakir@anduril:~$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.2) (6b22-1.10.2-0ubuntu1~11.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

What can I do to fix this? Is it that the "javax.event" is deprecated? If so, what package 开发者_StackOverflow中文版should I import to replace it?


You're missing a library containing the javax.event package, no deprecation.

That's most likely JSR-299 Java Contexts and Dependency Injection for the Java EE platform (CDI), so putting the JAR(s) of the JSR-299 reference implementation into your WEB-INF/lib (or POM) should fix it.

Just noticed that JSR-299 was previously named "WebBeans" and lived in package javax.event, now it's called "CDI" and moved to package javax.enterprise.event, so you'll need to do some find-and-replace over your JSPs in addition to the JARs mentioned above.


javax.event is part of JSR-299. It's not one I've heard of to be honest. If they were provided in your app server, then you may need to reference your app server's jars in your Eclipse project.

Do your JSPs actually use these javax.event classes? If so, which ones?


javax.event is part of neither the Java SE 6.0 nor the Java EE 6.0 normal distributions (the api docs at least). You must include the .jar file in which these classes reside in either a shared location on your server or in your war file (the WEB-INF/lib/ directory).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜