Categories

  • articles

Tags

  • java

I have a very old project still running on Jboss 6 AS, it has been on the TODO list to write but since it is of low importance, only used internally and it just works.

After upgrading to Java 8 the following errors started to appear in eclipse.

Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: securityRules
	at org.jboss.seam.Component.newInstance(Component.java:2170) [:2.2.2.Final]
	at org.jboss.seam.Component.getInstance(Component.java:2024) [:2.2.2.Final]
	at org.jboss.seam.Component.getInstance(Component.java:1986) [:2.2.2.Final]
	at org.jboss.seam.Component.getInstance(Component.java:1980) [:2.2.2.Final]
	at org.jboss.seam.security.permission.RuleBasedPermissionResolver.initSecurityContext(RuleBasedPermissionResolver.java:68) [:2.2.2.Final]
	at org.jboss.seam.security.permission.RuleBasedPermissionResolver.create(RuleBasedPermissionResolver.java:60) [:2.2.2.Final]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.8.0_45]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [:1.8.0_45]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.8.0_45]
	at java.lang.reflect.Method.invoke(Method.java:497) [:1.8.0_45]
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [:2.2.2.Final]
	at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [:2.2.2.Final]
	at org.jboss.seam.Component.callComponentMethod(Component.java:2275) [:2.2.2.Final]
	at org.jboss.seam.Component.callCreateMethod(Component.java:2198) [:2.2.2.Final]
	at org.jboss.seam.Component.newInstance(Component.java:2158) [:2.2.2.Final]
	... 53 more
Caused by: java.lang.RuntimeException: wrong class format
	at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:260) [:5.0.1]
	at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:204) [:5.0.1]
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:97) [:]
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [:]
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:101) [:]

This is due to a bug in Drools, more specifically the Eclipse compiler which is the default. For more info see the JIRA : DROOLS-329

Now the quick fix is just to use the old Compiler 1.7 or older. This is different to setting the compliance level. This is done in eclipse:

Window -> Preferences

Server -> Runtime Environment

Select the Runtime environment, in my case Jboss 6.x Runtime, click Edit and select the radio button “Alternative JRE”.