HC not working using a separate server

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

HC not working using a separate server

Postby Foobrother » Wed Feb 04, 2009 11:02 am

hi everybody,

I wrote a program which runs a method on the Servoy Server when called by the client using JSP pages. Firstly I tried with the client and server on the same machine (developer one) and it works fine.
I'm now trying to make my program working on the server (another machine) with my machine as client. But this time when the method is called on the server it seems to be stuck when creating the headless client. I don't get any error in the logs. The only thing I see, is the headless client and my smart client on the "clients" section of the server administration website.

Here is code of the JSP page which seems to cause the problem:
Code: Select all
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import = "java.util.*" %>
<%@ page import = "com.servoy.j2db.server.headlessclient.*" %>
<%@ page import = "com.servoy.j2db.util.*" %>
<%@ page import = "com.servoy.j2db.dataprocessing.IDataSet" %>
<%@ page errorPage="errorpage.jsp" %>

<html>
<head>

<meta http-equiv="refresh" content="2;url=doc2pdf3.jsp?idnb=<%= request.getParameter("idnb") %>; charset=UTF-8">
<title>PDF file Generator</title>
</head>
<body onLoad="window.moveTo((screen.availWidth/2)-125,(screen.availHeight/2)-300),window.resizeTo(200,250)">
<BR>
<%
   ISessionBean servoy_hc = (ISessionBean)session.getAttribute("servoy");
   if (servoy_hc == null)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_test");
      session.setAttribute("servoy",servoy_hc);
   }
   boolean ok = servoy_hc.setMainForm("testForm");
   if (!ok)
   {
      out.print("error cannot work on required form");
      return;
   }
   String docID = request.getParameter("docID");
   String idnb = request.getParameter("idnb");
   servoy_hc.executeMethod(null,"genPDF",new Object[]{docID,idnb});
   out.print("<center>PDF file check...</center>");
%>

</body>
</html>

And the line which seems to cause the problem is:
Code: Select all
servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_test");


doc2pdf_test is the solution name
testForm is the form which contains the genPDF method
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby Foobrother » Wed Feb 04, 2009 12:43 pm

I don't know what I changed but now I just got an error in Servoy Server logs:
2009-02-04 10:34 http-8080-1 ERROR com.servoy.j2db.util.Debug Throwable
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at javax.swing.SwingUtilities$SharedOwnerFrame.<init>(Unknown Source)
at javax.swing.SwingUtilities.getSharedOwnerFrame(Unknown Source)
at javax.swing.JDialog.<init>(Unknown Source)
at javax.swing.JDialog.<init>(Unknown Source)
at com.it2be.datastream.mb.<init>(Unknown Source)
at com.it2be.datastream.mb.a(Unknown Source)
at com.it2be.datastream.w.a(Unknown Source)
at com.it2be.common.jc.initialize(Unknown Source)
at com.it2be.datastream.plugin.client.b.initialize(Unknown Source)
at com.servoy.j2db.plugins.PluginManager.initClientPluginsEx(PluginManager.java:82)
at com.servoy.j2db.plugins.PluginManager.initClientPlugins(PluginManager.java:3)
at com.servoy.j2db.server.headlessclient.SessionClient.Zn(SessionClient.java:109)
at com.servoy.j2db.ClientState.applicationInit(ClientState.java:65)
at com.servoy.j2db.server.headlessclient.SessionClient.<init>(SessionClient.java:487)
at com.servoy.j2db.server.headlessclient.HeadlessClientFactory.createSessionBean(HeadlessClientFactory.java:5)
at com.servoy.j2db.server.headlessclient.HeadlessClientFactory.createSessionBean(HeadlessClientFactory.java:7)
at org.apache.jsp.examples.doc2pdf2_jsp._jspService(doc2pdf2_jsp.java:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
2009-02-04 10:34 http-8080-1 ERROR com.servoy.j2db.util.Debug Error ocured initializing plugin: it2be_datastream , error: null

So if I refer to these 2 lines:
at com.servoy.j2db.server.headlessclient.HeadlessClientFactory.createSessionBean(HeadlessClientFactory.java:7)
at org.apache.jsp.examples.doc2pdf2_jsp._jspService(doc2pdf2_jsp.java:78)
it confirms that the problem come from this line in my JSP page:
Code: Select all
servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_test");

But I don't know why :(
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby IT2Be » Wed Feb 04, 2009 2:06 pm

I do know...

If I am correct you have the DataStream settings for the progress dialog so that it will show.
Change the settings and you should be fine...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: HC not working using a separate server

Postby Foobrother » Wed Feb 04, 2009 5:15 pm

IT2Be wrote:I do know...

If I am correct you have the DataStream settings for the progress dialog so that it will show.
Change the settings and you should be fine...

Actually I'm not using it2be Datastream plugin in my program. I have the plugin in my "plugins" folder of Servoy but I don't use it at all in my program.
So I don't know why I get this error :shock:

How do you change the DataStream settings?
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby IT2Be » Wed Feb 04, 2009 6:42 pm

What version of Servoy are you using?
This should not at all be possible in 4.x when you don't register.
In 3.x I can imagine that a call to the Plug-in is made even though it is not used.

You can change the setting in smart client preferences or surpress the dialog using the plug-in settings (have a look at the sample solution and/or the plugin tree).
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: HC not working using a separate server

Postby Foobrother » Thu Feb 05, 2009 10:40 am

I use Servoy 4.1
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby IT2Be » Thu Feb 05, 2009 11:25 am

I think I know what is wrong, there is a call when the plugin is initialized that should not be there.

Can you create a support ticket in our system referring to this post.

We will try to solve this early next week...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: HC not working using a separate server

Postby Foobrother » Mon Feb 16, 2009 6:30 pm

I'm still stuck :(
And now it's not even working on my machine with developer :cry:
I've got new IT2BE errors in servoy_log.txt by the way:
2009-02-16 16:22:55,567 ERROR [Thread-3] com.it2be.components - (No such license file or directory)
2009-02-16 16:22:55,610 ERROR [Thread-3] com.it2be.components - (No such license file or directory)
2009-02-16 16:22:55,614 ERROR [Thread-3] com.it2be.components - Error: Library 'secman.dll' is not available!
2009-02-16 16:22:55,806 ERROR [Thread-3] com.it2be.components - (No such license file or directory)
2009-02-16 16:22:57,235 ERROR [Thread-3] com.it2be.components - (No such license file or directory)
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby Foobrother » Wed Feb 18, 2009 11:03 am

I found why I get these IT2BE errors!

In fact I don't have any license for them. I took the plug-in files from my colleague but I didn't know I needed the license as well.
So I have deleted the plug-in files and now I don't get these errors any more.

However my program is still not working :(
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby IT2Be » Thu Feb 19, 2009 10:40 am

I would dismantle your jsp and go step by step.

This is why I don't like jsp and decided to write my own servlet that handles the request, hands it over to servoy and (when wanted) replies.
Simply to avoid this.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: HC not working using a separate server

Postby Foobrother » Thu Feb 19, 2009 11:31 am

Ok,

So how do you call your servlet?
You do like me, using a showurl()? With an URL like "http:\\myServer:8080\folder\myServlet" ?

:roll:
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby Foobrother » Fri Feb 20, 2009 12:18 pm

By the way I think I've found why my headless client wasn't working.
In fact I didn't clear the "servoy" attribute in the session between each launch. Even when I kicked the headless client from the server using the admin page, it didn't work.
At the end of my program I had to do that:
Code: Select all
session.setAttribute("servoy",null);


Now it seems to work. I generate my pdf in the ROOT directory of Tomcat and redirect the user to the file :D
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby Foobrother » Tue Feb 24, 2009 5:48 pm

I think I'll become crazy!

For some reason now it is not working!
Don't what I've done? I have not changed anything to my code!

So, now it works very well on my laptop using developer. But when I export the solution and import it on a server machine, then try to run the smart client on my laptop, it is stuck!

I have tried to make it as simple as possible. The Smart client is only using one JSP file:
Code: Select all
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import = "java.util.*" %>
<%@ page import = "com.servoy.j2db.server.headlessclient.*" %>
<%@ page import = "com.servoy.j2db.util.*" %>
<%@ page import = "com.servoy.j2db.dataprocessing.IDataSet" %>
<%@ page errorPage="errorpage.jsp" %>
<%
   ISessionBean servoy_hc = (ISessionBean)session.getAttribute("servoy");
   if (servoy_hc == null)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_v2");
      session.setAttribute("servoy",servoy_hc);
      boolean ok = servoy_hc.setMainForm("formv2");
      if (!ok)
      {
         out.print("error cannot work on required form");
         return;
      }
      servoy_hc.executeMethod(null,"genPDF",new Object[]{"241","6543"});
      session.setAttribute("servoy",null);
   }else{
      out.print("Not in if !");
   }
      
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Servoy Headless Client test</title>
</head>
<body>
blablablabalbla
</body>
</html>


As usual the program is stuck at this line: "servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_v2");"

Any suggestion? If you know or have another headless example than the one of Servoy Developer (headless_client_demo).

Cheers :cry:
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: HC not working using a separate server

Postby Harjo » Tue Feb 24, 2009 11:46 pm

did you choose the option: headless client files
when you installed Servoy on this server?
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: HC not working using a separate server

Postby Foobrother » Wed Feb 25, 2009 10:36 am

Harjo wrote:did you choose the option: headless client files
when you installed Servoy on this server?

No, I've installed the headless client example only on my laptop (machine where I use developer).
On the server, I've not installed this "module".
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Next

Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 3 guests