java web start application unable to launch on java7u45 - java

After the upgrade to java7u45 from java7u21 , there have been a lot of security related changes done.
So first there were warnings related to missing attributes in manifest files. Fixed it by following previously provided solution .
Permissions: all-permissions
Codebase: *
Application-Name: My Name
Added the attributes to the MANIFEST file and re-signed them all.
Now when I launch the application using my jnlp file, it gives following error on this particular jar
Error: Unable to load resource
http://<path>/org.eclipse.core.filesystem.win32.x86_<version>.jar
java.io.IOException: Invalid signature file digest for Manifest main attributes
at com.sun.deploy.cache.CacheEntry$10.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.cache.CacheEntry.writeFileToDisk(Unknown Source)
at com.sun.deploy.cache.CacheEntry.writeFileToDisk(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Verified the manifest file for this jar for missing attributes and signed it again. But same error .
Any pointers ?

This org.eclipse*.jar and some other eclipse jar files have their own Signature Files (ECLIPSEF.SF) in the META-INF/ directory.
Since this extra SF file still has the SHA-DIGEST of the previous MANIFEST main attributes(which were now changed) , the plugin is failing to load.
Remove these and other signature files from all the plugins and re-sign them. :-)

Related

Building java exe file with launch4J has error : "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/persistence/NoResultException

I'm trying to produce a .exe file from my application.
It works correctly on Netbeans but I can't generate the .exe file.
this is the error:
Blockquote
Executing: D:\dev\tools\stock_exchange\stock_exchange\src\App\MarketSimulator.exe
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/persistence/NoResultException
at org.stock.simulator.view.Home.<init>(Home.java:28)
at org.stock.simulator.view.Home$11.run(Home.java:822)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.persistence.NoResultException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
This is my library structure:
Thanks for your help
This error means that your .exe can't find the class.
This is probably due to the way you exported your project as a runnable JAR.
There are a couple of ways to export to a runnable JAR, but you can for example :
Export the project with the libraries in a separate folder next to your JAR
--> Easy to replace library versions, but not the cleanest or most portable solution. Since you always have to include a separate folder with your .exe
Export the project with the libraries extracted into your JAR
--> This is more portable than 1., but can possible create a lot packages and source code within the JAR
Export the project with the libraries packaged into your JAR
--> This is more portable than 1. and allows for an easier library replace than 2.
Since both option 2 and 3 have the necessary libraries included within the JAR, I would think that you have used something like option1.
If you add the necessary libraries in the same folder as the generated .exe, it should execute correctly.
If this doesn't explain your problem or you went with a different approach,
then please update your question with the necessary information and we'll help you further.

Modify org.eclipse.jdt.core.dom.ASTPArser

I need to modify org.eclipse.jdt.core.dom.ASTParser class which is in jdt.core jar file. So I created a java project and I created the same package (org.eclipse.jdt.core.dom). but when I want to create a new instance of this class I get this error:
Exception in thread "main" java.lang.SecurityException: class
"org.eclipse.jdt.core.dom.ASTParser2"'s signer information does not
match signer information of other classes in the same package at
java.lang.ClassLoader.checkCerts(Unknown Source) at
java.lang.ClassLoader.preDefineClass(Unknown Source) at
java.lang.ClassLoader.defineClass(Unknown Source) at
java.security.SecureClassLoader.defineClass(Unknown Source) at
java.net.URLClassLoader.defineClass(Unknown Source) at
java.net.URLClassLoader.access$100(Unknown Source) at
java.net.URLClassLoader$1.run(Unknown Source) at
java.net.URLClassLoader$1.run(Unknown Source) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
typeResolution.TypeResolution.main(TypeResolution.java:80)
When I run my code in a plugin mode project I don't have problem, but in a java stand alone project I am getting this error.
Can anyone give me insight into this problem? Thanks.
The original artifact org.eclipse.jdt.core_xyz.jar is signed. When you try to use that jar in combination with your own modified class the JVM will detect that the integrity of the signed jar is broken.
You have two options:
instead of replacing just one file, replace the entire jar with your
own version
re-package the original jar without signing
Depending on your configuration there may be more ripples, because other plug-ins like org.eclipse.jdt.compiler.tool contribute classes to packages that also exist in org.eclipse.jdt.core ("split packages"), which is OK only if both jars are signed by with the same certificate - or not signed at all.

