Bug 1143751 - [GSS] (6.4.z) java:jboss/exported is not available in @PreDestroy methods during shutdown
Summary: [GSS] (6.4.z) java:jboss/exported is not available in @PreDestroy methods dur...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Naming
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: emartins
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-17 21:36 UTC by Kyle Lape
Modified: 2019-04-16 14:18 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-08-19 15:48:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker WFLY-3865 0 Major Open java:jboss/exported is not available in @PreDestroy methods during shutdown 2017-06-14 20:55:07 UTC

Description Kyle Lape 2014-09-17 21:36:36 UTC
With the following code in a class named e.g. {{JNDIBinderBean.java}}

---------------------------------------------
private static final String name = "java:jboss/exported/JNDIBinderBean";
private static final String value = "JNDIBinderBean instantiated at " + new Date();

@PostConstruct
public void start() {
  new InitialContext().rebind(name, value);
}

@PreDestroy
public void stop() {
    new InitialContext().unbind(name);
}

---------------------------------------------

When JBoss shuts down, I get an error saying that the MSC service isn't available:

---------------------------------------------
  javax.naming.NamingException: JBAS011836: Could not resolve service
    service jboss.naming.context.java.jboss.exported.JNDIBinderBean
---------------------------------------------

Comment 1 Jason T. Greene 2014-11-19 19:48:35 UTC
The impact of this bug is small. It can be worked around by using EE injection or just using a try/catch block around unbind. Doing a fix in this area touches some sensitive code, and such changes require adequate upstream bake.

Comment 5 Brad Maxwell 2016-08-19 15:48:14 UTC
As upstream is marked as a feature:
https://issues.jboss.org/browse/WFLY-3865

Workaround: try / catch in the PreDestory in case the jndi was already unbound.


Note You need to log in before you can comment on or make changes to this bug.