automatic shutdown on RuntimeException

Stephen McConnell mcconnell at dpml.net
Thu Dec 9 13:45:44 EST 2004



Looking at the stack trace ...

  >org.apache.avalon.framework.container.ContainerUtil.initialize(
  >ContainerUtil.java:244)

Which suggests that something is calling the getConnection() method
during the lifecycle processing phase - and that the exception that is
being thrown is not caught in your code.  If Merlin (or Metro) fails to
initialize a component the instance will be decommissioned immediately.
The real questions here are:

  a) what is the real exception that is causing Merlin to halt execution
     (you should probably bump RuntimeException to Throwable to see what
is 
     actually happening)

  b) is this really a lifecycle request or a runtime request - if its 
     lifecycle then the behavior is correct, but if it's a runtime 
     request then you should be handling this inside a thread initiated
     under start()

Stephen.



> -----Original Message-----
> From: support-dpml-bounces at lists.ibiblio.org [mailto:support-dpml-
> bounces at lists.ibiblio.org] On Behalf Of Daniel Ritter
> Sent: 09 December 2004 10:18
> To: support-dpml at lists.ibiblio.org
> Subject: automatic shutdown on RuntimeException
> 
> Hi,
> 
> i'm using the latest merlin snapshot.
> 
> One of my components tries to make a connection to a SAP system.
> If there is no way to make a connection (e.g. network is down, cable
is
> broken....whatever you want) the getClient method is throwing a
> RuntimeException.
> This is the method:
> 
>   public JCO.Client getConnection() {
>     JCO.Client client = null;
>     try {
>       client = JCO.getClient(poolId);
>     } catch (RuntimeException e) {
>       getLogger().error("getConnection failed", e);
>     }
>     return client;
>   }
> 
> As you can see i catch the RuntimeException, but anyway merlin is
> shuting down after the execution of the catch block.
> These are the referencing lines from the logfile:
> 
> ERROR   2004-12-09 10:02:01:047 [converter.sap-connectionpool] :
> getConnection failed
> com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect
to
> SAP gateway failed
> Connect_PM  GWHOST=172.31.8.1, GWSERV=sapgw00, ASHOST=172.31.8.1,
SYSNR=00
> 
> LOCATION    CPIC (TCP/IP) on local host
> ERROR       partner not reached (host 172.31.8.1, service 3300)
> 
> TIME        Thu Dec 09 10:02:01 2004
> RELEASE     640
> COMPONENT   NI (network interface)
> VERSION     37
> RC          -10
> MODULE      nixxi_r.cpp
> LINE        8588
> DETAIL      NiPConnect2
> SYSTEM CALL SiPeekPendConn
> ERRNO       10065
> ERRNO TEXT  WSAEHOSTUNREACH: No route to host
> COUNTER     1
> 
>     at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native
> Method)
>     at
>
com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1092)
>     at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
>     at com.sap.mw.jco.JCO$Pool.initPool(JCO.java:4375)
>     at com.sap.mw.jco.JCO$PoolManager.getClient(JCO.java:5717)
>     at com.sap.mw.jco.JCO$PoolManager.getClient(JCO.java:5672)
>     at com.sap.mw.jco.JCO.getClient(JCO.java:7905)
>     at
>
de.servit.converter.sap.connectionpool.ConnectionPoolImpl.getConnection(
Co
> nnectionPoolImpl.java:93)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:
> 39)
>     at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Im
> pl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:324)
>     at
>
org.apache.avalon.activation.impl.ApplianceInvocationHandler.invoke(Appl
ia
> nceInvocationHandler.java:129)
>     at $Proxy7.getConnection(Unknown Source)
>     at
>
de.servit.converter.materialservice.MaterialServiceImpl.initialize(Mater
ia
> lServiceImpl.java:54)
>     at
>
org.apache.avalon.framework.container.ContainerUtil.initialize(Container
Ut
> il.java:244)
>     at
>
org.apache.avalon.activation.impl.DefaultComponentFactory.incarnation(De
fa
> ultComponentFactory.java:402)
>     at
>
org.apache.avalon.activation.impl.DefaultComponentFactory.incarnate(Defa
ul
> tComponentFactory.java:130)
>     at
>
org.apache.avalon.activation.impl.SingletonLifestyleManager.refreshRefer
en
> ce(SingletonLifestyleManager.java:144)
>     at
>
org.apache.avalon.activation.impl.SingletonLifestyleManager.commission(S
in
> gletonLifestyleManager.java:60)
>     at
>
org.apache.avalon.activation.impl.DefaultAppliance.commission(DefaultApp
li
> ance.java:94)
>     at
>
org.apache.avalon.activation.impl.DefaultRuntime.commission(DefaultRunti
me
> .java:86)
>     at
>
org.apache.avalon.composition.model.impl.DefaultSystemContext.commission
(D
> efaultSystemContext.java:377)
>     at
>
org.apache.avalon.composition.model.impl.DefaultDeploymentModel.commissi
on
> (DefaultDeploymentModel.java:122)
>     at
>
org.apache.avalon.composition.model.impl.DefaultComponentModel.commissio
n(
> DefaultComponentModel.java:282)
>     at
>
org.apache.avalon.composition.model.impl.Commissioner.run(Commissioner.j
av
> a:190)
>     at java.lang.Thread.run(Thread.java:534)
> INFO    2004-12-09 10:02:01:047 [converter.sap-connectionpool] : 1
> INFO    2004-12-09 10:02:01:047 [converter.sap-connectionpool] : 2
> DEBUG   2004-12-09 10:02:01:057 [kernel                   ] : state:
> initialized
> DEBUG   2004-12-09 10:02:01:067 [converter.sap-connectionpool.proxy] :
> Finalizing proxy [3338151] (appliance:/converter/sap-connectionpool).
> DEBUG   2004-12-09 10:02:01:067 [converter.sap-connectionpool.proxy] :
> Releasing component [3338151]
(appliance:/converter/sap-connectionpool).
> DEBUG   2004-12-09 10:02:01:328 [kernel                   ] : shutdown
> event
> DEBUG   2004-12-09 10:02:01:328 [kernel                   ] : disposal
> 
> 
> What can i do to make stop merlin shuting down after the exception
occurs?
> 
> Thanks for your help in advance,
> 
> Daniel Ritter
> _______________________________________________
> support-dpml mailing list
> support-dpml at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/support-dpml




More information about the support-dpml mailing list