Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Bob Dietrich
Exception in PollerServlet
July 11, 2010 5:39 PM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 211

Join Date: May 15, 2005

Recent Posts

I'm trying to port an ICEFaces and Hibernate-based portlet to LR 6.0.1 (and GA shortly). The portlet deploys and functions correctly under Tomcat now. However, once my portlet loads, I start getting the following exception from PollerServlet every few seconds:

117:23:39,118 ERROR [PollerServlet:81] java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.util.Map;
2java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.util.Map;
3    at com.liferay.portal.poller.PollerServlet.getContent(PollerServlet.java:97)
4    at com.liferay.portal.poller.PollerServlet.service(PollerServlet.java:66)
5    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
6[...]

The code in question looks like:
1        Map<String, Object>[] pollerRequestChunks =
2            (Map<String, Object>[])JSONFactoryUtil.deserialize(
3                pollerRequestString);

I suspect this is being caused by a duplicate jar file being loaded, but I have no idea which one. Any suggestions on how to solve this problem? Thanks.
Pavel Andreevich Tikhomirov
RE: Exception in PollerServlet
July 12, 2010 2:54 AM
Answer

Pavel Andreevich Tikhomirov

Rank: New Member

Posts: 6

Join Date: August 17, 2009

Recent Posts

I have same problems.
Details: when user is not logged, this error is not exist.
Bob Dietrich
RE: Exception in PollerServlet
July 12, 2010 10:59 PM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 211

Join Date: May 15, 2005

Recent Posts

Pavel,
Are you adding any additional portlets? What app server are you using? Thanks.
Pavel Andreevich Tikhomirov
RE: Exception in PollerServlet
July 13, 2010 1:20 AM
Answer

Pavel Andreevich Tikhomirov

Rank: New Member

Posts: 6

Join Date: August 17, 2009

Recent Posts

We are using Liferay 6 RC2 (database: mysql 5.0.77) + JBOSS AS. We added only several our developed portlets (Icefaces 1.8.2 gaP01 + hibernate 3.5.1).
Pavel Andreevich Tikhomirov
RE: Exception in PollerServlet
July 20, 2010 6:53 AM
Answer

Pavel Andreevich Tikhomirov

Rank: New Member

Posts: 6

Join Date: August 17, 2009

Recent Posts

We updated portal from Liferay 6 RC2 to Liferay 6 CE GA1, but the problem still occurs. Are there any ideas how to fix this problem?
Hubert Vogten
RE: Exception in PollerServlet
July 22, 2010 3:18 AM
Answer

Hubert Vogten

Rank: New Member

Posts: 11

Join Date: December 2, 2008

Recent Posts

We encountered the same problem. I created an issue in JIRA for this. See http://issues.liferay.com/browse/LPS-11469.

We looked into the issue and found that the problem is caused by a conflict between the prototype framework and Alloy. We patched two files in Liferay so solve this issue for now. This workaround is cirtainly not ideal. The prototype library is actually causing the problems and not the libraries used by Alloy. But we didn't know what the side effects would be of modifying the prototype library, therefore we choosed to modify the libraries used by Alloy.

The following files where changed:
portal-web/docroot/html/js/aui/json/json.js
portal-web/docroot/html/js/aui/json/json-stringify.js

I will describe the changes in these files. They have to applied to the minified and debug versions as well.


In json.js

line 365: we modified as follows:

1        if (t === DATE) {
2            if (isObject(value) && isFunction(value.toJSON)) {
3                value = value.toJSON(key);
4            } else {
5                value = _date(value);
6            }
7        }


line 464 we modified as follows:

1   useNativeStringify : false,




We did a similar thing to json-stringify.js

line 142: we modified as follows:

1        if (t === DATE) {
2            if (isObject(value) && isFunction(value.toJSON)) {
3                value = value.toJSON(key);
4            } else {
5                value = _date(value);
6            }
7        }


line 241:
1   useNativeStringify : false,
Pavel Andreevich Tikhomirov
RE: Exception in PollerServlet
July 22, 2010 6:40 AM
Answer

Pavel Andreevich Tikhomirov

Rank: New Member

Posts: 6

Join Date: August 17, 2009

Recent Posts

This solution does not work for liferay on jboss.
Pavel Andreevich Tikhomirov
RE: Exception in PollerServlet
July 23, 2010 5:12 AM
Answer

