NullPointer Exception when upgraded to GWT 1.7 in Hosted Mode only.

24 views
Skip to first unread message

gwt_newbie

unread,
Oct 6, 2009, 1:45:43 AM10/6/09
to gwt-sl
I tried upgrading to GWT 1.7 and got the below exception when using
gwt-sl-0.1.5a.jar. Have gone through some of the posts here and
checked out the code from 1.0 branch, and created the gwt-sl-1.0.jar
using your build files, as the published 1.0 version was giving bad
version numbers with jdk 1.5 .I thought that would slove my issue but
surprisingly still I am getting the same exception. The strange thing
is that it works the regular way when I access the App through browser
but throws the exception only in the Hosted Mode (Both with the old
and new jars) .
We are using old version of Spring 1.2.8. Do you think its because of
the old version of Spring we are using?

Any help would be greatly appreciated. Thanks a lot

java.lang.NullPointerException
at javax.servlet.GenericServlet.getServletName
(GenericServlet.java:321)
at javax.servlet.GenericServlet.log(GenericServlet.java:276)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doGetSerializationPolicy
(RemoteServiceServlet.java:219)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.getSerializationPolicy
(RemoteServiceServlet.java:117)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.prepareToRead
(ServerSerializationStreamReader.java:429)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:
234)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
(RemoteServiceServlet.java:164)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
(RemoteServiceServlet.java:86)
at
org.gwtwidgets.server.spring.GWTSpringController.handleRequest
(GWTSpringController.java:85)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle
(SimpleControllerHandlerAdapter.java:44)
at org.springframework.web.servlet.DispatcherServlet.doDispatch
(DispatcherServlet.java:723)
at org.springframework.web.servlet.DispatcherServlet.doService
(DispatcherServlet.java:663)
at
org.springframework.web.servlet.FrameworkServlet.processRequest
(FrameworkServlet.java:394)
at org.springframework.web.servlet.FrameworkServlet.doPost
(FrameworkServlet.java:358) ..........


George Georgovassilis

unread,
Oct 6, 2009, 7:30:57 AM10/6/09
to gwt...@googlegroups.com
Hello Kiran,
 
Yeah, I am sorry about that NullPointerException, we fixed that in 1.0. There are a couple of things you can do:
 
1. Check out the 1.0 branch again and rebuild the gwt-sl.jar file. I fixed the problem where it would build only 1.6 version files, it should create 1.5 version classfiles now.
 
2. Alternatively, you can backport the fix in 1.0 to the 0.1.5a version you are using
 
3. The reason for the NPE is that GWT wants to log an error message, presumably that it cannot find the serialization policy - so you would get an error anyway. Make sure that:
 
 a. you are using the -noserver option of the hosted mode browser
 b. you have refreshed after a build the project workspace and restarted the hosted mode browser. Sometimes it caches serialization policy files
 c. also the service URLs change sometimes between hosted and web mode, make sure to distinguish in your client code between these two (see GWT.isScript)

gwt_newbie

unread,
Oct 6, 2009, 9:00:21 AM10/6/09
to gwt-sl
George,

Thanks a lot for your reply.

Actually I got the latest code from branch yesterday and did a build
and the errors with the bad version were resolved. But still I am
seeing the same Null Pointer exception.If I want to backport the fix
to 0.1.5.a, how can I know which are the files I may need to back
port? I will try the -noserver option on the GWT Hosted Mode and let
you know if that works. And in the hosted mode we connect to the
external server for all the RPCs. I will also look into your
recommendation of exploring GWT.isScript.

