Skip to main content
1-Visitor
October 28, 2016
Question

PDFExport not working on Red Hat Linux

  • October 28, 2016
  • 4 replies
  • 13569 views

I have installed the PDFExport extension on Thingworx 7.2.4 on my local machine (Windows 10, Tomcat 8), then it works perfectly.

But when I installed on the our production server (Thingworx 7.2.4, Red Hat Linux, Tomcat 8), then createPDF service of the extension remain busy and never ends up ... there is no entry in Application log...

I've created openings inward to the server on ports 10000-10007, but no effects.


I've created my own extension to generate simple pdf, that extension works and generates pdf file and saves the file into a FileRepository. So there is no issue of creating files on the server.


Could you help me to use the PDFExport extension on our production server?



4 replies

5-Regular Member
November 2, 2016

Do you see any errors in the Application logs when you try to export in your production server?

19-Tanzanite
November 3, 2016

Hi Mahboob,

I am the creator of the PDF Extension, and I was just made aware of your issue.

Could you help me by telling me if in your extension you used the getRootPath() method of the FileRepository in order to construct the path for the saved the generated PDF there?

Main thing would be, as Tori asked, to understand if there are any errors in the Application Log - also you might want to check the Tomcat logs as well.

Waiting for your answer on this.

Thanks

Vladi

mkhalid11-VisitorAuthor
1-Visitor
November 3, 2016

Hi Vladimir,

Thank you for your attention. We are using RHEL on our production server, Tomcat 8 and OpenJdk 8.

I don't find any error line in Application log, because the service CreatePDF never completes (remains in executions).

But I found some lines in Tomcat log, see below. It may indicate the problem..??  BTW, when I installed the PDFExtension in Thingworx on Windows 10. Then createPDF works and it can access to the same Mashup of production server.

-------------------------------------------------------------------- Log lines of Tomcat on our production server -----------------------------------

RHINO USAGE WARNING: Missed Context.javaToJS() conversion:

Rhino runtime detected object {mgL=com.thingworx.types.primitives.IntegerPrimitive@3c316fad, TF_Water_PH=com.thingworx.types.primitives.NumberPrimitive@4ee34917, TF_Water_COND=com.thingworx.types.primitives.NumberPrimitive@7c384

ea7, TF_Water_WT=com.thingworx.types.primitives.NumberPrimitive@66dfd097, fetchTimestamp=com.thingworx.types.primitives.DatetimePrimitive@51a497e6, TF_Water_DO=com.thingworx.types.primitives.NumberPrimitive@5dbc734, TF_Water_ORP

=com.thingworx.types.primitives.NumberPrimitive@3b28ec5e} of class com.thingworx.types.collections.ValueCollection where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.java

ToJS() call.

[Port 10002] Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/webkit/network/CookieManager

[Port 10002]    at com.machinepublishers.jbrowserdriver.JBrowserDriverServer.main(JBrowserDriverServer.java:70)

[Port 10002] Caused by: java.lang.ClassNotFoundException: com.sun.webkit.network.CookieManager

[Port 10002]    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

[Port 10002]    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

[Port 10002]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

[Port 10002]    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

[Port 10002]    ... 1 more

RHINO USAGE WARNING: Missed Context.javaToJS() conversion:

Rhino runtime detected object {Precipitation=com.thingworx.types.primitives.NumberPrimitive@106da9f3, mgL=com.thingworx.types.primitives.IntegerPrimitive@6e2289f7, TF_Water_PH=com.thingworx.types.primitives.NumberPrimitive@68404

55c, Weather_Temperature=com.thingworx.types.primitives.NumberPrimitive@23cec989, Symbol=Sun, SymbolNumber=com.thingworx.types.primitives.NumberPrimitive@6bc455e4, TF_Water_WT=com.thingworx.types.primitives.NumberPrimitive@62ccd

0b9, fetchTimestamp=com.thingworx.types.primitives.DatetimePrimitive@15953b02, TF_Water_DO=com.thingworx.types.primitives.NumberPrimitive@6f026576, TF_Water_ORP=com.thingworx.types.primitives.NumberPrimitive@582b76f} of class co

m.thingworx.types.collections.ValueCollection where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.

[Port 10003] Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/webkit/network/CookieManager

[Port 10003]    at com.machinepublishers.jbrowserdriver.JBrowserDriverServer.main(JBrowserDriverServer.java:70)

[Port 10003] Caused by: java.lang.ClassNotFoundException: com.sun.webkit.network.CookieManager

[Port 10003]    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

[Port 10003]    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

[Port 10003]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

[Port 10003]    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

[Port 10003]    ... 1 more

RHINO USAGE WARNING: Missed Context.javaToJS() conversion:

