cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Schmidt (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DOSGI-178) NullPointerException when interface method declares throwing custom exception
Date Thu, 27 Feb 2014 23:32:20 GMT

    [ https://issues.apache.org/jira/browse/DOSGI-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13915204#comment-13915204
] 

Kevin Schmidt commented on DOSGI-178:
-------------------------------------

I just ran into this same exception when registering a service.  I'm using Karaf 3.0.0 with
CXF-DOSGi 1.5.0.

2014-02-27 15:06:45,756 | ERROR | pool-15-thread-5 | RemoteServiceAdminCore           | 208
- cxf-dosgi-ri-dsw-cxf - 1.5.0 | failed to create server for interface com.nextgate.osgi.Controller
java.lang.NullPointerException
	at java.lang.reflect.Array.newArray(Native Method)[:1.7.0_25]
	at java.lang.reflect.Array.newInstance(Array.java:70)[:1.7.0_25]
	at org.apache.cxf.aegis.type.TypeUtil.getTypeRelatedClass(TypeUtil.java:261)
	at org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(AbstractTypeCreator.java:108)
	at org.apache.cxf.aegis.type.AbstractTypeCreator.createType(AbstractTypeCreator.java:402)
	at org.apache.cxf.aegis.type.basic.BeanTypeInfo.getType(BeanTypeInfo.java:192)
	at org.apache.cxf.aegis.type.basic.BeanType.getDependencies(BeanType.java:534)
	at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:394)
	at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:399)
	at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:399)
	at org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage(AegisDatabinding.java:371)
	at org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperation(AegisDatabinding.java:283)
	at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:242)
	at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:475)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:537)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:249)
	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
	at org.apache.cxf.dosgi.dsw.handlers.AbstractPojoConfigurationTypeHandler.createServerFromFactory(AbstractPojoConfigurationTypeHandler.java:197)
	at org.apache.cxf.dosgi.dsw.handlers.PojoConfigurationTypeHandler.createServer(PojoConfigurationTypeHandler.java:119)
	at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportInterfaces(RemoteServiceAdminCore.java:165)
	at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:121)
	at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:56)
	at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:54)
	at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_25]
	at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:54)[208:cxf-dosgi-ri-dsw-cxf:1.5.0]
	at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:39)[208:cxf-dosgi-ri-dsw-cxf:1.5.0]
	at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.exportServiceUsingRemoteServiceAdmin(TopologyManagerExport.java:177)[207:cxf-dosgi-ri-topology-manager:1.5.0]
	at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.doExportService(TopologyManagerExport.java:168)[207:cxf-dosgi-ri-topology-manager:1.5.0]
	at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport$3.run(TopologyManagerExport.java:143)[207:cxf-dosgi-ri-topology-manager:1.5.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_25]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_25]
	at java.lang.Thread.run(Thread.java:724)[:1.7.0_25]

I have not yet tried the workaround suggested nor verified my situation is identical, but
is this issue being looked at?

> NullPointerException when interface method declares throwing custom exception
> -----------------------------------------------------------------------------
>
>                 Key: DOSGI-178
>                 URL: https://issues.apache.org/jira/browse/DOSGI-178
>             Project: CXF Distributed OSGi
>          Issue Type: Bug
>    Affects Versions: 1.4.0, 1.5.0
>         Environment: Oracle JDK 1.7.0_17, DOSGi 1.4.0/1.5.0, Karaf 2.3.1 (Aegis Databinding
2.7.2)
>            Reporter: Amichai Rothman
>
> I'm getting an Aegis exception (stacktrace below) when trying to export a service. It
looks similar to CXF-3613, but that is closed as fixed in 2.7.1. I also found mention of it
in http://mail-archives.apache.org/mod_mbox/cxf-dev/201301.mbox/%3C399BF167-4CDD-4E5C-B9CE-7DBDFC012074@apache.org%3E
from a few months ago but nothing further.
> I tried debugging a bit, and it seems to fail when the service interface has a method
declaring a throws clause with a custom exception which is a trivial Exception subclass (with
no fields, just standard constructors). Somewhere down the line of dependencies it reaches
a java.lang.Class, which has a field of type T[] named enumConstants, it tries to get the
base type for component type "T", which returns null, which causes the exception.
> Update: I think I found a temporary workaround: I changed the custom exception to extend
RuntimeException instead of Exception, and changed the interface to declare throwing RuntimeException
instead of the custom exception, and now I no longer see this exception occurring. The reason
for using RuntimeException (rather than Exception) is so that the rest of the code does not
require any modification - only the exception class and the interface are changed, and only
those will need to be reverted when a proper fix is released.
> However, it's still bad that code needs to be changed in order for DOSGi to work (one
of its main selling points is transparency to OSGi services), plus the code loses compile-time
exception checking for users of the interface/service.
> java.lang.NullPointerException
>         at java.lang.reflect.Array.newArray(Native Method)[:1.7.0_17]
>         at java.lang.reflect.Array.newInstance(Array.java:70)[:1.7.0_17]
>         at org.apache.cxf.aegis.type.TypeUtil.getTypeRelatedClass(TypeUtil.java:261)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(AbstractTypeCreator.java:108)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.type.AbstractTypeCreator.createType(AbstractTypeCreator.java:402)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.type.basic.BeanTypeInfo.getType(BeanTypeInfo.java:192)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.type.basic.BeanType.getDependencies(BeanType.java:534)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:394)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:399)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:399)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage(AegisDatabinding.java:371)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperation(AegisDatabinding.java:283)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:242)[178:org.apache.cxf.cxf-rt-databinding-aegis:2.7.2]
>         at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)[165:org.apache.cxf.cxf-rt-core:2.7.2]
>         at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:475)[165:org.apache.cxf.cxf-rt-core:2.7.2]
>         at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:537)[165:org.apache.cxf.cxf-rt-core:2.7.2]
>         at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:249)[165:org.apache.cxf.cxf-rt-core:2.7.2]
>         at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)[172:org.apache.cxf.cxf-rt-frontend-simple:2.7.2]
>         at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)[172:org.apache.cxf.cxf-rt-frontend-simple:2.7.2]
>         at org.apache.cxf.dosgi.dsw.handlers.AbstractPojoConfigurationTypeHandler.createServerFromFactory(AbstractPojoConfigurationTypeHandler.java:208)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
>         at org.apache.cxf.dosgi.dsw.handlers.PojoConfigurationTypeHandler.createServer(PojoConfigurationTypeHandler.java:118)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
>         at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:119)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
>         at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:64)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
>         at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:58)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
>         at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_17]
>         at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:58)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
>         at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:37)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
>         at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.doExportService(TopologyManagerExport.java:249)[72:cxf-dosgi-ri-topology-manager:1.5.0.SNAPSHOT]
>         at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.access$300(TopologyManagerExport.java:50)[72:cxf-dosgi-ri-topology-manager:1.5.0.SNAPSHOT]
>         at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport$3.run(TopologyManagerExport.java:214)[72:cxf-dosgi-ri-topology-manager:1.5.0.SNAPSHOT]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_17]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_17]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_17]



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message