immutable-xjc icon indicating copy to clipboard operation
immutable-xjc copied to clipboard

The extension is rendered unusable because the default constructor is protected

Open julianomqs opened this issue 4 years ago • 2 comments

Like the issue #9 because the protected access of the default constructor an error occurs when executing a web service endpoint method.

And I just discovered an error occurs in Apache CXF, version 3.3.5:

fev 06, 2020 7:49:24 PM org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFORMAÇÕES: Creating Service {http://www.fcdl-sc.org.br/sispc/consulta}ConsultaSpcscService from WSDL: file:/C:/java/projetos/spc/target/classes/fcdl_sc_spc_homologacao.wsdl
java.lang.IllegalAccessException: Class org.apache.cxf.jaxb.JAXBWrapperHelper can not access a member of class br.org.fcdl_sc.sispc.consulta.ChequeNacional12 with modifiers "protected"
	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
	at java.lang.Class.newInstance(Class.java:436)
	at org.apache.cxf.jaxb.JAXBWrapperHelper.createWrapperObject(JAXBWrapperHelper.java:46)
	at org.apache.cxf.databinding.AbstractWrapperHelper.createWrapperObject(AbstractWrapperHelper.java:88)
	at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:91)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:441)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:356)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140)
	at com.sun.proxy.$Proxy36.chequeNacional12(Unknown Source)
	at br.com.ibasi.spc.FcdlScSpc.lambda$42(FcdlScSpc.java:319)
	at br.com.ibasi.spc.Utils.wrapInTryCatch(Utils.java:14)
	at br.com.ibasi.spc.FcdlScSpc.chequeNacional12(FcdlScSpc.java:319)
	at br.com.ibasi.spc.Main.main(Main.java:15)

Both Glassfish (JDK) and Apache CXF JAX-WS implementations use the sun.reflect.Reflection.ensureMemberAccess method, and it is where the error occur.

So I kindly ask for you reconsider generating the default constructor protected.

julianomqs avatar Feb 06 '20 21:02 julianomqs

Can you please be more specific how was your CXF framework configured? Parts of it can be seen from the provided stacktrace, however some working (better said non working 😊) example would be great.

sabomichal avatar Feb 17 '20 14:02 sabomichal

I've encountered the same problem. The setup is:

  • karaf 4.3.0
  • cxf 3.4.0
  • used via camel-cxf (camel 3.6.0) extracting the project into a working example would unfortunately be a very large endeavor.

rastislavpapp avatar Mar 26 '21 12:03 rastislavpapp