How to use Java-8 default-interface-implementation in a OSGi-Service - osgi

I would like to use Java 8 features on the latest Apache-Karaf release (3.0.2) which is supposed to support Java 8.
I have a service-interface within my domain-layer (repository) which has a default-method for identity-generation
public interface MyRepository{
...
default MyId nextIdentity() {
return new MyId(UUID.randomUUID().toString().toUpperCase());
}
}
Then I have a Implementation of that interface which is exposed as a OSGi-Service using Blueprint (Apache-Aries).
When I run my application the bundles get installed successfully, the services get registered, but when the application-layer is calling the method nextIdentity I get a Exception.
IncompatibleClassChangeError: Found interface MyRepository, but class was expected
The application-layer is straight forward: Interface-Attribute which gets its class (in this case OSGi-Service-Reference) injected via Blueprint.
I did check the compilation: all modules are compiled with Java 8 compliance level in Eclipse. I am guessing the problem is related to a aries-proxy which is not Java 8, but since karaf supports it....
EDIT: added Stacktrace
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public bikeshop.http.wicket.page.GaragePage()'. Might be it doesn't exist, may be it is not visible (public).
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:193)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:66)[92:org.apache.wicket.core:6.7.0]
at org.ops4j.pax.wicket.internal.PaxWicketPageFactory.newPage(PaxWicketPageFactory.java:76)[100:org.ops4j.pax.wicket.service:3.0.2]
at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:133)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.core.request.handler.PageProvider.resolvePageInstance(PageProvider.java:268)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.core.request.handler.PageProvider.getPageInstance(PageProvider.java:166)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:244)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:854)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)[91:org.apache.wicket.request:6.7.0]
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b.CGLIB$processRequestCycle$4(<generated>)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b$$FastClassByCGLIB$$36c566fa.invoke(<generated>)[92:org.apache.wicket.core:6.7.0]
at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)[99:org.apache.servicemix.bundles.cglib:2.2.2.1]
at org.ops4j.pax.wicket.internal.servlet.PAXWicketServlet$WicketFilterCallback.intercept(PAXWicketServlet.java:150)[100:org.ops4j.pax.wicket.service:3.0.2]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b.processRequestCycle(<generated>)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b.CGLIB$processRequest$12(<generated>)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b$$FastClassByCGLIB$$36c566fa.invoke(<generated>)[92:org.apache.wicket.core:6.7.0]
at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)[99:org.apache.servicemix.bundles.cglib:2.2.2.1]
at org.ops4j.pax.wicket.internal.servlet.PAXWicketServlet$WicketFilterCallback.intercept(PAXWicketServlet.java:150)[100:org.ops4j.pax.wicket.service:3.0.2]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b.processRequest(<generated>)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b.CGLIB$doFilter$10(<generated>)[92:org.apache.wicket.core:6.7.0]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b$$FastClassByCGLIB$$36c566fa.invoke(<generated>)[92:org.apache.wicket.core:6.7.0]
at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)[99:org.apache.servicemix.bundles.cglib:2.2.2.1]
at org.ops4j.pax.wicket.internal.servlet.PAXWicketServlet$WicketFilterCallback.intercept(PAXWicketServlet.java:150)[100:org.ops4j.pax.wicket.service:3.0.2]
at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByCGLIB$$91ca4a1b.doFilter(<generated>)[92:org.apache.wicket.core:6.7.0]
at org.ops4j.pax.wicket.internal.servlet.PAXWicketServlet.service(PAXWicketServlet.java:98)[100:org.ops4j.pax.wicket.service:3.0.2]
at org.ops4j.pax.wicket.internal.filter.PAXWicketFilterChain.doFilter(PAXWicketFilterChain.java:61)[100:org.ops4j.pax.wicket.service:3.0.2]
at org.ops4j.pax.wicket.internal.filter.FilterDelegator.doFilter(FilterDelegator.java:82)[100:org.ops4j.pax.wicket.service:3.0.2]
at org.ops4j.pax.wicket.internal.servlet.ServletCallInterceptor.service(ServletCallInterceptor.java:168)[100:org.ops4j.pax.wicket.service:3.0.2]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)[80:org.ops4j.pax.web.pax-web-jetty:3.1.2]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:240)[80:org.ops4j.pax.web.pax-web-jetty:3.1.2]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:77)[80:org.ops4j.pax.web.pax-web-jetty:3.1.2]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.Server.handle(Server.java:370)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[71:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_20]
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_20]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_20]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_20]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)[:1.8.0_20]
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:174)[92:org.apache.wicket.core:6.7.0]
... 61 more
Caused by: java.lang.IncompatibleClassChangeError: Found interface bikeshop.domain.repository.BikeRepository, but class was expected
at Proxy04d92f46_988d_4726_9355_6b6381790fde.nextIdentity(Unknown Source)
at bikeshop.application.service.BikeApplicationService.loadGarage(BikeApplicationService.java:22)
at Proxyc25af47a_a344_4a1b_8d0e_429a76d453c6.loadGarage(Unknown Source)
at Proxy163e0a74_12bc_4124_827b_2119133222e8.loadGarage(Unknown Source)
at bikeshop.presentation.internal.GaragePresentationService.init(GaragePresentationService.java:21)
at Proxy5a3bd46a_6830_438c_b5eb_0ca9ec091479.init(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_20]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_20]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_20]
at java.lang.reflect.Method.invoke(Method.java:483)[:1.8.0_20]
at org.ops4j.pax.wicket.util.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:253)
at org.ops4j.pax.wicket.util.proxy.$Proxy22.init(Unknown Source)
at bikeshop.http.wicket.page.GaragePage.<init>(GaragePage.java:30)

