javadroolsseam2

seam-2.2.2 java 8 drools update


I have to compile and run a seam-2.2.2 app in java 8 environment. Everything works fine, except seam identity management. This seems to be relate to Drools from seam-2.2.2

when I run the seam app in java 8 environment, this following exception is raised org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.ruleBasedPermissionResolver

Excluding drools form the app, no more exception. The seam app is working correctly. The exception is not raised in java 5 environment.

Any idea how to fix this problem?

Thanks

kem

Session event listener threw exception
org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.ruleBasedPermissionResolver
    at org.jboss.seam.Component.newInstance(Component.java:2170)
    at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
    at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
    at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:233)
    at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:182)
    at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:46)
    at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:397)
    at org.apache.catalina.session.StandardSession.setId(StandardSession.java:369)
    at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:828)
    at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:291)
    at org.apache.catalina.connector.Request.doGetSession(Request.java:2312)
    at org.apache.catalina.connector.Request.getSession(Request.java:2075)
    at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
    at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:844)
    at org.jboss.seam.web.IdentityRequestWrapper.<init>(IdentityRequestWrapper.java:23)
    at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: securityRules
    at org.jboss.seam.Component.newInstance(Component.java:2170)
    at org.jboss.seam.Component.getInstance(Component.java:2024)
    at org.jboss.seam.Component.getInstance(Component.java:1986)
    at org.jboss.seam.Component.getInstance(Component.java:1980)
    at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
    at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
    at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148)
    at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
    at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
    at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
    at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:156)
    at org.jboss.seam.Component$ELInitialValue.getValue(Component.java:2557)
    at org.jboss.seam.Component.initialize(Component.java:1530)
    at org.jboss.seam.Component.postConstructJavaBean(Component.java:1456)
    at org.jboss.seam.Component.postConstruct(Component.java:1379)
    at org.jboss.seam.Component.newInstance(Component.java:2155)
    ... 52 more
Caused by: java.lang.RuntimeException: wrong class format
    at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:260)
    at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:204)
    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)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1264)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromVariantTypeSignature(LookupEnvironment.java:1316)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeArgumentsFromSignature(LookupEnvironment.java:1107)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1269)
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createFields(BinaryTypeBinding.java:356)
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:332)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:719)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:699)
    at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:294)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:102)
    at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:101)
    at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.resolve(ParameterizedTypeBinding.java:835)
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:117)
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTypesFor(BinaryTypeBinding.java:916)
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getExactMethod(BinaryTypeBinding.java:715)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:771)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getMethod(Scope.java:2106)
    at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:432)
    at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:344)
    at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:882)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:444)
    at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:191)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:403)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1096)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1184)
    at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:535)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:743)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
    at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
    at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
    at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
    at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
    at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
    at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690)
    at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:653)
    at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:278)
    at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:80)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
    at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
    at org.jboss.seam.Component.callCreateMethod(Component.java:2198)
    at org.jboss.seam.Component.newInstance(Component.java:2158)
    ... 68 more
Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
    at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:369)
    at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:254)
    ... 119 more

Solution

  • I think what's happening here is that some Java code from seams (and your app) is compiled using a java 8 compiler. Then org.drools.compiler.PackageBuilder is called to compile some DRL. This will, eventually, call a Java compiler to compile the Java code generated from the DRL. For this, a Java compiler is called up via Eclipse, and this compiler isn't happy when it encounters (due to import statements) classes that have been compiled by Java 8.

    Therefore, it is a question of fixing your Eclipse and Java installation.

    There's a way to configure the Java compiler to be used by Drools, but normally this works well using the default, i.e., via Eclipse.