[
https://issues.apache.org/jira/browse/AXIS2-4004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627677#action_12627677
]
Detelin Yordanov commented on AXIS2-4004:
-----------------------------------------
Hi Amila,
The solution is OK, but needs some modifications to make it work. The first
problem is that the Class.forName(..) throws a ClassNotFoundException in my
case, since the inner class is part of the service class (the outer class in
this case). And the service class is available only in the service class
loader, but not in the default Axis2 classloader.
This can be easily fixed by getting the class loader of the clazz parameter and
using it instead of the default.
The other problem is that this most certainly will not work for more that 1
level of nesting, in case of multiple inner classes we require a recursion to
instantiate the parent classes chain. As I have pointed out in the JIRA
definition there already exists a good patch provided by Angel in AXIS2-2691.
I will attach the diff towards current trunk so that you can apply it if you
like.
> Inner class instantiation problem
> ---------------------------------
>
> Key: AXIS2-4004
> URL: https://issues.apache.org/jira/browse/AXIS2-4004
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: kernel
> Affects Versions: nightly
> Reporter: Detelin Yordanov
>
> Hi guys,
> I'm having problems using inner classes, if having a simple EchoService
> with an inner class like this:
> public class EchoService
> public MyInnerClass retMyInnerClass(MyInnerClass input) {
> return input;
> }
>
> public class MyInnerClass {
> private String name;
>
> public MyInnerClass() { }
>
> public void setName(String name) {
> this.name = name;
> }
>
> public String getName() {
> return this.name;
> }
> };
> }
> I am able to deploy it and invoke it with a generated ADB client, however,
> when the service receives the XML request and tries to create
> an instance of the inner class an exception gets thrown inside the
> DefaultObjectSupplier:
> Caused by: java.lang.InstantiationException:
> org.tempuri.test.EchoService$MyInnerClass
> at java.lang.Class.newInstance0(Class.java:335)
> at java.lang.Class.newInstance(Class.java:303)
> at
> org.apache.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:28)
> ... 28 more
> The issue has been reported before, see AXIS2-2691, however it seems that the
> DefaultObjectSupplier patch provided there was never applied.
> Annogen changes were also required but since now (in the nightly build) Axis2
> does not use annogen anymore, I think only the DefaultObjectSupplier patch is
> relevant.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]