[
https://issues.jboss.org/browse/WFLY-3574?page=com.atlassian.jira.plugin....
]
Michael Mutschler updated WFLY-3574:
------------------------------------
Steps to Reproduce:
In this simple example I try to remove the default ExampleDS (it should fail, but the bug
is, that I get no result)
Here is the Listener I use:
{code:title=ConfigListener.java|borderStyle=dashed}
@WebListener
public class ConfigListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
RemoveExampleDS.run();
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {}
}
{code}
RemoveExampleDS has the actual code to remove the Datasource:
{code:title=RemoveExampleDS.java|borderStyle=dashed}
public class RemoveExampleDS {
public static void run() {
try {
deleteDataSource("ExampleDS");
} catch (IOException e) { log(e); }
}
private static void deleteDataSource(String dsName) throws IOException {
log("removing datasource " + dsName);
final ModelNode request = new ModelNode();
request.get(ClientConstants.OP).set(ClientConstants.REMOVE_OPERATION);
request.get(ClientConstants.OP_ADDR).add("subsystem",
"datasources");
request.get(ClientConstants.OP_ADDR).add("data-source", dsName);
execute(request);
log("datasource " + dsName + " removed");
}
private static void execute(ModelNode request) throws IOException {
log("connecting to management");
ModelControllerClient client =
ModelControllerClient.Factory.create("localhost", 9990);
log("executing: " + request);
ModelNode response = client.execute(request);
log("response: " + response);
client.close();
log(response.get(ClientConstants.RESULT));
}
private static void log(Object o) { System.out.println(o); }
}
{code}
I packed this into a war, and it is the only war I am running in a default wildfly
installation.
The log looks like this. Note: there is no response for the remove!
{noformat}
2014-07-02 14:26:54,280 INFO [stdout] (MSC service thread 1-12) removing datasource
ExampleDS
2014-07-02 14:26:54,292 INFO [stdout] (MSC service thread 1-12) connecting to management
2014-07-02 14:26:54,317 INFO [stdout] (MSC service thread 1-12) executing: {
2014-07-02 14:26:54,318 INFO [stdout] (MSC service thread 1-12) "operation"
=> "remove",
2014-07-02 14:26:54,319 INFO [stdout] (MSC service thread 1-12) "address"
=> [
2014-07-02 14:26:54,319 INFO [stdout] (MSC service thread 1-12)
("subsystem" => "datasources"),
2014-07-02 14:26:54,319 INFO [stdout] (MSC service thread 1-12)
("data-source" => "ExampleDS")
2014-07-02 14:26:54,320 INFO [stdout] (MSC service thread 1-12) ]
2014-07-02 14:26:54,320 INFO [stdout] (MSC service thread 1-12) }
2014-07-02 14:26:54,344 INFO [org.xnio] (MSC service thread 1-12) XNIO version
3.2.2.Final
2014-07-02 14:26:54,359 INFO [org.xnio.nio] (MSC service thread 1-12) XNIO NIO
Implementation Version 3.2.2.Final
{noformat}
was:
In this simple example I try to remove the default ExampleDS (it should fail, but the bug
is, that I get no result)
Here is the Listener I use:
{code:title=ConfigListener.java|borderStyle=dashed}
@WebListener
public class ConfigListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
RemoveExampleDS.run();
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {}
}
{code}
RemoveExampleDS has the actual code to remove the Datasource:
{code:title=RemoveExampleDS.java|borderStyle=dashed}
public class RemoveExampleDS {
public static void run() {
try {
deleteDataSource("ExampleDS");
} catch (IOException e) { log(e); }
}
private static void deleteDataSource(String dsName) throws IOException {
log("removing datasource " + dsName);
final ModelNode request = new ModelNode();
request.get(ClientConstants.OP).set(ClientConstants.REMOVE_OPERATION);
request.get(ClientConstants.OP_ADDR).add("subsystem",
"datasources");
request.get(ClientConstants.OP_ADDR).add("data-source", dsName);
execute(request);
log("datasource " + dsName + " removed");
}
private static void execute(ModelNode request) throws IOException {
log("connecting to management");
ModelControllerClient client =
ModelControllerClient.Factory.create("localhost", 9990);
log("executing: " + request);
ModelNode response = client.execute(request);
log("response: " + response);
client.close();
log(response.get(ClientConstants.RESULT));
}
private static void log(Object o) { System.out.println(o); }
}
{code}
I packed this into a war, and it is the only war I am running in a default wildfly
installation.
The log looks like this. Note: there is no response for the remove!
{{
2014-07-02 14:26:54,280 INFO [stdout] (MSC service thread 1-12) removing datasource
ExampleDS
2014-07-02 14:26:54,292 INFO [stdout] (MSC service thread 1-12) connecting to management
2014-07-02 14:26:54,317 INFO [stdout] (MSC service thread 1-12) executing: {
2014-07-02 14:26:54,318 INFO [stdout] (MSC service thread 1-12) "operation"
=> "remove",
2014-07-02 14:26:54,319 INFO [stdout] (MSC service thread 1-12) "address"
=> [
2014-07-02 14:26:54,319 INFO [stdout] (MSC service thread 1-12)
("subsystem" => "datasources"),
2014-07-02 14:26:54,319 INFO [stdout] (MSC service thread 1-12)
("data-source" => "ExampleDS")
2014-07-02 14:26:54,320 INFO [stdout] (MSC service thread 1-12) ]
2014-07-02 14:26:54,320 INFO [stdout] (MSC service thread 1-12) }
2014-07-02 14:26:54,344 INFO [org.xnio] (MSC service thread 1-12) XNIO version
3.2.2.Final
2014-07-02 14:26:54,359 INFO [org.xnio.nio] (MSC service thread 1-12) XNIO NIO
Implementation Version 3.2.2.Final
}}
management API blocking write requests during initialization
------------------------------------------------------------
Key: WFLY-3574
URL:
https://issues.jboss.org/browse/WFLY-3574
Project: WildFly
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: CLI
Affects Versions: 8.1.0.Final
Environment: default configuration
Reporter: Michael Mutschler
Assignee: Alexey Loubyansky
Priority: Critical
I want to apply some configuration before the real application is starting. Mainly I want
to update a datasource. Therefore I wrote a WebListener, and during the initialization I
want to modify the wildfly configuration via management API.
I can read the configuration, but when I want to execute a delete or add request, nothing
happens; the command does not return! There seems to be a deadlock.
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)