simlu / voxelshop

This is the official repositiory for VoxelShop

Home Page:https://blackflux.com/node/11

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoClassDefFoundError on linux (mint) and JDK9 and upper.

piark opened this issue · comments

commented

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

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?

commented
commented

@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!

commented

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~

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.

commented

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

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.

I think the key message in the original post is:

  • nested exception is java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel

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)

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.