Applet throws ClassNotFoundException after signing & updating manifest

I have jar file located exactly inside at /Test2XML/applets/ with name MyIPFetcher.jar. I am trying to make this jar compatible to run on IE8 + IE11 & JRe 1.6 + 1.7.
MyIPFetcher.jar is trying to obtain the IP address of client PC's.
PS: IP address & URL is changed for security reason.
Permissions: all-permissions
Codebase: https://fakeurl/Test2XML/applets/ 123.23.43.45
Application-Name: IPFetcher Application
Application-Library-Allowable-Codebase: https://fakeurl/Test2XML/applets/ 123.23.43.45
Caller-Allowable-Codebase: https://fakeurl/Test2XML/applets/ 123.23.43.45
network: Connecting https://fakeurl/Test2XML/applets/MyIPFetcherApplet/com/IPFetcher/west/logger/ClientLogger.class with cookie "WSIDCookie=AB01; JSESSIONID=0000R29UDciJ8GvaOYcxlkRLka0:16s8ng4ps; BrowserCount=1"
java.lang.ClassNotFoundException: com.IPFetcher.west.logger.ClientLogger
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
basic: load: class com.IPFetcher.west.logger.ClientLogger not found.
java.lang.ClassNotFoundException: com.IPFetcher.west.logger.ClientLogger
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Ignored exception: java.lang.ClassNotFoundException: com.IPFetcher.west.logger.ClientLogger
basic: Dialog type is not candidate for embedding
Any suggestion why it is throwing this error ?
JVM is unable to load your ClientLogger class
Check whether your classpath contains that jar and if your classpath doesn't contain the jar then just add that class in your classpath

javafx running application outside Netbeans IDE