The culprit here is probably Blueprint, which generates a proxy class for every imported service, rather than giving you the service object directly. I don't believe that Aries Blueprint has been updated for Java 8 compatibility.
The solution would be to avoid Blueprint and use something like Declarative Services (DS), which is much closer to "real" OSGi Services and gives your consumer the actual service instance. DS definitely works with Java 8 interfaces having default methods.

Update:
This issue seems to be fixed in the proxy-impl 1.1.4 of Aries / Karaf 4.2.3
KARAF-6087
ARIES-1849

Related

No SchemaFactory that implements the schema language specified by: http://www.w3.org/2001/XMLSchema could be loaded

When trying to expose a Service with Aegis databinding in CXF DOSGi I get this error in Java 8. In java 7 it works fine.
Caused by: java.lang.IllegalArgumentException: No SchemaFactory that implements the schema language specified by: http://www.w3.org/2001/XMLSchema could be loaded
at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:215)
at org.apache.cxf.aegis.type.XMLTypeCreator.(XMLTypeCreator.java:122)
See full stacktrace here
I think the reason is that the code does not see the impl class com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.
Any ideas how to fix this?
Btw. the exception can be observed by running the CXF-DOSGi build in Java 8.
I still do not have found a real solution for this. For now I have committed a workaround on CXF master to ignore this exception in the static code. So the Aegis binding is not schema checked but at least works. See CXF-6959.
I would be happy about any hints to get this fully working again.

Get the ClassNotFound exception when use corba within osgi

