Deploying WAR with Spring with its external JAR dependencies

I have a Spring application that has many dependencies (18 megabytes of JAR files ..). Now, when I test on a remote Tomcat 6.0 server, I will not need to load this 19 megabytes of dependencies and just load the classes. Pretty simple, right?

I can't get this damn thing to work.

I use Eclipse 3.4, and if in Java Build Path-> Order and Export I delete the export of all the dependencies, I get a nice little WAR.

So here is what I tried:

I uploaded all the libraries to the server and ran them in the general / lib in Tomcat. The directory does not exist, so I created it and changed the properties of catalina.properties:

shared.loader=${catalina.home}/common/lib/*.jar

I tried a bunch of other configurations but no one worked. Reboot the server, the deployed war does not start. In particular:

SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderList$java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener       at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1

, Log4J, . Spring lib, , /lib.

, 18- , . . , .

- JAR , Log4j .

? , .

+3
8

" Spring, (18 JAR ..). , Tomcat 6.0, 19 . , ?"

- 19MB . WAR .

, Tomcat, , WAR Tomcat.

. , JAR Tomcat/lib, , , , JAR , , . JAR WEB-INF/lib, , . - JAR , .

, devl- > test- > prod, JAR, . , . . , . JAR WAR.

+4

, , -. , , , .

duffymo... 19MB ... - ? .

+1

webapp

/path-to-tomcat/webapp/myapp/

/path -to-tomcat/webapp/myapp/WEB-INF/lib ur/path-to-tomcat/webapp/myapp/classes

tomcat

+1

-, ${CATALINA_HOME}/webapps/< > . , WAR, .

, , - . Tomcat ; WEB-INF/web.xml , , , . - "", .

Tomcat ant ( Tomcat, ant!), , , . , , , , .

+1
  • WEB-INF/lib ?
  • log4j.jar?
  • spring.jar?

classloader.

0

duffymo cjstehno.

tomcat - .

webapps.

0

, Tomcat jar. , ($ {catalina.home}/lib). ( , shared.folder, ).

, , . , - , .

Another note: you should only do this if you have full control over the server, and you only install applications.

0
source

Why did you change the default $ {shared.loader} property for tomcat?

0
source

Source: https://habr.com/ru/post/1712143/


All Articles