Pavel Andreevich Tikhomirov

Rank: New Member

Posts: 6

Join Date: August 17, 2009

Recent Posts

It is suspected that the problem is caused by the conflict portlet "Chat" and IceFaces-portlet.

How to disable Chat Portlet?
Eric P Tiongson
RE: Exception in PollerServlet
July 24, 2010 12:56 AM
Answer

Eric P Tiongson

Rank: New Member

Posts: 3

Join Date: January 23, 2008

Recent Posts

Pavel Andreevich Tikhomirov:
It is suspected that the problem is caused by the conflict portlet "Chat" and IceFaces-portlet.

How to disable Chat Portlet?


Chat portlet is just a war, I undeployed ours using Glassfish's Admin Console. But within Liferay you should be unable to uninstall it under Control Panel --> (Server) Update Manager.

I can confirm though, I simply undeployed the chat portlet and the exceptions went away. I did not have to apply any patch.
Ralph Soika
RE: Exception in PollerServlet
July 27, 2010 4:26 AM
Answer

Ralph Soika

Rank: Junior Member

Posts: 34

Join Date: October 28, 2008

Recent Posts

Hi,
I have the same issue with a RichFaces Portlet. The portlet works fine but when it starts the exception posted below is thrown. Here is a link to my portlet.war file so you can test this. I am using Liferay Portal Community Edition 6.0.3 CE


Ralph


 1
 213:05:43,440 ERROR [PollerServlet:79] java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.util.Map;
 3java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.util.Map;
 4    at com.liferay.portal.poller.PollerServlet.getContent(PollerServlet.java:95)
 5    at com.liferay.portal.poller.PollerServlet.service(PollerServlet.java:64)
 6    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 7    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 8    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 9    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:177)
10    at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:81)
11    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:104)
12    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
13    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
14    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:177)
15    at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:179)
16    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:104)
17    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
18    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:177)
20    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:241)
21    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:104)
22    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
23    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
24    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:177)
25    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:107)
26    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
27    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
28    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:177)
29    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:107)
30    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
31    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
32    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
33    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
34    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
35    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:177)
36    at com.liferay.portal.servlet.filters.threadlocal.ThreadLocalFilter.processFilter(ThreadLocalFilter.java:35)
37    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:104)
38    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
39    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
40    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
41    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
42    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
43    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
44    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
45    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
46    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
47    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
48    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
49    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
50    at java.lang.Thread.run(Thread.java:619)
Pavel Andreevich Tikhomirov
RE: Exception in PollerServlet
August 6, 2010 4:26 AM
Answer

Pavel Andreevich Tikhomirov

Rank: New Member

Posts: 6

Join Date: August 17, 2009

Recent Posts

In Liferay 6.0.4 exceptions still occur. As before uninstalling chat-portlet solves this problem.
Balazs Zsoldos
RE: Exception in PollerServlet
August 12, 2010 6:46 PM
Answer

Balazs Zsoldos

Rank: Junior Member

Posts: 41

Join Date: April 11, 2006

Recent Posts

Hi,

to solve this issue you must append to the end of prototype.js with the content of this fix file.
The linked fix is part of the this issue.

Regards,
Balazs
Balazs Zsoldos
RE: Exception in PollerServlet
August 14, 2010 12:28 PM
Answer

Balazs Zsoldos

Rank: Junior Member

Posts: 41

Join Date: April 11, 2006

Recent Posts

Hi Ralph,

in case of Richfaces please see this post where you can download a working Richfaces portlet with the appended prototype.js.

In case you need a simple fixed richfaces jar you can download it here.

Also I created a jira issue on jboss site: jira issue.

Regards,
Balazs
Bob Dietrich
RE: Exception in PollerServlet
August 12, 2010 9:29 PM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 211

Join Date: May 15, 2005

Recent Posts

I just noticed tonight that http://issues.liferay.com/browse/LPS-11469 has been closed. While I appreciate Nate's thoughtful comments, I think he missed the point. I'll state my case here rather than in a closed JIRA issue in the hope it will be heard.

Nate makes the case that this is an issue with the Prototype library used by ICEFaces. That may be true, but those of us concerned with this issue are using ICEFaces and have no say over its implementation. Nor does Liferay, of course.

However, some patches have been posted in this thread that may fix the issue - maybe, maybe not. I have a feeling Nate may not have seen these proposed fixes, probably because they weren't associated with the issue. I hope he can reconsider.