I'm having trouble running a javaFX application through the .jar in the "dist folder" later that I have clean and build project by NetBeans.
C:\NetBeansProjects\Gestore\dist>java -jar
Gestore.jar
log4j:ERROR Could not read configuration file [conf\log4j.properties].
java.io.FileNotFoundException: conf\log4j.properties (Impossibile trovare il per
corso specificato)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurato
r.java:372)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.
java:403)
at gestore.Gestore.<init>(Gestore.java:97)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherIm
pl.java:276)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:
47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Unknown Source)
log4j:ERROR Ignoring configuration file [conf\log4j.properties].
log4j:WARN No appenders could be found for logger (gestore.Utility).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.javafx.main.Main.launchApp(Main.java:642)
at com.javafx.main.Main.main(Main.java:805)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherIm
pl.java:403)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:
47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.SecurityException: class "javafx.scene.control.Dialogs"'s s
igner information does not match signer information of other classes in the same
package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at gestore.Gestore.loadEserciziFromDB(Gestore.java:407)
at gestore.Gestore.start(Gestore.java:178)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:215)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179
)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176
)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29
)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
... 1 more
But if I run project from netBeans everything works perfectly. And if I try (later to run in NetBeans) to launch application from dist folder everything work perfectly. In fact
C:\NetBeansProjects\Gestore\dist>java -jar
Gestore.jar
log4j:ERROR Could not read configuration file [conf\log4j.properties].
java.io.FileNotFoundException: conf\log4j.properties (Impossibile trovare il per
corso specificato)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurato
r.java:372)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.
java:403)
at gestore.Gestore.<init>(Gestore.java:97)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherIm
pl.java:276)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:
47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Unknown Source)
log4j:ERROR Ignoring configuration file [conf\log4j.properties].
log4j:WARN No appenders could be found for logger (gestore.Utility).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
So I think that problem is caused by Java.Lang.SecurityException (yes I know there is a problem with log4j properties), and maybe here https://github.com/marcojakob/javafx-ui-sandbox/issues/5 there is a solution, but why??
What the problem is
The javafx-ui-sandbox project you link to is obsolete and incompatible with later JavaFX versions under some circumstances.
How to fix it
I advise using ControlsFX instead. ControlsFX has all of the functions of the javafx-ui-sandbox (and more) and is built so that it does not clash with JavaFX system classes. It is also a much more actively maintained and developed project.
If you cannot use the minimum Java 8 version required for the latest version of ControlsFX, there used to be a ControlsFX 2.x backport, but it no longer has any relevant content.
Long and unnecessary explanation follows
javafx-ui-sandbox was a prototyping system that includes classes which clash with classes included in some Java distributions - which is why you get:
Caused by: java.lang.SecurityException: class "javafx.scene.control.Dialogs"'s
signer information does not match signer information of other classes
in the same package.
What is happening here is that you are including a javafx-ui-sandbox class (javafx.scene.control.Dialogs) in your a jar and signing it (probably you are using NetBeans and have the checkbox to self-sign jars switched on, but there are other ways you could be signing). So you are signing your jars with a different certificate than Oracle used to sign the JavaFX jars. The JavaFX jars include the bulk of the code in the javafx.scene.control package. As part of some obscure rule of Java, you can't sign code in the same package with two different certificates or it will generate a security exception.
Likely you don't see the issue when you are executing within NetBeans because you aren't signing your application to execute it within the development environment, but when you build the jar file you are executing, you are also signing the jar file, at which point the jar won't work.
The easy fix for you is just to copy the javafx-ui-sandbox source into your project and change the package name from javafx.scene.control to something else (e.g. com.yourcompany.control). That way the class packages won't clash with the default packages provided for the JavaFX system and you can sign your code (including the com.yourcompany.control.Dialogs class) without causing any issues. But again, you are probably better off using the ControlsFX library instead.

java applet won't work

this is homework stuff, but the question is not much about coding. the task is to write a java applet to work on an m-grid server. i have the server running on apache. it has a few sample applets in .jar and .class form. the .class versions work; the .jar versions work on appletviewer, but they break if I submit them as a job to the server with this:
load: class examples/pixelcount/PixelCount.class not found.
java.lang.ClassNotFoundException: examples.pixelcount.PixelCount.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Exception: java.lang.ClassNotFoundException: examples.pixelcount.PixelCount.class
I'm not really sure where exactly is the problem in here, given that they work on appletviewer. any help would be appreciated..
EDIT:
don't know if I wrote it clearly. by ".class version" i refer to html file with this content:
<applet height="300" width="450" code="examples/pixelcount/PixelCount.class"></applet>
and ".jar" with this content:
<applet height="300" width="450" archive="PixelCount.jar" code="examples.pixelcount.PixelCount.class"></applet>
EDIT2:
the mentioned example jar file can be found here
It can't find the file PixelCount.class, its not in the directory examples/pixlecount that's why this error is happening.
The PixelCount class is not packaged in your jar I think.
And as the error is Caused by: java.net.ConnectException: Connection refused: connect it might be that it tried to obtain that class from the net somewhere, and the location does not match or a proxy is in between.
EDIT
You do have the archive someplace the m-server, whatever that may be, can find it? See the Java Applet Tag ref. docs. You may need something like
CODEBASE = codebaseURL
This OPTIONAL attribute specifies the base URL of the applet--the directory
that contains the applet's code. If this attribute is not specified, then the
document's URL is used.
The CODE is relative to the base URL of the document which holds the applet tag. If you want to override that you might need that CODEBASE parameter.
Don't include the .class extension in the code attribute.
examples.pixelcount.PixelCount is the name of the class.
examples.pixelcount.PixelCount.class is the name of the file that contains the class.
The code attribute should read
code="examples.pixelcount.PixelCount"

Categories