How to import external library from [tomcat_home]/lib in TOMCAT

Viewed 26

I'm trying to apply external library in java project.

According to the API documentation, it shouldn't be located under reloadable classpath like WEB-INF/classes or WEB-INF/lib and the easiest way to apply API is put the .jar file into [tomcat home]/lib and restart tomcat.
So I put the jar file into [tomcat home]/lib folder and import the API on java class.
But error occurred when I run the server. It seems the API not imported.

2022-08-09 11:08:36,499  WARN [org.springframework.web.context.support.XmlWebApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '[api class name]': Invocation of init method failed; nested exception is java.lang.Error: Unresolved compilation problem:
        [api name] cannot be resolved

Do I need more settings?

1 Answers

#SOLVED

I just placed jar file only into tomcat server not local because the API is available only in operation server.

So I add jar file on my eclipse (Project Right Click - Build Path - Configure Build Path - Add External JARs) and then deploy project as WAR.

Related