NullPointer while trying to obtain headless client

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

NullPointer while trying to obtain headless client

Postby notsew » Fri Dec 08, 2006 12:43 am

We're getting a NullPointerException when trying to get a handle on the headless client from a servlet deployed under Servoy's Tomcat instance. Anyone have a suggestion?

java.lang.NullPointerException
at com.servoy.j2db.ClientState.aD(Unknown Source)
at com.servoy.j2db.server.headlessclient.a.<init>(Unknown
Source)
at
com.servoy.j2db.server.headlessclient.HeadlessClientFactory.createSessionBean(Unknown Source)
at iwp.shc.four51.XmlPostHandler.doPost(XmlPostHandler.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:595)

The call is:

ISessionBean servoy_hc =
HeadlessClientFactory.createSessionBean(null, "<solution name>", "<username>",
"<password>", new Object[]{ "Headless" });
notsew
 
Posts: 9
Joined: Tue Sep 19, 2006 7:45 pm

Sigh

Postby notsew » Tue Dec 12, 2006 9:54 pm

What joy it is to work with a closed and unsupported platform.
notsew
 
Posts: 9
Joined: Tue Sep 19, 2006 7:45 pm

Postby ROCLASI » Tue Dec 12, 2006 11:12 pm

Hi notsew,

If you need immediate support you better mail directly to support@servoy.com with an example that shows the error.
The people of Servoy can't track every message send on this forum.

As for your NullPointer error.

It's a bit of a guess without seeing all the rest of the jsp code but let me take a shot at it.
ISessionBean servoy_hc =
HeadlessClientFactory.createSessionBean(null, "<solution name>", "<username>",
"<password>", new Object[]{ "Headless" });


When I look at my (working) jsp code it seems you miss a few steps:
Code: Select all
   ISessionBean servoy_hc = (ISessionBean)application.getAttribute("servoy");
   if (servoy_hc == null)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"mySolutionName");
      application.setAttribute("servoy",servoy_hc);
   }
   boolean ok = servoy_hc.setMainForm("mySolutionFormName");


So try this approach and see if that works for you.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby notsew » Tue Dec 12, 2006 11:20 pm

Hi Robert,

Thanks for your response. Thing is, this call works from within a JSP, but not from a Servlet. Any thoughts on what the relevant difference might be? Could it matter that the latter is deployed in a .war archive while the former is sitting in the ROOT context?

Jason
notsew
 
Posts: 9
Joined: Tue Sep 19, 2006 7:45 pm

Postby ROCLASI » Wed Dec 13, 2006 12:07 am

Hi Jason,

I must admit my knowledge of servlets is very limited but let me try to work with you on this.
When I look at the headless-client API information I never see a null passed as a parameter of the HeadlessClientFactory.createSessionBean method. In fact it refers to 'javax.servlet.ServletReques' if that tells you something.
So there may lie your problem.

Hope this helps you further.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby notsew » Wed Dec 13, 2006 12:34 am

Robert --

There's another thread in this forum (http://forum.servoy.com/viewtopic.php?t=6417) in which it was discussed that passing null for that request arg is ok.

Thanks,
Jason
notsew
 
Posts: 9
Joined: Tue Sep 19, 2006 7:45 pm

Postby ROCLASI » Wed Dec 13, 2006 12:41 pm

Hi Jason,

Lets entertain the thought that it is required. Does it work then for you?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby notsew » Wed Dec 27, 2006 11:31 pm

Na, that's what we tried first, per the examples. We'll take it up with support. Thanks for your help.
notsew
 
Posts: 9
Joined: Tue Sep 19, 2006 7:45 pm


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 7 guests

cron