I want to encapsulate corba service in to osgi bundle. I am using karaf as osgi container, openorb as orb implementation and blueprint to register osgi service. But when I install my corba feature to karaf, always get ClassNotFound exception. the exception stack like this:
org.omg.CORBA.INITIALIZE: can't instantiate ORB implementation org.openorb.CORBA.ORB
at org.omg.CORBA.ORB.init_orb(Unknown Source)[:1.6.0_32]
at org.omg.CORBA.ORB.init(Unknown Source)[:1.6.0_32]
....
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_32]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_32]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_32]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_32]
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:824)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:636)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:724)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:640)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:331)[10:org.apache.aries.blueprint:0.3.1]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)[10:org.apache.aries.blueprint:0.3.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_32]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_32]
at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_32]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_32]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)[:1.6.0_32]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_32]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_32]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_32]
Caused by: java.lang.ClassNotFoundException: org.openorb.CORBA.ORB
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)[:1.6.0_32]
at java.security.AccessController.doPrivileged(Native Method)[:1.6.0_32]
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)[:1.6.0_32]
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)[:1.6.0_32]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)[:1.6.0_32]
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]
Fixed this problem by myself, use the following way:
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
/*
* Start threads, or establish connections, here, now
*/
} finally {
Thread.currentThread().setContextClassLoader(tccl);
}
Better handling of Thread Context ClassLoader in OSGi
I think it just misses the openorb dependency. Do you import the org.openorb package?
Normally you'd get compile time errors if you forget that, but this seems to be a Class.forname, so it fails only at runtime.

Class Loading Issue with HornetMQ and JBoss 7.0.2

I am working on a JBoss 7.0.2 instance. Our app is a war and messages are dropped into the queue. This works fine. But when we read it via a listener, the system throws an exception. It is looking for a class which is present in the WEB-INF/classes.
I understand that the module classloader (if I am right it is HornetMQ) is not able to see this application class and throwing up. I dont want my application class to be part of the server lib. That class living within the war is the best place.
The exception is :
javax.jms.JMSException: com.yyy.TransportMessage from [Module "org.hornetq:main" from local module loader #238b8914
(roots: /Users/xxx/jboss/multi/jboss-as-7.0.2.Final/modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:603)
at org.hornetq.utils.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:71)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at org.hornetq.jms.client.HornetQObjectMessage.getObject(HornetQObjectMessage.java:158)
at com.xxx.MessageReceiver.handleObjectMessage(NSMessageReceiver.java:72)
at com.xxx.jms.JMSListener.onMessage(JMSListener.java:1540)
at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:91)
What should I do to make this work?
Regards.
ashok

JSF1.1 Webapp on WebSphere AS 7 IntrospectionException

Got an exception during migration Web application from WAS 6.1 to WAS 7. This application developed using JSF1.1 (MyFaces) + Facelets + Spring (for backing beans). On some pages I'm getting the following exception:
Caused by: javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /pages/recovery_accs.xhtml][Class: javax.faces.component.html.HtmlForm,Id: sequestration][Class: javax.faces.component.html.HtmlDataTable,Id: _id37][Class: javax.faces.component.UIColumn,Id: _id50][Class: javax.faces.component.html.HtmlOutputText,Id: _id52]}
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:271)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:226)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:69)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:57)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:799)
... 46 more
Caused by: javax.faces.el.PropertyNotFoundException: /pages/sub/idocAccsRecoverySub.xhtml #34,55 value="#{varbean.idocAcc.vzOrder}": Bean: com.test.project.bean.idoc.accs.IdocAccBean, property: idocAcc
at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
at javax.faces.component.UIOutput.getValue(UIOutput.java:118)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:267)
... 50 more
Caused by: java.beans.IntrospectionException: Parameter type in setter method does not corresponds to predefined.
at java.beans.PropertyDescriptor.setWriteMethod(Unknown Source)
at java.beans.PropertyDescriptor.<init>(Unknown Source)
at java.beans.StandardBeanInfo.introspectProperties(Unknown Source)
at java.beans.StandardBeanInfo.<init>(Unknown Source)
at java.beans.Introspector.getBeanInfoImpl(Unknown Source)
at java.beans.Introspector.getBeanInfoImpl(Unknown Source)
at java.beans.Introspector.getBeanInfoImplAndInit(Unknown Source)
at java.beans.Introspector.getBeanInfo(Unknown Source)
at org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:474)
at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
at org.apache.el.parser.AstValue.getValue(AstValue.java:123)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
... 52 more
Tried to use different version of facelet library and different EL implementations. Even tried to recompile project using IBM's JDK. Still no success. On Apache Tomcat it works without problem.
In a stacktrace above - IdocAccBean is a regular java bean which extends an abstract class IdocAccCore. If I use other backing beans which extend that class I get the same exception. All other beans not derived from IdocAccCore work correctly. There is nothing special in IdocAccCore class and it's pretty big so I don't think it's necessary to give full source code.
Any suggestions what can be wrong with that IdocAccCore class?
The problem solved by updating IBMs version of JRE. Actually, I was thinking that I'm using the latest version of IBMs JRE. For sure I downloaded one from IBM's siteIBM Development Package for Eclipse. The problem is that this package contains pretty old version of IBM's java 1.6. Fresh version of IBM's java I found in fixpacks for Websphere AS.
You can find detailed list of fixed bugs in IBM's java 1.6 here

