[jboss-jira] [JBoss JIRA] (WFLY-3865) java:jboss/exported is not available in @PreDestroy methods during shutdown

David Lloyd (JIRA) issues at jboss.org
Fri Jan 2 15:22:30 EST 2015


    [ https://issues.jboss.org/browse/WFLY-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029717#comment-13029717 ] 

David Lloyd edited comment on WFLY-3865 at 1/2/15 3:22 PM:
-----------------------------------------------------------

You can also use @Resource and/or env-entry to bind things in a way the container can resolve.  This is covered in EE.5.4.1 of the Java EE 7 platform specification.


was (Author: dmlloyd):
You can also use @Resource and and env-entry to bind things in a way the container can resolve.  This is covered in EE.5.4.1.3 of the Java EE 7 platform specification.

> java:jboss/exported is not available in @PreDestroy methods during shutdown
> ---------------------------------------------------------------------------
>
>                 Key: WFLY-3865
>                 URL: https://issues.jboss.org/browse/WFLY-3865
>             Project: WildFly
>          Issue Type: Feature Request
>          Components: Naming
>    Affects Versions: 8.1.0.Final
>            Reporter: Kyle Lape
>            Assignee: Eduardo Martins
>
> With the following code in a class named e.g. {{JNDIBinderBean.java}}
> {code: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);
> }
> {code}
> When Wildfly shuts down, I get an error saying that the MSC service isn't available:
> {noformat}
>   javax.naming.NamingException: JBAS011836: Could not resolve service
>     service jboss.naming.context.java.jboss.exported.JNDIBinderBean
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the jboss-jira mailing list