You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Thorsten Schöning <ts...@am-soft.de> on 2016/03/09 22:08:19 UTC
[Axis2] Is changing a service name a bad thing?
Hi all,
I have an implementation of ServiceLifeCycle in which I'm overriding
startUp and change the name of my service in some special way to make
my deployment easier. I'm simply implementing some kind of mandator
mechanism based on exploded services and their unique name in the file
system.
This worked pretty finde the last years, but today I encountered that
Axis2 is handling structures internally in which the service name is
used as some component of a key. Those structures were built before
startUp was called and were not updated on a changed service name. My
service generated an exception for some reason, Axis2 tried to handle
that and failed itself with an NPE, which made debugging pretty hard
of course because the original exception was lost.
The NPE was thrown in the following line 183 of RPCMessageReceiver and
the not up to date structure was TypeTable for the service. Gladly I
was able to access that map and update the generated keys and QNames
with my new updated service name.
But that made me think of if my approach is generally a bad idea,
because I would have expected that if I'm able to change the service
name, struct containing it would get updated automatically. Problems
like this one could still hit me hard some day in future... :-)
So what do you think, is this some bug in Axis2 or is my approach a
really bad idea or is it OK to live with it, if I change structs the
way I'm currently doing? the problem with the latter is that this only
works of course if I'm able to access those, which may not be
guaranteed.
Thanks for your ideas!
> 175 Class[] exceptionTypes = method.getExceptionTypes();
> 176 for (Class exceptionType : exceptionTypes){
> 177 if (exceptionType.getName().equals(cause.getClass().getName())){
> 178 // this is an bussiness logic exception so handle it properly
> 179 String partQName = inMessage.getAxisService().getName() + getSimpleClassName(exceptionType);
> 180 TypeTable typeTable = inMessage.getAxisService().getTypeTable();
> 181 QName elementQName = typeTable.getQNamefortheType(partQName);
> 182 SOAPFactory fac = getSOAPFactory(inMessage);
> 183 OMElement exceptionElement = fac.createOMElement(elementQName);
> 184
> 185 if (exceptionType.getName().equals(Exception.class.getName())){
> 186 // this is an exception class. so create a element by hand and add the message
> 187 OMElement innterExceptionElement = fac.createOMElement(elementQName);
> 188 OMElement messageElement = fac.createOMElement("Message", inMessage.getAxisService().getTargetNamespace(), null);
> 189 messageElement.setText(cause.getMessage());
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.axis2/axis2-adb/1.6.2/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java/#183
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: [Axis2] Is changing a service name a bad thing?
Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Deepal jayasinghe,
am Donnerstag, 10. März 2016 um 17:06 schrieben Sie:
> As you have found the issue and location, can you please send a patch.
> Create a JIRA and attach your patch (also reply to this email with the
> JIRA link).
https://issues.apache.org/jira/browse/AXIS2-5745
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: [Axis2] Is changing a service name a bad thing?
Posted by Deepal jayasinghe <de...@gmail.com>.
Hi Thorsten,
As you have found the issue and location, can you please send a patch.
Create a JIRA and attach your patch (also reply to this email with the
JIRA link).
Deepal
> Hi all,
>
> I have an implementation of ServiceLifeCycle in which I'm overriding
> startUp and change the name of my service in some special way to make
> my deployment easier. I'm simply implementing some kind of mandator
> mechanism based on exploded services and their unique name in the file
> system.
>
> This worked pretty finde the last years, but today I encountered that
> Axis2 is handling structures internally in which the service name is
> used as some component of a key. Those structures were built before
> startUp was called and were not updated on a changed service name. My
> service generated an exception for some reason, Axis2 tried to handle
> that and failed itself with an NPE, which made debugging pretty hard
> of course because the original exception was lost.
>
> The NPE was thrown in the following line 183 of RPCMessageReceiver and
> the not up to date structure was TypeTable for the service. Gladly I
> was able to access that map and update the generated keys and QNames
> with my new updated service name.
>
> But that made me think of if my approach is generally a bad idea,
> because I would have expected that if I'm able to change the service
> name, struct containing it would get updated automatically. Problems
> like this one could still hit me hard some day in future... :-)
>
> So what do you think, is this some bug in Axis2 or is my approach a
> really bad idea or is it OK to live with it, if I change structs the
> way I'm currently doing? the problem with the latter is that this only
> works of course if I'm able to access those, which may not be
> guaranteed.
>
> Thanks for your ideas!
>
>> 175 Class[] exceptionTypes = method.getExceptionTypes();
>> 176 for (Class exceptionType : exceptionTypes){
>> 177 if (exceptionType.getName().equals(cause.getClass().getName())){
>> 178 // this is an bussiness logic exception so handle it properly
>> 179 String partQName = inMessage.getAxisService().getName() + getSimpleClassName(exceptionType);
>> 180 TypeTable typeTable = inMessage.getAxisService().getTypeTable();
>> 181 QName elementQName = typeTable.getQNamefortheType(partQName);
>> 182 SOAPFactory fac = getSOAPFactory(inMessage);
>> 183 OMElement exceptionElement = fac.createOMElement(elementQName);
>> 184
>> 185 if (exceptionType.getName().equals(Exception.class.getName())){
>> 186 // this is an exception class. so create a element by hand and add the message
>> 187 OMElement innterExceptionElement = fac.createOMElement(elementQName);
>> 188 OMElement messageElement = fac.createOMElement("Message", inMessage.getAxisService().getTargetNamespace(), null);
>> 189 messageElement.setText(cause.getMessage());
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.axis2/axis2-adb/1.6.2/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java/#183
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org