Search code examples
eclipsemavennetflixjava

Unable to properly link external Java library in Eclipse


I've been struggling to properly integrate this Netflix Java Client to access Netflix's API into a very basic Eclipse Java Web Project.

Whenever I try to publish any content referring to this library, I get errors like the following, indicating an inability to resolve the type of the classes in the external library I'm trying to use.

Aug 20, 2011 11:48:42 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [jsp] in context with path [/OSNet03] threw exception [Unable to compile class for JSP:

An error occurred at line: 19 in the jsp file: /index.jsp NetflixAPIClient cannot be resolved to a type

16: String myConsumerKey = new String("cefjbgekg7566cqrp2atua2n");

17: String myConsumerSecret = new String("redacted");

18:

19: NetflixAPIClient apiClient = new NetflixAPIClient(myConsumerKey, myConsumerSecret);

20: String uri = APIEndpoints.MOVIE_URI + "/2361637";

21: String details = null;

At the top of the file I include the proper class directories like this:

<%@ page import="com.netflix.api.*" %>
<%@ page import="com.netflix.api.client.*" %>
<%@ page import="com.netflix.api.client.dal.*" %>

And I don't receive any errors from Eclipse telling me it can't resolve the classes. Only once I publish it to the server does this error occur.

I've tried building with jre7 and jdk1.7.0. The library I'm trying to work with includes elements that are from Java v6 and v5.

I included the library by building it with Maven and placing the directory in my WEB-INF/lib folder and then including the jar netflix-client-2.3-SNAPSHOT.jar in my Build Path.

I've looked all over the web for possible causes and tried every prescribed solution I've found but none have worked.

You may be able to tell I'm very new to using Eclipse and Java Web Programming but I'm trying to figure things out as best I can as I go.


Solution

  • check if build automatically is on :P. if not try turning it on for once.

    if yes then check the project build path and look for libraries. check if the correct jars are there.

    also check if your jars are not corrupted.

    these are the usual problems for more wait for sm1 else to answer.

    you could also try searching for the resource class that can't be resolved using Ctrl+Shift+R and see if the class turns up.

    if you don't get it, then just extract the jar and see if the class is there for real.