Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Charalampos Chrysikopoulos
Cast Exception with struts 2 portlet from 5.2.x to 6.0.x
13 de Março de 2012 02:25
Resposta

Charalampos Chrysikopoulos

Ranking: New Member

Mensagens: 21

Data de entrada: 8 de Dezembro de 2011

Mensagens recentes

I have a strange problem:
in my firm we use to have a port let implemented in life ray 5.2.3 using struts2. This worked well, till we decided to upgrade to liferay 6.0.x EE. We "transfer" the code from the old version to a new 6.0.x life ray portlet and it looked well except one thing. We got the following exception:

java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.String
at com.liferay.portal.servlet.BrowserSnifferImpl.getUserAgent(BrowserSnifferImpl.java:356)
at com.liferay.portal.servlet.BrowserSnifferImpl.isMozilla(BrowserSnifferImpl.java:216)
at com.liferay.portal.servlet.BrowserSnifferImpl.isFirefox(BrowserSnifferImpl.java:140)
at com.liferay.portal.kernel.servlet.BrowserSnifferUtil.isFirefox(BrowserSnifferUtil.java:60)
at com.liferay.portal.servlet.filters.gzip.GZipResponse.<init>(GZipResponse.java:57)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:121)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
at $Proxy390.doFilter(Unknown Source)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:55)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)

...

The portal couldn't load the styles, javascripts and images of the portlet, so the port let seems to work but its ugly without its css and images and some functionality is missing because of the missing javascript.
It seems that the exception broke the load of those resources, but I can't find out where the problem is.
We are using Liferay 6.0 EE.

Thank you in advance,
Charalampos Chrysikopoulos
Charalampos Chrysikopoulos
RE: Cast Exception with struts 2 port let from 5.2.x to 6.0.x
6 de Março de 2012 02:28
Resposta

Charalampos Chrysikopoulos

Ranking: New Member

Mensagens: 21

Data de entrada: 8 de Dezembro de 2011

Mensagens recentes

An example of the case:
If I try to load only the icon of the portlet by calling

http://localhost:8080/my-portlet/icon.png

i get the same exception:

java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.String
at com.liferay.portal.servlet.BrowserSnifferImpl.getUserAgent(BrowserSnifferImpl.java:356)
at com.liferay.portal.servlet.BrowserSnifferImpl.isMozilla(BrowserSnifferImpl.java:216)
at com.liferay.portal.servlet.BrowserSnifferImpl.isFirefox(BrowserSnifferImpl.java:140)
at com.liferay.portal.kernel.servlet.BrowserSnifferUtil.isFirefox(BrowserSnifferUtil.java:60)
at com.liferay.portal.servlet.filters.gzip.GZipResponse.<init>(GZipResponse.java:57)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:121)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at sun.reflect.GeneratedMethodAccessor455.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Charalampos Chrysikopoulos
RE: Cast Exception with struts 2 portlet from 5.2.x to 6.0.x
6 de Março de 2012 04:18
Resposta

Charalampos Chrysikopoulos

Ranking: New Member

Mensagens: 21

Data de entrada: 8 de Dezembro de 2011

Mensagens recentes

I tried to deactivate

#
# If the user can unzip compressed HTTP content, the GZip filter will
# zip up the HTTP content before sending it to the user. This will speed up
# page rendering for users that are on dial up.
#
#com.liferay.portal.servlet.filters.gzip.GZipFilter=false

but it didn't fix the problem.
Zsolt Balogh
RE: Cast Exception with struts 2 portlet from 5.2.x to 6.0.x
19 de Novembro de 2012 18:07
Resposta

Zsolt Balogh

LIFERAY STAFF

Ranking: Expert

Mensagens: 459

Data de entrada: 23 de Março de 2009

Mensagens recentes

Hi,

Thanks for reporting this problem, it helped me with the investigation that you have mentioned that it happens when you are using struts 2.

I have created a ticket, you can track the progress here: LPS-31104

Zsolt
Abhed Dekavadiya
RE: Cast Exception with struts 2 portlet from 5.2.x to 6.0.x
30 de Dezembro de 2012 15:29
Resposta

Abhed Dekavadiya

Ranking: Junior Member

Mensagens: 72

Data de entrada: 5 de Outubro de 2010

Mensagens recentes

Hi Zsolt,

I am facing the same error and I am able to get rid of the error after removing below filters and their related filter-mappings from liferay-web.xml (tomcat/webapps/portlet-name/WEB-INF/) after deploying the portlet. But hat's a workaround. The ticket LPS-31104 is closed, could you please let me know the fix for that?

 1
 2    <filter>
 3        <filter-name>GZip Filter</filter-name>
 4        <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class>
 5        <init-param>
 6            <param-name>filter-class</param-name>
 7            <param-value>com.liferay.portal.servlet.filters.gzip.GZipFilter</param-value>
 8        </init-param>
 9    </filter>
10    <filter>
11        <filter-name>GZip Filter - Theme PNG</filter-name>
12        <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class>
13        <init-param>
14            <param-name>filter-class</param-name>
15            <param-value>com.liferay.portal.servlet.filters.gzip.GZipFilter</param-value>
16        </init-param>
17        <init-param>
18            <param-name>url-regex-pattern</param-name>
19            <param-value>.+/themes/.*/images/.*\.png</param-value>
20        </init-param>
21    </filter>
Jelmer Kuperus
RE: Cast Exception with struts 2 portlet from 5.2.x to 6.0.x
30 de Dezembro de 2012 16:58
Resposta

Jelmer Kuperus

Ranking: Liferay Legend

Mensagens: 1192

Data de entrada: 10 de Março de 2010

Mensagens recentes

They reference the commit id in the ticket, so you can see what they changed

https://github.com/liferay/liferay-portal/commit/262014cd2d2c1da29cb86d6fef246301c6dc2c6f

In this case you could probably create your own class in ext-impl hat extends BrowserSnifferImpl and fixes the problem. You could wire up this class in ext-spring.xml
Abhed Dekavadiya
RE: Cast Exception with struts 2 portlet from 5.2.x to 6.0.x
1 de Fevereiro de 2013 04:01
Resposta

Abhed Dekavadiya

Ranking: Junior Member

Mensagens: 72

Data de entrada: 5 de Outubro de 2010

Mensagens recentes

Hey Jelmer,

Thanks for your inputs ! I was working on a sample, which is delivered now. I'll look into fixing the issue, if I'll face it again next time emoticon

kind regards,
Abhed Dekavadiya