You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "N, Ravikiran" <ra...@hp.com> on 2014/05/07 12:12:17 UTC
destroySubcontext failing with NameNotFoudException
Hi all,
I trying to understand under what conditions destroySubContext fails in tomcat..? I'm trying to destroy Context which I had created, because of which I'm unable to createContext the next time I start the service. My code is below :
private Context srvCtx;
public void init(ServletConfig servletconfig) throws ServletException {
Context initCtx = new InitialContext();
srvCtx = initCtx.createSubcontext("myapp");
}
public void destroy() {
try
{
if (srvCtx != null)
{
srvCtx.destroySubcontext(GS_CTX_NAME);
srvCtx.close();
}
}
catch(NamingException e)
{
log_.error(new LogQueueMessageStructure("Couldn't unbind the context",3016),e);
}
}
What is wrong with my code and also how can I debug this issue..? Please help me out..!!
Regards,
Ravikiran N
Re: destroySubcontext failing with NameNotFoudException
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Ravikiran,
On 5/7/14, 6:12 AM, N, Ravikiran wrote:
> Hi all,
>
> I trying to understand under what conditions destroySubContext
> fails in tomcat..? I'm trying to destroy Context which I had
> created, because of which I'm unable to createContext the next time
> I start the service. My code is below :
>
> private Context srvCtx; public void init(ServletConfig
> servletconfig) throws ServletException { Context initCtx = new
> InitialContext(); srvCtx = initCtx.createSubcontext("myapp"); }
>
> public void destroy() { try { if (srvCtx != null) {
> srvCtx.destroySubcontext(GS_CTX_NAME); srvCtx.close(); } }
> catch(NamingException e) { log_.error(new
> LogQueueMessageStructure("Couldn't unbind the context",3016),e); }
> }
>
> What is wrong with my code and also how can I debug this issue..?
> Please help me out..!!
Well, first off: your code has insane indentation. That could be it.
An error message or stack trace would be nice.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJTdjwnAAoJEBzwKT+lPKRYakgP/2bcug+sumtED9ap0GzJdRCl
I2sUHeo1AxC9rRkZV6Jj8gmVHzF/76VWKU+HKJ+DuvRx8TO4inGXIgsPM3ZfYZSq
T1HEUaStRGf1X0KJHrMmPBiPSP+GnHvR+Csx6TBv9dWIHJJ2orim2RqU1Vw0sLKt
xaf0QipLWNTa7mDmPiYpyqX19vIrRt7++aDvOFZPazFatHLuAU+LPuEV6MERb+Gy
h7Pl1VhYZ4qUxCpzccPtS7y9aLB7nNW0/d/1I/vMmqmnzSsfrvEW4SHtDt9qgESx
mRGddljCKAm5slPqqI+hlcStqaKuREB9bdkUC8dioHqJ2g5Gh54J3/EG5AhBLJvM
fnxFl6HJLHeUZRI8jBDM+pBDNhM9uLcbupRFlZLEcKXualGASDFfqwbhDQl0jK+3
PBrqkTJvd3CKu8Ma1VY1UAApyKHufON3fyMRHuN1osONKLXrh1Vw4aH9IchbAxpN
8qaAFMmY1TdwBkQUvmrliiHiZ5VPolkBTD0BwUhuVkNSxHs/HRYjhBlnOe0owkps
FmMYIoUxh0RKlJrm32Mbwd+8D4yhgND/hdfN/s66+LoQ+BTldDLYjKyIpIlLtz31
wsahFGl4flz1yrkig5R0hYl/n0PYyCaB8rtdhJ+/L8I97TEbhW8eopTOchQIHkYp
v0rcs/4T2xL0NhGRzP1d
=cudR
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org