Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Front Line
Liferay modifies web.xml on deploy (listener ordering changed in 6.1.1)
August 1, 2012 3:53 PM
Answer

Front Line

Rank: New Member

Posts: 17

Join Date: April 14, 2011

Recent Posts

Hi,

Liferay modifies the web.xml of your portlet on deploy.
It apparently inserts at least a couple of lines. The problem is that my struts portlets don't work if the spring context listener isn't the first listener. Liferay sets your own custom listeners as the last ones.

My web.xml

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

After deploy

<listener>
<listener-class>com.liferay.portal.kernel.servlet.PluginContextListener</listener-class>
</listener>
<listener>
<listener-class>com.liferay.portal.kernel.servlet.SerializableSessionAttributeListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Has the ordering changed between 6.1 and 6.1.1? It used to work in 6.1 (my own listener was the first one, now it is the last and my portlet doesn't work)
Front Line
RE: Liferay modifies web.xml on deploy (listener ordering changed in 6.1.1)
August 2, 2012 3:10 AM
Answer

Front Line

Rank: New Member

Posts: 17

Join Date: April 14, 2011

Recent Posts

Apparently this issue from years ago is about the same problem
http://issues.liferay.com/browse/LEP-5062

I don't understand why Liferay must mess with the web.xml in the first place... If there are some mandatory listeners etc that Liferay needs then just document the behaviour and developers will themselves add the needed lines to the web.xml. But a weird architecture if a standard portlet needs these changes to work in Liferay.

Any workarounds or suggestions?
Front Line
RE: Liferay modifies web.xml on deploy (listener ordering changed in 6.1.1)
August 2, 2012 3:17 AM
Answer

Front Line

Rank: New Member

Posts: 17

Join Date: April 14, 2011

Recent Posts

Ok, the issue above talks about the class PortletContextLoaderListener but the issue is still the same, ie. messing with listeners in the web.xml
David H Nebinger
RE: Liferay modifies web.xml on deploy (listener ordering changed in 6.1.1)
August 2, 2012 6:17 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11771

Join Date: September 1, 2006

Recent Posts

Hmm, maybe the issue is yours...

Liferay is totally based on struts and doesn't seem to have any problems whatsoever...
Front Line
RE: Liferay modifies web.xml on deploy (listener ordering changed in 6.1.1)
August 2, 2012 8:21 AM
Answer

Front Line

Rank: New Member

Posts: 17

Join Date: April 14, 2011

Recent Posts

What a helpful answer, thanks!

The exact same portlet works on 6.1, but doesn't work with 6.1.1, so it seems logical to you that the problem is somewhere else than in a change made in how 6.1.1 handles the web.xml on deploy? And if you check BaseDeployer.java in Liferay you can see that it now prepends "com.liferay.portal.kernel.servlet.PluginContextListener" before your own listeners.
Liferay's portlets do not use Spring as Struts' object factory.

Has anybody tried if Spring MVC portlets work?
František Hartman
RE: Liferay modifies web.xml on deploy (listener ordering changed in 6.1.1)
August 8, 2012 10:20 AM
Answer

František Hartman

Rank: New Member

Posts: 1

Join Date: March 12, 2012

Recent Posts

I have tried out 6.1.1 today and had the same issue - works like a charm on 6.1.0, breaks on 6.1.1 because root application context is not initialized yet.

It is reported as a bug.

http://issues.liferay.com/browse/LPS-29103