On Oct 6, 7:30 am, George Georgovassilis <g.georgovassi...@gmail.com>
wrote:
> Hello Kiran,
>
> Yeah, I am sorry about that NullPointerException, we fixed that in 1.0.
> There are a couple of things you can do:
>
> 1. Check out the 1.0 branch again and rebuild the gwt-sl.jar file. I fixed
> the problem where it would build only 1.6 version files, it should create
> 1.5 version classfiles now.
>
> 2. Alternatively, you can backport the fix in 1.0 to the 0.1.5a version you
> are using
>
> 3. The reason for the NPE is that GWT wants to log an error message,
> presumably that it cannot find the serialization policy - so you would get
> an error anyway. Make sure that:
>
>  a. you are using the -noserver option of the hosted mode browser
>  b. you have refreshed after a build the project workspace and restarted the
> hosted mode browser. Sometimes it caches serialization policy files
>  c. also the service URLs change sometimes between hosted and web mode, make
> sure to distinguish in your client code between these two (see GWT.isScript)
>
> On Tue, Oct 6, 2009 at 7:45 AM, gwt_newbie
> <kiran_katragadda2...@yahoo.com>wrote:
>
>
>
>
>
> > I tried upgrading to GWT 1.7 and got the below exception when using
> > gwt-sl-0.1.5a.jar. Have gone through some of the posts here and
> > checked out the code from 1.0 branch, and created the gwt-sl-1.0.jar
> > using your build files, as the published 1.0 version was giving bad
> > version numbers with jdk 1.5 .I thought that would slove my issue but
> > surprisingly still I am getting the same exception. The strange thing
> > is that it works the regular way when I access the App through browser
> > but throws the exception only in the Hosted Mode (Both with the old
> > and new jars) .
> > We are using old version of Spring 1.2.8. Do you think its because of
> > the old version of Spring we are using?
>
> > Any help would be greatly appreciated. Thanks a lot
>
> > java.lang.NullPointerException
> >        at javax.servlet.GenericServlet.getServletName
> > (GenericServlet.java:321)
> >        at javax.servlet.GenericServlet.log(GenericServlet.java:276)
> >        at
>
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.doGetSerializationPolic­y
> > (RemoteServiceServlet.java:219)
> >        at
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.getSerializationPolicy
> > (RemoteServiceServlet.java:117)
> >        at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.prepare­ToRead
> > (ServerSerializationStreamReader.java:429)
> >        at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:
> > 234)
> >        at
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
> > (RemoteServiceServlet.java:164)
> >        at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
> > (RemoteServiceServlet.java:86)
> >        at
> > org.gwtwidgets.server.spring.GWTSpringController.handleRequest
> > (GWTSpringController.java:85)
> >        at
> > org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle
> > (SimpleControllerHandlerAdapter.java:44)
> >        at org.springframework.web.servlet.DispatcherServlet.doDispatch
> > (DispatcherServlet.java:723)
> >        at org.springframework.web.servlet.DispatcherServlet.doService
> > (DispatcherServlet.java:663)
> >        at
> > org.springframework.web.servlet.FrameworkServlet.processRequest
> > (FrameworkServlet.java:394)
> >        at org.springframework.web.servlet.FrameworkServlet.doPost
> > (FrameworkServlet.java:358) ..........- Hide quoted text -
>
> - Show quoted text -

gwt_newbie

unread,
Oct 7, 2009, 3:17:35 PM10/7/09
to gwt-sl
George,

With the -noserver option I could make this work in the Hosted
Mode.Thanks a lot. However there is another application in which we
are facing issues. In this case we know that the Serialization file is
missing but despite GWT logging an error and warning ("a legacy, 1.3.3
compatible, serialization policy will be used"), it used to work fine.
But now while trying to log the error and warning it is throwing the
below null pointer exception. I got all the latest from SVN (1.0
branch. URL : https://gwt-widget.svn.sourceforge.net/svnroot/gwt-widget/server/branches/1.0
and revison 429) and build the jar file but still I am getting the
Null Pointer. Do you think I am missing some thing here. As I
mentioned earlier we are using an old version of Spring.

How can I know what are the files you modified to fix this error so
that I can back port them to 'gwt-sl-0.1.5a.jar' and try it?

Thanks a lot for your time.

java.lang.NullPointerException
at javax.servlet.GenericServlet.getServletName
(GenericServlet.java:321)
at javax.servlet.GenericServlet.log(GenericServlet.java:276)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doGetSerializationPolicy
(RemoteServiceServlet.java:247)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.getSerializationPolicy
(RemoteServiceServlet.java:117)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.prepareToRead
(ServerSerializationStreamReader.java:429)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:
234)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
(RemoteServiceServlet.java:164)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
(RemoteServiceServlet.java:86)
at
org.gwtwidgets.server.spring.GWTSpringController.handleRequest
(GWTSpringController.java:85)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle
(SimpleControllerHandlerAdapter.java:44)
at org.springframework.web.servlet.DispatcherServlet.doDispatch
(DispatcherServlet.java:723)
at org.springframework.web.servlet.DispatcherServlet.doService
(DispatcherServlet.java:663)
at
org.springframework.web.servlet.FrameworkServlet.processRequest
(FrameworkServlet.java:394)
at org.springframework.web.servlet.FrameworkServlet.doPost
(FrameworkServlet.java:358) .....



