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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to