[jboss-jira] [JBoss JIRA] (WFLY-13697) JBoss CLI can't find java:app/AppName
Michal Petrov (Jira)
issues at jboss.org
Mon Jul 27 08:58:00 EDT 2020
[ https://issues.redhat.com/browse/WFLY-13697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14299561#comment-14299561 ]
Michal Petrov commented on WFLY-13697:
--------------------------------------
The proper naming context is set up via [JavaNamespaceSetup|https://github.com/wildfly/wildfly/blob/master/ee/src/main/java/org/jboss/as/ee/naming/JavaNamespaceSetup.java] which is tied to a deployment, so when the action comes from CLI or HAL the context is not set. I don't think this can be solved with CLI, the contexts are managed by Naming/EE and those are not a part of core. I'm guessing the context can be set when connection is established by CLI but I don't know if that's the way to go.
> JBoss CLI can't find java:app/AppName
> -------------------------------------
>
> Key: WFLY-13697
> URL: https://issues.redhat.com/browse/WFLY-13697
> Project: WildFly
> Issue Type: Bug
> Components: CLI
> Affects Versions: JBoss AS7 7.2.0.Final
> Reporter: José Fernando Tepedino Martins
> Assignee: Michal Petrov
> Priority: Minor
> Labels: CLI, JNDI
>
> With a JEE aplication in a WAR package, when starting a functionality, as a Batch Job, via CLI, CDI injection and JNDI lookup fail to find resources 'java:app/AppName' and 'java:module/ModuleName'.
> For example, a job listener or other job artifact with the following code
> {code:java}
> @Resource(lookup="java:app/AppName")
> private String applicationName;{code}
> or
> {code:java}
> private String applicationName;
> @PostConstruct
> protected void initialize() throws NamingException {
> applicationName = InitialContext.doLookup("java:app/AppName");
> }{code}
> when the batch job is started from JBoss CLI, the following error will be logged:
> {code:java}
> javax.naming.NameNotFoundException: java:app/AppName
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list