Runtime error when deploying a JavaFX application - deployment

I'm trying to deploy a JavaFX app. The app I've been working on is fairly complex and includes several libraries. When I create a jnlp and try to run it I always get a "Runtime error. Click for details" message. Someone suggested I try doing just a simple Hello World app to see if it's an issue with the included libraries. I tried that and I still get the "Runtime error."
Here's the build.xml I'm trying to use.
<project name="App" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpath="C:\Program Files\Java\jdk7\lib\ant-javafx.jar" />
<target name="default">
<fx:deploy width="600" height="400" outdir="${basedir}/dist" outfile="App">
<fx:application name="App" mainClass="${javafx.main.class}"/>
<fx:resources>
<!-- include application jars -->
<fx:fileset dir="${basedir}" includes="*.jar"/>
<fx:fileset dir="${basedir}/lib" includes="*.jar"/>
<fx:fileset dir="${basedir}" includes="app.ini" />
<fx:fileset dir="${basedir}/template" includes="*.template" />
</fx:resources>
<!-- request user level installation -->
<fx:preferences install="false"/>
</fx:deploy>
</target>
</project>
For the Hello World version I just removed the <fx:resources> section.
I run both of them from inside eclipse as an ant task. They both created a dist folder in my project with a .jnlp and a .html file. I then click on the jnlp to run the app and see a small window that has the text, "Runtime error. Click for details.' I click it and get an error window that says, "The application failed to run. There was an error while executing the application. Click 'Details' for more information." I click the 'Details' button and see a Java Console with the following information (HelloWorld version):
Java Plug-in 10.7.2.11
Using JRE version 1.7.0_07-b11 Java HotSpot(TM) 64-Bit Server VM
User home directory = C:\Users\user
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
Match: beginTraversal
Match: digest selected JREDesc: JREDesc[version 1.6+, heap=-1--1, args=null, href=http://java.sun.com/products/autodl/j2se, sel=false, null, null], JREInfo: JREInfo for index 0:
platform is: 1.7
product is: 1.7.0_07
location is: http://java.sun.com/products/autodl/j2se
path is: C:\Program Files\Java\jre7\bin\javaw.exe
args is: null
native platform is: Windows, amd64 [ x86_64, 64bit ]
JavaFX runtime is: JavaFX 2.2.1 found at C:\Program Files\Java\jre7\
enabled is: true
registered is: true
system is: true
Match: ignoring maxHeap: -1
Match: ignoring InitHeap: -1
Match: digesting vmargs: null
Match: digested vmargs: [JVMParameters: isSecure: true, args: ]
Match: JVM args after accumulation: [JVMParameters: isSecure: true, args: ]
Match: digest LaunchDesc: file:/G:/workspaces/JavaProjects/JavaFXHelloWorld/dist/HelloWorld.jnlp
Match: digest properties: []
Match: JVM args: [JVMParameters: isSecure: true, args: ]
Match: endTraversal ..
Match: JVM args final:
Match: Running JREInfo Version match: 1.7.0.07 == 1.7.0.07
Match: Running JVM args match: have:<> satisfy want:<>
CacheEntry[file:/G:/workspaces/JavaProjects/JavaFXHelloWorld/dist/HelloWorld.jnlp]: updateAvailable=false,lastModified=Fri Sep 14 07:13:28 MDT 2012,length=915
I get a nearly identical error when I run the app I'm working on.
I just uninstalled java and then reinstalled the latest SDK. That didn't do anything except may the app use the 64 bit JVM instead of a 32 bit JVM I had installed. The error message stayed the same.
Does anyone know what I'm doing wrong? Is my build script incorrect? Is there a better way to deploy? I don't have to have a jnlp so I'm open to any deploy method. I just need something I can run on a windows machine and possibly a mac.
I've tried googling my problem and I've searched StackOverflow and can't seem to find anything relevent. I might just be using the wrong search terms.
Any help would be greatly appreciated.
Thanks,
Hardy

If you are using netbeans then Right Click on the Project and Go to Project Properties then to Libraries then click on Manage Platform then select the Default Javafx platform then go to JAVAFX tab and then change the JAVAFX SDK location to where your Java fx 2 sdk is and also similarly change the JAVAFX JRE. Hope this will solve your Problem.

I eventually found out that, in my case, this issue was caused by a bug in the jar signing process. The problem is avoided by emptying the Java cache (on Windows, this can be done through the Java control panel). After doing so and rebuilding, the error no longer occurred in my case.
I'm unsure this will fix your problem, though, as you do not appear to do any signing.

Related

Eclipse not passing values from build.xml file to properties file

I have the following line on my app properties file:
app.environment=#ENVIRONMENT#
and this line on my build.xml file:
<filter token="ENVIRONMENT" value="${PILTEnvironment}"/>
and this line on my build_dev.xml:
<property name="PILTEnvironment" value="LOCAL"/>
So, when running the app on Eclipse Version: 2021-06 (4.20.0), Build id: 20210612-2011, app.environment takes "LOCAL" value, as expected,
however, when running the app on Eclipse Version: Oxygen.3a Release (4.7.3a), Build id: 20180405-1200, app.environment takes value of "#ENVIRONMENT#"
What am I missing on Eclipe Oxygen?
Any help would be very appreciated.
Thanks.
Never mind, I figured it out. I was missing my C:/ant folder, now when running the servlet it understands #ENVIRONMENT#.

GWT 2.7.0 superDevMode recompiling (cache.js.gz error)

I am using eclipse to develop a gwt application and recently I migrated from GWT 2.6.0 to 2.7.0. I was always using super dev mode(with built-in jetty) and it worked ok with 2.6. While using superdev mode on 2.7 it has become quite frequent for the linker to not detect the cache.js.gz and it seems like this causes gwt to generate an insane amount of recompiles with a simple refresh(pressing F5 on firefox).
Recently I cleared my Temp folder with ccleaner and I am not sure if this affected the files used for the jetty codeserver. Though normally every time you run a gwt app it generates all the necessary files in the Temp/ folder.
Here is a sample log:
>Super Dev Mode starting up
> workDir: C:\Users\Georgios\AppData\Local\Temp\gwt-codeserver-8575962486520173754.tmp
>GET /recompile/aanwebappv1
>Job com.aan.main.AanWebAppV1_1_9
>starting job: com.aan.main.AanWebAppV1_1_1
>binding: user.agent=gecko1_8
>skipped compile because no input files have changed
0.091s total -- Compile completed
>GET /aanwebappv1/164467EFAF74C025EFC82CAB8189FED3.cache.js
> Sent error page: not found: C:\Users\Georgios\AppData\Local\Temp\gwt-codeserver-8575962486520173754.tmp\com.aan.main.AanWebAppV1\compile-2\war\aanwebappv1\164467EFAF74C025EFC82CAB8189FED3.cache.js.gz
>starting job: com.aan.main.AanWebAppV1_1_5
>GET /recompile/aanwebappv1
>Job com.aan.main.AanWebAppV1_1_10
binding: user.agent=gecko1_8
skipped compile because no input files have changed
> 0.081s total -- Compile completed
> starting job: com.aan.main.AanWebAppV1_1_6
>GET /aanwebappv1/4D923033DA748FA380787E84FE5C58B9.cache.js
>Sent error page: not found: C:\Users\Georgios\AppData\Local\Temp\gwt-codeserver-8575962486520173754.tmp\com.aan.main.AanWebAppV1\compile-2\war\aanwebappv1\4D923033DA748FA380787E84FE5C58B9.cache.js.gz
This [GET/recompile-starting job-Sent error page: not found:] cycle goes on and on generating 30-40 compiles or even more slowing the debugging process greatly...It even happens on the first compile sometimes..Any thoughts-ideas how to fix this?

Running GWT SuperDevMode in IDEA on Win8

I am trying to configure my GWT project to run in SuperDevMode and experience severe problem during server run time.
So, I have working "regular" devMode configuration in Intellij IDEA. Created a new GWT configuration in app-servers list. Set the following values:
[Checked] Super Dev Mode
VM options: -Xmx512m -XX:MaxPermSize=384M
Dev Mode parameters: -bindAddress 0.0.0.0 -port 1234 -workDir d:\projects\myApp\SDV\ -src d:\projects\myApp\src\main\java com.app.MyApp
Made changes to my project's build xml file adding the lines in the end of file:
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<!-- enable source maps -->
<set-property name="compiler.useSourceMaps" value="true" />
Here is the console output on this config run:
workDir: d:\projects\myApp\SDV
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
binding: user.agent=safari
binding: compiler.useSourceMaps=true
binding: locale=en
Compiling module com.app.MyApp
Compiling 1 permutation
Compiling permutation 0...
Source Maps Enabled
Compile of permutations succeeded
Linking into d:\projects\myApp\SDV\com.app.MyApp\compile-1\war\myapp; Writing extras to d:\projects\myApp\SDV\com.app.MyApp\compile-1\extras\myapp
Link succeeded
Compilation succeeded -- 84.458s
Compile completed in 85210 ms
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
[ERROR] unable to create directory: d:\projects\myApp\SDV\com.app.MyApp\compile-1
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.codeserver.CompileDir.mkdir(CompileDir.java:103)
at com.google.gwt.dev.codeserver.CompileDir.create(CompileDir.java:93)
at com.google.gwt.dev.codeserver.Recompiler.makeCompileDir(Recompiler.java:267)
at com.google.gwt.dev.codeserver.Recompiler.compile(Recompiler.java:82)
....
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Process finished with exit code 1
I suspect it maybe Win8 file access permissions problem: cannot create the directory because it wasn't deleted successfully. Both lines in the log above that have this text:
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
are of red color in IDEA (if that has any special meaning).
I unchecked READ_ONLY checkbox in the properties of for the work folder in file explorer, and also run idea64.exe as Admin. Should I somehow run this codeserver compiler "as admin" too? Is it possible?
Also it may be a configuration issue, if it is and somebody can see it from the details below - I would really appreciate the help. Thanks in advance!
UPDATE
Running the superDevMode config with parameter "-noprecompile" gives the same results:
workDir: d:\projects\myApp\sdv
deleting: d:\projects\myApp\sdv\com.app.MyApp\compile-1
Module setup completed in 865 ms
deleting: d:\projects\myApp\sdv\com.app.MyApp\compile-1
[ERROR] unable to create directory: d:\projects\myApp\sdv\com.app.MyApp\compile-1
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.codeserver.CompileDir.mkdir(CompileDir.java:103)
at com.google.gwt.dev.codeserver.CompileDir.create(CompileDir.java:93)
at com.google.gwt.dev.codeserver.Recompiler.makeCompileDir(Recompiler.java:267)
So, definitely looks like file access problem (delete doesn't do its job?). Javadoc to CompileDir.create() method says: "Creates a new compileDir directory structure. The directory must not already exist, but its parent should exist." Seems that it already exists.
I think your configuration is correct. I am using the same parameters (with another portnumber) on my Mac and it works as expected.
The red color of the text:
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
is normal and indicates no problem.
I am not familiar with Windows 8, but would think, that you don't need to run idea.exe with admin rights. I think, uncheck the read-only checkbox should solve your problems.
Another way should be, that you create your workDir directory with Intellij.
File -> New -> directory
(That's what I did).
Ok, so this is fixed now in GWT 2.7.0 by GWT team.
https://code.google.com/p/google-web-toolkit/issues/detail?id=8619
Runs well, even though I can notice the message in the IDE console:
[WARN] unable to delete 'C:\Users\me\AppData\Local\Temp\gwt-codeserver-1341369077945982663.tmp\com.bla.MyAPP\compile-1' (skipped)
[ERROR] unable to create directory: C:\Users\me\AppData\Local\Temp\gwt-codeserver-1341369077945982663.tmp\com.bla.MyAPP\compile-1
Loading Java files in com.bla.MyAPP.
after printing this the IDE continues to run the app server.
Resolving the issue.
I also found that if you are converting your project from GWT 2.6.0 to 2.7.0, you should delete your 2.6.0 run configuration and setup a new one with GWT 2.7.0 defaults.

Run-Jetty-Run (RJR) with Jetty 8 and Servlet 3.0 scanns all JAR files ignoring WebInfIncludeJarPattern in jetty-web.xml

I'm using Servlet 3.0 without any web.xml just using Spring WebApplicationInitializer. When I start the Webapplication with Run-Jetty-Run in eclipse, the JARScanning takes about 40 seconds since it tries to find HandlesTypes annotations in all jars.
Thus, I tried to set the WebInfIncludeJarPattern in the jetty-web.xml (I also tried jetty-context.xml) and put it in the webapp/WEB-INF folder as described in http://wiki.eclipse.org/Jetty/Howto/Avoid_slow_deployment. I also set metadata-complete="true". The content of the jetty-web.xml file is:
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
<Arg>.*/.*foo-api-[^/]\.jar$|./.*bar-[^/]\.jar$|./.*wibble[^/]*\.jar$</Arg>
</Call>
</Configure>
However, the JarScanner still scans all the JAR files. In the debug output I can see, that the jetty-web.xml file is parsed AFTER all the JARScanning is done:
OUTPUT:
2013-08-30 09:09:52.836:DBUG:oejw.WebAppContext:preConfigure o.e.j.w.WebAppContext{/admin2,[file:/C:/....../src/main/webapp/]} with runjettyrun.webapp.RJRWebInfConfiguration#1cdc4a5
......
2013-08-30 09:09:52.979:DBUG:oejw.WebAppContext:preConfigure o.e.j.w.WebAppContext{/admin2,[file:/C:/..../src/main/webapp/]} with org.eclipse.jetty.webapp.WebXmlConfiguration#136f39e
2013-08-30 09:09:53.076:DBUG:oejw.WebDescriptor:file:/C:/......../src/main/webapp/WEB-INF/web.xml: Calculated metadatacomplete = True with version=3.0
2013-08-30 09:09:53.076:DBUG:oejw.WebAppContext:preConfigure o.e.j.w.WebAppContext{/admin2,[file:/C:/....../src/main/webapp/]} with runjettyrun.webapp.RJRMetaInfoConfiguration#164de63
... <LOTS OF JARSCANNING>
2013-08-30 09:10:36.677:DBUG:oejw.JarScanner:Search of file:/C:/......./httpclient-cache-4.1.2.jar
2013-08-30 09:10:36.710:DBUG:oejw.WebAppContext:configure o.e.j.w.WebAppContext{/.................} with org.eclipse.jetty.webapp.JettyWebXmlConfiguration#803365
2013-08-30 09:10:36.711:DBUG:oejw.JettyWebXmlConfiguration:Configuring web-jetty.xml
2013-08-30 09:10:36.715:DBUG:oejw.JettyWebXmlConfiguration:Configure: file:/C:/......./src/main/webapp/WEB-INF/jetty-web.xml
How can I force RJR to pick up the jetty-web.xml earlier and only scan the files specified in there? Or is there any other way in RJR to specify the JARS to be scanned?
I am using following versions: Eclipse: Kepler Release 4.3 Build id: 20130614-0229 RJR: 1.3.3.201301020723 Jetty: 8.1.8.v20121106
WINDOWS: 64 bit
Thank you
Here is a workaround for speeding up Jetty 8 with Servlet 3.x.
Create a file (jetty.xml)
Open the RJR configuration
Click on "Show advanced options"
Additional Jetty.xml:
The file (jetty.xml) must have these lines:
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Get name="handler">
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
<Arg>.*/mwa-web-.*\.jar$</Arg>
</Call>
</Get>
</Configure>
Here, I'm telling Jetty that any file starting with mwa-web-* should be scanned for Servlet 3.x.
Looking through the RJR source code I came across this undocumented flag rjrDisableannotation which speeds up the startup time significantly in all Jetty 8/9/9.3.6 (so far I haven't noticed any unwanted side effects - of course as its name suggests it doesn't scan for annotations anymore).
It can be enabled as a "VM argument" in the "Run/Debug configuration" for a "Jetty Webapp".
e.g.:
-DrjrDisableannotation=true
Here the related source code for reference:
https://github.com/xzer/run-jetty-run/blob/rjr1.3.4/Jetty8Support/plugin-jetty8/bootstrap/runjettyrun/Configs.java#L210-L212

Eclipse run error

When i try to run my code on Eclipse this error appears:
Usage: javaw [-options] class [args...]
(to execute a class)
or javaw [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
-hotspot is a synonym for the "server" VM [deprecated]
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
i try to coment my entired code and this error still appear.
It seems you haven't set your java path correctly.
Setting Up Eclipse with Java 1.6 on Windows
How To Install and Get Started with Java Programming
Run eclipse in clean mode
Edit the eclipse.ini file located in your Eclipse install directory and insert -clean as the first line.
If this is happening to a specific project only and other projects are running fine then your default run configuration might have changed. You may try the following
- Run -> Run As -> 1 Java Application.
I fixed this issue by deleting some of my old runtime configurations. Eclipse then started automatically generating them again.