> > - Show quoted text -- Hide quoted text -

gwt_newbie

unread,
Oct 7, 2009, 10:22:01 PM10/7/09
to gwt-sl
The revision I meant was the Directory revision.

George Georgovassilis

unread,
Oct 10, 2009, 11:00:35 AM10/10/09
to gwt-sl
If you are using the 1.0 version, you won't need to backport it to
0.1.5. Can you post your configuration? Also make sure that you are
configuring the GWTHandler or GwtRpcServiceExporter in a -servlet.xml
file and _not_ an application-context.xml

gwt_newbie

unread,
Oct 15, 2009, 10:19:49 PM10/15/09
to gwt-sl
We are using the below configuration.

jdk 1.5.0_03
GWT1.7
Spring1.2.8
Hibernate3.2
gwt-sl-0.1.5a.Also tried with latest gwt-sl-1.0(Built from latest
SVN).

Same error on both servers
tomcat 5.5.17
weblogic8.1

I tried to debug the issue and found that some how the ServletConfig
object is becoming null in the GenericServlet.I provided a workaround
for now by overriding the log methods from generic servlet(checking if
servlet config is null... ).

And also we are not using either GWTHandler or GwtRpcServiceExporter.
We have all our GWT Service Implementation classes extend a
BaseService class which extends GWTSpringController. And in spring-
servlet.xml we are giving the mappings between rpc requests and
Service Implementation classes using SimpleUrlHandlerMapping.

Thanks
kiran

On Oct 10, 11:00 am, George Georgovassilis

George Georgovassilis

unread,
Oct 16, 2009, 4:51:27 AM10/16/09
to gwt...@googlegroups.com
Hi Kiran,

I get it. But please check, that you define the Beans which extend the
GWTSpringController not in the application-context.xml, but in a
-servlet.xml. Did you do that?

gwt_newbie

unread,
Oct 16, 2009, 10:01:36 AM10/16/09
to gwt-sl
Hi George,

Yes we dont use application-context.xml. All our bean definitions and
mappings are in the spring-servlet.xml .

Just providing a sample of definition and mapping from our spring-
servlet.xml

<bean id="gwtCtrl"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<map>
<entry key="/actionOne.rpc" value-ref="rpc-actionOne"/>
</map>
</property>
</bean>

<bean id="rpc-actionOne" class="com.abc.gwt.server.ActionOneSI"/>

Thanks
Kiran

On Oct 16, 4:51 am, George Georgovassilis <g.georgovassi...@gmail.com>
> >>> The revision I meant was the Directory revision.- Hide quoted text -

George Georgovassilis

unread,
Oct 24, 2009, 10:54:45 AM10/24/09
to gwt-sl
Hi Kiran,

you were right! The GWTSpringController is buggy. I committed a fix to
the SVN which provided the underlying RemoteServiceServlet with a
Servlet Context. Have a look and let me know if it fixes the problem.

gwt_newbie

unread,
Nov 6, 2009, 9:58:03 AM11/6/09
to gwt-sl
Hi George,

Sorry for the late reply and thanks a lot for looking into this. Will
let you know as soon as I try it.

On Oct 24, 9:54 am, George Georgovassilis <g.georgovassi...@gmail.com>
> > > - Show quoted text -- Hide quoted text -

gwt_newbie

unread,
Nov 9, 2009, 5:24:40 PM11/9/09
to gwt-sl
Hi George,

After getting the latest code I saw that you were using
ServletConfigAware in GWTSpringController which is not available in
the version of Spring which we use (Spring 1.2.8). So did not give it
a try.
Did you have it fixed in the branch for gwt-sl-0.1.5a? If so I will
get it from there.

George Georgovassilis

unread,
Nov 10, 2009, 2:11:38 AM11/10/09
to gwt-sl
Hello Kiran,

Sorry for that. We switched to Spring 2 a couple of years ago, so it's
a prerequisite. Fortunately, you do have a way out, but you need to
patch the GWTSpringController on your own.

In rough lines:

1. Remove the ServletConfigAware interface
2. Create a setter for the servlet name (needed in 3)
3. Change the setServletContext(...) method to retrieve the
ServletConfig from the context. The way to go is:

servletContext.getServlet(servletName).getServletConfig()

The servlet name is whatever you named the Spring DispatcherServlet in
your WEB.xml
Reply all
Reply to author
Forward
0 new messages