XSLT ClassCastException in WebSphere when Spring tries to create an AnnotationMethodHandlerAdapter

When starting WebSphere, I get this exception:
Could not instantiate bean class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter]:
Constructor threw exception; nested exception is java.lang.ClassCastException:
com.ibm.xtq.xslt.jaxp.compiler.TransformerFactoryImpl incompatible with
javax.xml.transform.TransformerFactory
Caused by: java.lang.ClassCastException: com.ibm.xtq.xslt.jaxp.compiler.TransformerFactoryImpl
incompatible with javax.xml.transform.TransformerFactory
at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
at org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter.<init>(AbstractXmlHttpMessageConverter.java:47)
at org.springframework.http.converter.xml.SourceHttpMessageConverter.<init>(SourceHttpMessageConverter.java:45)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.<init>(AnnotationMethodHandlerAdapter.java:197)
This doesn't seem have any impact on any beans in my applicationContext.xml but it's still odd. For me, this looks as if IBM classes are leaking into my application.
How can I fix this? I already set the option "Access to internal server classes" to "Restrict".
It was indeed a class-loading issue, however this cannot be solved by changing class-loader settings.
The problem was that the xml-apis and javax.xml jars were being imported over some maven dependencies.
Since we already set the class loader policies for the application to PARENT_LAST, the javax.xml.transform.TransformerFactory was being loaded from the WebApp-Class loader from our jar files.
However its implementation 'com.ibm.xtq.xslt.jaxp.compiler.TransformerFactoryImpl' was coming from the server class loader, this one was linked to the javax.xml.transform.TransformerFactory provided by the JDK/JRE.
Since the classes were loaded from different sources a ClassCastException was thrown.
Removing all dependencies to xml-apis / xerces / javax.xml jars solved the problem.
Since these APIs are now part of the JDK they no longer need to be imported.
... and if you wonder why I know so much about this issue: I work together with Aaron. ;)
I can't speak for Restrict as I have no personal experience with it,But I think the problem is more to do with IBM Class Loader. The class you are referring to is part of IBM Java implementation of TransformerFactory, I think you can try one of the following to solve this issue on hand
Either change the server class loader policy to PARENT_LAST (This way class loader will find the class from application's local class path, before going to up the chain all the way to java run time)
The other option would be look at the jaxp.properties file, I think it is located in (was_root\java\jre\lib), I only read about this option never actually used it
Why do you say IBM classes are leaking into your application?
The TransformerFactory is asked to create a newInstance. It follows a sequence of steps to determine which TransformerFactory to use. If none of the config is specified, it simply chooses to use the default factory.
Here is the javadoc for TransformerFactory:
http://download.oracle.com/javase/1.5.0/docs/api/javax/xml/transform/TransformerFactory.html#newInstance()
What is the OS ? Is that AIX?
http://www.ibm.com/developerworks/java/jdk/aix/j664/sdkguide.aix64.html
Looking at this doc (link above) for AIX it tells me that this is the default Impl:
javax.xml.transform.TransformerFactory
Selects the XSLT processor. Possible values are:
com.ibm.xtq.xslt.jaxp.compiler.TransformerFactoryImpl
Use the XL TXE-J compiler. This value is the default.
Post back additional information so that we can try and troubleshoot this.
HTH
Manglu

Resources