pmd/pmd-eclipse-plugin

Unable to create the selected preference page

andipabst opened this issue · 6 comments

When opening the preferences, I get an error saying Unable to create the selected preference page.

My PMD Plug-in Version is 4.11.0.v20200312-1712. It was freshly installed into eclipse 2019-06 (4.12.0) this morning.

eclipse.buildId=4.12.0.I20190605-1800
java.version=1.8.0_152
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data file:/C:/Users/andipabst/eclipse-workspace/ -product org.eclipse.epp.package.jee.product
org.eclipse.equinox.registry
Error
Mon Mar 16 08:46:15 CET 2020
Unable to create the selected preference page.
java.lang.ClassNotFoundException: An error occurred while automatically activating bundle net.sourceforge.pmd.eclipse.plugin (971).
	at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:126)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:570)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:330)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:396)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:474)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:423)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:415)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:155)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:620)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:196)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:934)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63)
	at org.eclipse.ui.internal.WorkbenchPlugin.lambda$0(WorkbenchPlugin.java:288)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:55)
	at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:286)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition$1.run(LightweightDecoratorDefinition.java:123)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.internalGetDecorator(LightweightDecoratorDefinition.java:119)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:237)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:105)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:360)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:346)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:333)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:300)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.osgi.framework.BundleException: Exception in net.sourceforge.pmd.eclipse.plugin.PMDPlugin.start() of bundle net.sourceforge.pmd.eclipse.plugin.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:863)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:791)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1013)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:365)
	at org.eclipse.osgi.container.Module.doStart(Module.java:598)
	at org.eclipse.osgi.container.Module.start(Module.java:462)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:493)
	at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:117)
	... 27 more
Caused by: java.lang.IllegalStateException: FileNamePattern [C:/Users/andipabst/pmd-eclipse.log.%i] does not contain a valid IntegerToken
	at ch.qos.logback.core.rolling.FixedWindowRollingPolicy.start(FixedWindowRollingPolicy.java:93)
	at net.sourceforge.pmd.eclipse.logging.internal.LogbackConfiguration.configureLogs(LogbackConfiguration.java:94)
	at net.sourceforge.pmd.eclipse.logging.internal.LogbackConfiguration.applyLogPreferences(LogbackConfiguration.java:127)
	at net.sourceforge.pmd.eclipse.plugin.PMDPlugin.start(PMDPlugin.java:247)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:842)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:834)
	... 34 more

That's about the log settings. Can you share the following file from your workspace? .metadata/.plugins/org.eclipse.core.runtime/.settings/net.sourceforge.pmd.eclipse.plugin.prefs

You should be able to get back to a working state with the following steps:

  1. exit eclipse
  2. modify .metadata/.plugins/org.eclipse.core.runtime/.settings/net.sourceforge.pmd.eclipse.plugin.prefs in your workspace: remove the property "net.sourceforge.pmd.eclipse.plugin.log_filename"
  3. start eclipse
  4. configure the filename to log to again via the preferences

There is no such file in my workspace. This error occurred when I first tried to open the settings, so I could never change them in any way.

Did you create a new workspace or reused an existing one? Do you use oomph? Do you have a file "C:/Users/andipabst/.eclipse/org.eclipse.oomph.setup/setups/user.setup"?

I tried it with an existing and a new workspace, the problem occurs both times. I did not (knowingly) use oomph. Yes, such a file is present, it contains a couple of <acceptedLicense> fields. I attached the file (renamed to .txt, since GitHub would not allow me to upload .setup files).

user.setup.txt

Here's the default value for the preference:

String LOG_FILENAME_DEFAULT = System.getProperty("user.home") + "/pmd-eclipse.log";

I found where the ".%i" comes from:

That would mean, there are some incompatible logback version in your eclipse installation. I'm using eclipse 2019-12 (4.14.0) and have no problems...

I upgraded eclipse to 2019-12 (4.14.0) as well, now the error is gone. So apparently it seems to have been the logback version. Thanks for your quick help.