Rhino runtime detected object {Precipitation=com.thingworx.types.primitives.NumberPrimitive@2cddc2c4, mgL=com.thingworx.types.primitives.IntegerPrimitive@54f42dfd, TF_Water_PH=com.thingworx.types.primitives.NumberPrimitive@57b52271, Weather_Temperature=com.thingworx.types.primitives.NumberPrimitive@45784ab7, Symbol=Sun, SymbolNumber=com.thingworx.types.primitives.NumberPrimitive@7d3e55ee, TF_Water_WT=com.thingworx.types.primitives.NumberPrimitive@5ecae326, fetchTimestamp=com.thingworx.types.primitives.DatetimePrimitive@6233fc6c, TF_Water_DO=com.thingworx.types.primitives.NumberPrimitive@17ddae12, TF_Water_ORP=com.thingworx.types.primitives.NumberPrimitive@6905a032} of class com.thingworx.types.collections.ValueCollection where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.

[Port 10004] Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/webkit/network/CookieManager

[Port 10004]    at com.machinepublishers.jbrowserdriver.JBrowserDriverServer.main(JBrowserDriverServer.java:70)

[Port 10004] Caused by: java.lang.ClassNotFoundException: com.sun.webkit.network.CookieManager

[Port 10004]    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

[Port 10004]    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

[Port 10004]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

[Port 10004]    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

[Port 10004]    ... 1 more

19-Tanzanite
November 7, 2016

Hi Mahboob,

Can you see if you have you're using the openJDK - which is not compatible with ThingWorx - it's in the documentation. You should use the Oracle JVM

BR,

Vladimir

1-Visitor
November 8, 2016

We get a NoClassDefFound error when code is compiled with an incompatible version of the class found at runtime. The specific instance I recall is with the apache axis library. There were actually 2 versions on my runtime classpath and it was picking up the out of date and incompatible version and not the correct one, causing a NoClassDefFound error.

There could be numerous other reasons , however from the explanation of the issue , it seems to be most appropriate.

mkhalid11-VisitorAuthor
1-Visitor
November 23, 2016

I have updated Oracle JDK and it has ext/jfxrt.jar. Now I get the following error:

Unable to Invoke Service CreatePDF on PDFExport : Not on FX application thread; currentThread = RMI TCP Connection(2)-10.39.21.4

Even I have created log4j.properties file in lib directory, but I see the following lines in catalina.out file

------------- In catalina.out ------------------

[Port 10000] log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).

[Port 10000] log4j:WARN Please initialize the log4j system properly.

[Port 10000] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

1-Visitor
May 3, 2017

Hello, I'm trying the new version of PDFExport (March 2017) and I have the same error. Could you get it to work ?

19-Tanzanite
January 9, 2017

Hey guys,

Happy New Year!

I have seen that the Extension throws this error on the latest Java Runtime - it used to work in the past.

When there's any issue with a ThingWorx Labs extension, we can give the source code the extension so that whoever wants can debug/modify it.

That's was the original intention of the extensions, and while we mention the "no support" in the Author page for the extension, it doesn't clearly states we can deliver the source code.

Would this be ok for you?

Best regards,

Vladimir

1-Visitor
May 3, 2017

Hi Vladimir Rosu,

I had the same problem with the new version of March 2017.

When I execute the service CreatePDF from the Composer, there's an error:

Unable to Invoke Service CreatePDF on PDFExport : Could not launch browser. Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43' System info: host: 'ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-21-generic', java.version: '1.8.0_92' Driver info: driver.version: JBrowserDriver

 

The error in Logs Application:

[context: com.thingworx.webservices.context.HttpExecutionContext@75ac754e][message: Unable to Invoke Service CreatePDF on PDFExport : Could not launch browser.

 

The error in Tomcat (catalina.out):

java.lang.NoClassDefFoundError: com/sun/webkit/network/CookieManager

      at com.machinepublishers.jbrowserdriver.JBrowserDriverServer.main(JBrowserDriverServer.java:74)

Caused by: java.lang.ClassNotFoundException: com.sun.webkit.network.CookieManager

      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

      ... 1 more

 

Based on this issue (Linux: can not start the driver · Issue #186 · MachinePublishers/jBrowserDriver · GitHub), I tried to install the package "openjfx" but it doesn't resolve the problem.

I tried to replace some .jar in the widget with new version ones but it doesn't work.

Do you have an idea how I can resolve this issue ?

Best regards,

Quang-Dung

19-Tanzanite
May 3, 2017

Hi Quang-Dung,

I've just tested this version on an CentOS 6.4 machine, with ThingWorx 7.4 and it worked ok with the standard install of the java runtime.

As said before, we are open to give you the source code of the extension to have a starting point if you decide to debug it or to do any modifications to it.

The usecase of the extension is that it saves a whole mashup in a PDF file. If you want to save parts of the mashup, then you can either modify the extension, or provide those areas as separate mashups or, of course, build your own extension.

Later edit: on linux there's a single issue manifesting in the fact that the path separator that I use in the code is wrong, so the created file is "SystemRepository\\name.pdf".

It still creates the file and it can be viewed.

Best regards,

Vladimir