HC not working using a separate server

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:

<%@ 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)">


<% 
	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:

servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_test");

doc2pdf_test is the solution name
testForm is the form which contains the genPDF method

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.(Unknown Source)
at java.awt.Frame.(Unknown Source)
at java.awt.Frame.(Unknown Source)
at javax.swing.SwingUtilities$SharedOwnerFrame.(Unknown Source)
at javax.swing.SwingUtilities.getSharedOwnerFrame(Unknown Source)
at javax.swing.JDialog.(Unknown Source)
at javax.swing.JDialog.(Unknown Source)
at com.it2be.datastream.mb.(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.(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:

servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_test");

But I don’t know why :(

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…

IT2Be:
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?

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).

I use Servoy 4.1

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…

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)

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 :(

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.

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:

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: ```
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 <img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" />

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:

<%@ 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:

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

Harjo:
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”.

I’ve got some news.

Because of Harjo’s question, I’ve re-installed Servoy on the server with the headless client sample option ticked.
Then, I’ve tried again my solution, running the client from my laptop, but same result :(
So I’ve tried to run it on the server using Developer on the server, and it doesn’t work as well. However it works using developer on my laptop. :roll:

It means that there is definitely something wrong with the server :cry:

Another update!

Now I’ve setup the Servoy Application Server on my laptop and run the client on the Server machine: it worked!
So, the server has something wrong somewhere :?

And I don’t really see any difference between my laptop and the server machine, except that the laptop is running under Vista and the server under Windows server 2003.
Servoy version is exactly the same (same installer file). I’ll try to re-install it again on the server machine, with every option ticked to see if there is any difference :roll:
Otherwise I’ll have to wipe it and start from scratch :(

in the past, you needed to install the java JDK instead of the JRE to make the headless client work, because of some tools.jar.
Maybe this is still the case?

I’m not sure…

look here: viewtopic.php?f=25&t=5193&p=25944

Yesterday I’ve tried to uninstall the JRE, then install the JDK (with the JRE option).
But it still didn’t work. So I have uninstall everything again and reinstall the JDK without the JRE option.
But it still didn’t work. :cry:

Today I’ll try to wipe the server. And install servoy with all options! (like on my laptop).
Do I need the JRE or the JDK only is enough for Servoy? I not sure but I think in the past I had a Java project where the JDK was needed for the development but then the JRE was need for running it or something like that. :roll:

I’ve just finished to reinstall everything and I get another weird thing: when I checkout solutions in Servoy Developer I don’t have the Headless Client Demo in the list.
I had selected everything in the installation options including the headless client example. :shock:

Another question: on my laptop, which is working fine in Developer and Server mode, I’ve modified my code to work with the database. As a result, the Headless client now makes queries to the database to find which file it has to convert.
This new version is working well using developer. But when I shut it down, start Servoy Application Server service, import the new solution and try it using another machine as client, it gets stuck like when I use the server machine! :(
Exactly the same issue: stuck without any error raised anywhere in any log :evil: