simlu / voxelshop

This is the official repositiory for VoxelShop
https://blackflux.com/node/11
Apache License 2.0
350 stars 66 forks source link

NoClassDefFoundError on linux (mint) and JDK9 and upper. #295

Open piark opened 5 years ago

piark commented 5 years ago

Hello.

Have a problem when running jar on Linux mint with java runtime 10/11

Run ok with Openjdk 8.

Run ok on arch linux with OpenJDK 11.

There is the trace from error.txt.

Thanks.

=================== 2019-03-31 14-24-14

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.MethodInvokingFactoryBean#1' defined in class path resource [com/vitco/app/glue/config.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:591) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) at com.vitco.app.App.main(App.java:89) Caused by: java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel at com.jidesoft.plaf.LookAndFeelFactory.installJideExtension(Unknown Source) at com.jidesoft.plaf.LookAndFeelFactory.installJideExtension(Unknown Source) at com.vitco.app.layout.LayoutLoader.loadLayout(LayoutLoader.java:20) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273) at org.springframework.beans.factory.config.MethodInvokingFactoryBean.doInvoke(MethodInvokingFactoryBean.java:162) at org.springframework.beans.factory.config.MethodInvokingFactoryBean.afterPropertiesSet(MethodInvokingFactoryBean.java:152) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) ... 12 more

simlu commented 5 years ago

MLooks like it is having problems to find the (default) Java look and feel.

You didn't happen to copy the .voxelshop configuration file/folder from another install?

piark commented 5 years ago

Hello,

Yes, folder $HOME/.voxelshop already exists. Removed, same problem. (first capture)

But, that's not explain why it's work with Java 8 runtime but not with Java 11 runtime. (second capture)

Maybe problem with theme management specific for linux/cinnamon when using Java10/11 ? Because it's working with XFCE on arch linux, with java 11 recent jdk.

thanks.

[image: image.png]

[image: image.png]

Le dim. 31 mars 2019 à 16:33, Lukas Siemon notifications@github.com a écrit :

MLooks like it is having problems to find the (default) Java look and feel.

You didn't happen to copy the .voxelshop configuration file/folder from another install?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/simlu/voxelshop/issues/295#issuecomment-478347149, or mute the thread https://github.com/notifications/unsubscribe-auth/Au2LPMIFoBUxz4Y34K6GkWfX6uK_Rh_fks5vcMc0gaJpZM4cUUMc .

piark commented 5 years ago

I may be able to help. I have eclipse installed and the maven with maven compiles and launches. Tell me if you want to activate traces, or other, and how for diagnostics. Thank you.

Le dim. 31 mars 2019 à 17:54, François S. francois.spannaccini@gmail.com a écrit :

Hello,

Yes, folder $HOME/.voxelshop already exists. Removed, same problem. (first capture)

But, that's not explain why it's work with Java 8 runtime but not with Java 11 runtime. (second capture)

Maybe problem with theme management specific for linux/cinnamon when using Java10/11 ? Because it's working with XFCE on arch linux, with java 11 recent jdk.

thanks.

[image: image.png]

[image: image.png]

Le dim. 31 mars 2019 à 16:33, Lukas Siemon notifications@github.com a écrit :

MLooks like it is having problems to find the (default) Java look and feel.

You didn't happen to copy the .voxelshop configuration file/folder from another install?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/simlu/voxelshop/issues/295#issuecomment-478347149, or mute the thread https://github.com/notifications/unsubscribe-auth/Au2LPMIFoBUxz4Y34K6GkWfX6uK_Rh_fks5vcMc0gaJpZM4cUUMc .

simlu commented 5 years ago

@piark Sorry for the late reply. I'm pretty swamped with other work atm and not sure when I'll find time to look at this. Any investigation you could do on your end would certainly be much appreciated!

piark commented 5 years ago

Hello,

in progress, successfull running via sudo ...

i dont know why but with openjdk11 runtime, voxelshop needs root grants to run.

For your information, i dont know where, but something create a folder nammed .profile, on $HOME directory, but this is not a good idea on linux because there is a file with the same name that can be used to manage some system and shell variables when user login into her account.

i continue to tracking the problem, and reporting if i found.

regards.

Le lun. 1 avr. 2019 à 22:06, Lukas Siemon notifications@github.com a écrit :

@piark https://github.com/piark Sorry for the late reply. I'm pretty swamped with other work atm and not sure when I'll find time to look at this. Any investigation you could do on your end would certainly be much appreciated!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/simlu/voxelshop/issues/295#issuecomment-478727043, or mute the thread https://github.com/notifications/unsubscribe-auth/Au2LPATIL8WsVWdoteAlYev06gq8iKOzks5vcmbegaJpZM4cUUMc .

simlu commented 5 years ago

Hello @piark,

Thanks for continuing to investigate. Weird that sudo is required. I'm also not sure what would create a .profile folder. Nothing that the program does explicitly...

Just to make sure I understand correctly: You can not get voxelshop to run with jdk 11 without using sudo at all? Or just on some distribution? Does it crash when you run it without sudo or just produce the error? Other people have run it successfully with jdk 11, so I'm a little confused. Need to find some time to set this up and test I guess....

Cheers, L~

ColonelThirtyTwo commented 5 years ago

I'm getting the error in the OP when I run on Arch Linux using java-11-openjdk. If I switch to JDK8 using sudo archlinux-java set java-8-openjdk/jre it works.

piark commented 5 years ago

Hello,

I have news. Launching with openjdk11 works if I create a new user. Yet I deleted everything that I could delete in the user's folder that I usually use. I think there is something left, but it's not in .profile or in .java or in .cache or in .config, I really do not know where the file or file is failure. I keep looking and I ask java developer friends if they have an idea, for now without success. I launched a ftrace, to have the system calls, there is a small gap between the launch with the user who works and the one that does not work but I did not have the impression that it is the cause. I think it would be nice to have a tool to monitor access to all the files that the jvm but I do not know in java. In any case I'm still trying to find, but I think it's something related to the window manager and users who ran java8 before switching to java11.

In any case it's not normal because eclipse works, and my java application works too (it's an opengl application using glfw).

Regards.

Le mar. 2 avr. 2019 à 04:20, Lukas Siemon notifications@github.com a écrit :

Hello @piark https://github.com/piark,

Thanks for continuing to investigate. Weird that sudo is required. I'm also not sure what would create a .profile folder. Nothing that the program does explicitly...

Just to make sure I understand correctly: You can not get voxelshop to run with jdk 11 without using sudo at all? Or just on some distribution? Does it crash when you run it without sudo or just produce the error? Other people have run it successfully with jdk 11, so I'm a little confused. Need to find some time to set this up and test I guess....

Cheers, L~

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/simlu/voxelshop/issues/295#issuecomment-478817601, or mute the thread https://github.com/notifications/unsubscribe-auth/Au2LPHccnAzS_gMvRHIZIey8fzYDyiltks5vcr6JgaJpZM4cUUMc .

simlu commented 5 years ago

@piark There is a "settings" folder containing a "pref-004.ser" somewhere. Can you try deleting that and see if it works?

gonzarub commented 4 years ago

Hello @simlu ,

I just tried VoxelShop for the first time, and got the very same OP issue. It runs only as sudo, as described before by @piark. BTW the application looks awesome, and very promising for my current needs! Thanks for the great effort so far.

My environment:

VoxelShop 1.8.26 (voxelshop-bin.zip distribution)
Linux Mint 19.1
OpenJDK 11 ("11.0.4" 2019-07-16)
(did I miss something ... ?)

The following is the error:

~/.local/lib/voxelshop$ java -jar ./voxelshop-start.jar 
libpng warning: iCCP: known incorrect sRGB profile

voxelshop-error

~/.voxelshop is not automatically created. Notice the libpng warning, but I don't think it has anything to do.

If executed as sudo, the application runs with some warnings and /root/.voxelshop is created if it didn't exists. Everything in there, including .voxelshop/settings/pref-004.ser you asked to delete in your last response. I copied the /root/.virtualshop dir to my user-home, changed permissions accordingly, but it doesn't fix the problem (i.e. same error if not executed as sudo). The following is the command line output when it actually runs in super-user mode:

$ sudo java -jar ./voxelshop-start.jar 
libpng warning: iCCP: known incorrect sRGB profile
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jidesoft.swing.JideTabbedPane (file:/data/gonzarub/.local/lib/voxelshop/lib/jide-common-3.4.8.jar) to field javax.swing.JTabbedPane.visComp
WARNING: Please consider reporting this to the maintainers of com.jidesoft.swing.JideTabbedPane
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Then I added as suggested: --illegal-access=warn. I'm not a java developer, so I don't know if it could be relevant:

$ sudo java --illegal-access=warn -jar  ./voxelshop-start.jar 
libpng warning: iCCP: known incorrect sRGB profile
WARNING: Illegal reflective access by com.jidesoft.swing.JideTabbedPane (file:~/.local/lib/voxelshop/lib/jide-common-3.4.8.jar) to field javax.swing.JTabbedPane.visComp
WARNING: Illegal reflective access by com.jidesoft.swing.JideTabbedPane (file:~/.local/lib/voxelshop/lib/jide-common-3.4.8.jar) to field javax.swing.JTabbedPane.visComp
WARNING: Illegal reflective access by com.jidesoft.swing.JideTabbedPane (file:~/.local/lib/voxelshop/lib/jide-common-3.4.8.jar) to field javax.swing.JTabbedPane.visComp
WARNING: Illegal reflective access by com.jidesoft.swing.JideTabbedPane (file:~/.local/lib/voxelshop/lib/jide-common-3.4.8.jar) to field javax.swing.JTabbedPane.visComp
WARNING: Illegal reflective access by com.jidesoft.swing.JideTabbedPane (file:~/.local/lib/voxelshop/lib/jide-common-3.4.8.jar) to field javax.swing.JTabbedPane.visComp
WARNING: Illegal reflective access by com.jidesoft.swing.JideTabbedPane (file:~/.local/lib/voxelshop/lib/jide-common-3.4.8.jar) to field javax.swing.JTabbedPane.visComp

Notice that I'm running the jar directly from ~/.local installation, but it doesn't matter if I did a sudo installation (and it was located in /usr/local/lib/voxelshop), or directly from the unzipped binary folder. Result is always the same: it only works with sudo.

I also tried removing the pref-004.ser file, leaving an empty ~/.voxelshop/settings directory, but it didn't help. It seems that the application is not looking for the settings directory where it should (i.e. in the current user's home directory) if not executed as super-user (this is only my guess).

Hope this information helps to clarify the issue. Feel free to ask for any additional trace, or if you want me to try some special debugging mode or configuration to produce more logging data.

Best regards.

follower commented 4 years ago

I think the key message in the original post is:

While researching a different issue I discovered that Voxelshop uses an app framework that lives in com.jidesoft package, which appears to have an Open Source licensed version with source code here:

There is an existing open issue which seems related to this error message:

It mentions the following source comment:

    /**
     * As of Java 10, com.sun.java.swing.plaf.windows.WindowsLookAndFeel is no longer available on macOS thus
     * "instanceof WindowsLookAndFeel" directives will result in a NoClassDefFoundError during runtime. This method
     * was introduced to avoid this exception.
     *
     * @param lnf
     * @return true if it is a WindowsLookAndFeel.
     */
    public static boolean isWindowsLookAndFeel(LookAndFeel lnf) {

Which seems to match Voxelshop's behaviour when I ran it with this version of Java on a Mac:

openjdk 12.0.1 2019-04-16
OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.1+12)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12.0.1+12, mixed mode, sharing)

In the original error report there is also this part which gets a bit lost which confirms the origin of the error somewhat:

Caused by: java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel
at com.jidesoft.plaf.LookAndFeelFactory.installJideExtension(Unknown Source)
at com.jidesoft.plaf.LookAndFeelFactory.installJideExtension(Unknown Source)
at com.vitco.app.layout.LayoutLoader.loadLayout(LayoutLoader.java:20)

So it seems this issue also needs to be worked around Linux? (And an updated version of the framework.)

I was able to run successfully with:

openjdk version "1.8.0_202"
OpenJDK Runtime Environment (build 1.8.0_202-20190206132754.buildslave.jdk8u-src-tar--b08)
OpenJDK GraalVM CE 1.0.0-rc16 (build 25.202-b08-jvmci-0.59, mixed mode)
follower commented 3 years ago

I'm also not sure what would create a .profile folder. Nothing that the program does explicitly...

This is created by the jidesoft framework due to an undocumented default value and non-use of setProfileKey().

See #305 for more details.