Fórumok

Nyitólap » Liferay Portal » English » 3. Development

Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
Cameron McBride
How to use Spring in a portlet without including the jars?
2012. július 31. 13:48
Válasz

Cameron McBride

Rangsorolás: Expert

Hozzászólások: 277

Csatlakozás dátuma: 2011. február 8.

Legújabb hozzászólások

Simple enough right? I have a Spring MVC portlet and if I deploy the various spring jars with it then it works perfectly. Instead I would like to use the Spring 3.0.6 that comes with Liferay, in <tomcat>\webapps\ROOT\WEB-INF\lib\spring*.jar.

What I did was first not include the jars in my war (ha ha) and second I added this into my portlet-plugin-package.properties:
portal-dependency-jars=\
commons-logging.jar,\
jstl-api.jar,\
jstl-impl.jar,\
slf4j-api.jar,\
spring-context.jar,\
spring-aop.jar,\
spring-asm.jar,\
spring-beans.jar,\
spring-context-support.jar,\
spring-core.jar,\
spring-expression.jar,\
spring-web.jar

I'm not sure that it's really needed, I think those are just for compile time dependencies and I'm using gradle to build. When I deploy it fails immediatly with this:
120:36:02,520 ERROR [PortletBagFactory:123] java.lang.NoClassDefFoundError: org/springframework/context/ApplicationListener
2java.lang.NoClassDefFoundError: org/springframework/context/ApplicationListener


Any ideas how to take advantage of the Spring that Liferay already has loaded so I don't have to deploy portlets with duplicate jars?
Jelmer Kuperus
RE: How to use Spring in a portlet without including the jars?
2012. július 31. 14:23
Válasz

Jelmer Kuperus

Rangsorolás: Liferay Legend

Hozzászólások: 1187

Csatlakozás dátuma: 2010. március 10.

Legújabb hozzászólások

The class you are missing is in spring-context.jar so you should have it.

can you verify that this class was copied to the webapps/your-portlet/WEB-INF/lib folder after your portlet was deployed?
David H Nebinger
RE: How to use Spring in a portlet without including the jars?
2012. július 31. 14:34
Válasz

David H Nebinger

Rangsorolás: Liferay Legend

Hozzászólások: 4549

Csatlakozás dátuma: 2006. szeptember 1.

Legújabb hozzászólások

Also make sure you're doing a clean build and deploy. Hot deploy may not be deleting some of the jars hanging around.