Mohd Shakir Zakaria
Mohd Shakir Zakaria

Reputation: 664

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 should I import to replace it?

Upvotes: 0

Views: 551

Answers (3)

DwB
DwB

Reputation: 38300

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).

Upvotes: 0

Paul Grime
Paul Grime

Reputation: 15104

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?

Upvotes: 0

Philipp Reichart
Philipp Reichart

Reputation: 20961

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.

Upvotes: 1

Related Questions