If the issue is not reopened, what does it mean? Based on my limited understanding, rejecting this issue means Liferay no longer supports ICEFaces and RichFaces portlets because of the Prototype library. Is this really the intent?
Nate Cavanaugh
RE: Exception in PollerServlet
August 13, 2010 10:42 AM
Answer

Nate Cavanaugh

LIFERAY STAFF

Rank: Junior Member

Posts: 65

Join Date: November 27, 2006

Recent Posts

Hi Bob,
Thanks for letting me know about this forum post.

I had not seen these proposed patches, and while I appreciate Hubert's proposed patch above, it's not a solution that we can deliver to everyone.

We're currently working with the ICEFaces team to see about what solutions could be provided, and thank you Balazs for including details on the RichFaces fix.

The intent of closing that specific ticket is not to drop support for ICEFaces or RichFaces, but rather to say that we're not able to fix it in the portal layer itself because the nature of the problem isn't in the portal layer, but rather in a deployed application.

When we hear word back from and get a fix from ICEFaces, we'll probably commit it to the other ticket linked to this one, since it's specifically in reference to issue with the application.

However, I did some quick hacking around and I do have a workaround that I believe will work (at least it works for the sample applications):
 1(function() {
 2        var iframe = document.createElement('iframe');
 3
 4        iframe.style.display = 'none';
 5        document.body.appendChild(iframe);
 6
 7        var frameDoc = frames[frames.length - 1].document;
 8        frameDoc.open();
 9        frameDoc.write(
10          "<script>var natives = ['String', 'Array', 'Object', 'Date', 'Function', 'RegExp', 'Boolean']; i = natives.length; while(i--){var nativeName = natives[i];var parentObj = parent[nativeName]; var windowObj = window[nativeName];if(parentObj.prototype.toJSON+'' != windowObj.prototype.toJSON+''){parentObj.prototype.toJSON = windowObj.prototype.toJSON;}}<\/script>"
11        );
12        frameDoc.close();
13    })();


If you add that script block to the bottom of your Liferay theme (into a script tag right above the closing of your body tag), it will fix the issue. There is one caveat, and that is if the ICEFaces application relies upon the toJSON method of the object behaving as defined by Prototype, then there's the possibility of breakage.
But what this code does is restore the toJSON methods to the browser defaults.

This is just one possible work around that may work for you, but the root issue of the ICEFaces application being patched is the best long term solution.
If I hear anything definitive I'll make sure to keep you guys updated, and if some enterprising community member like Balazs wants to patch it, that will also probably help speed things along.

Thanks Bob,
Bob Dietrich
RE: Exception in PollerServlet
August 13, 2010 11:41 AM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 211

Join Date: May 15, 2005

Recent Posts

Terrific, thanks Nate! I really appreciate you looking into this so quickly.

I understand the root cause is in ICEFaces and RichFaces, but sometimes including a workaround can really help those who come along later and haven't seen this posting. Do you think your workaround would be okay to include in the general release? I suppose an alternative would be to put this in the wiki as a warning for developers using ICEFaces/RichFaces, but that means such portlets aren't very portable (theme modification needed). Also, does this affect the Chat portlet since the exception goes away when Chat is disabled?

Since you're obviously a lot more familiar with the details, would you kindly create a JIRA issue so this doesn't get lost? Thanks.
Bob Dietrich
RE: Exception in PollerServlet
August 29, 2010 6:58 PM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 211

Join Date: May 15, 2005

Recent Posts

I've asked that the workaround be added to Liferay so ICEFaces is supported. See LPS-12344
Palani Venkat
RE: Exception in PollerServlet
April 18, 2011 2:16 AM
Answer

Palani Venkat

Rank: Junior Member

Posts: 32

Join Date: November 10, 2010

Recent Posts

Hi ,

I have a query on Database Exception handlinng. I need to implement this in production server(Enterprise Edition of Liferay).

At the time of using portal if the Database goes down then if we click on any tab, it displays blank page to the user

But instead of blank page i have to display any message like "Please contact Administrator.. " within the portal.

I have tried to catch using error page tag in tomcat-6.0.26\webapps\ROOT\WEB-INF\web.xml but its not working.

Could you please help me in this regard how to catch and display the error page.

Your help will be greatly aprreciated..

Regards,
Palanivel