[JBoss JIRA] Created: (JBDEPLOY-228) Applications deployed using MainDeployer.deploy does not get started when the server is restared
by Rammohan Yadavalli (JIRA)
Applications deployed using MainDeployer.deploy does not get started when the server is restared
------------------------------------------------------------------------------------------------
Key: JBDEPLOY-228
URL: https://jira.jboss.org/jira/browse/JBDEPLOY-228
Project: JBoss Deployers
Issue Type: Bug
Reporter: Rammohan Yadavalli
Hi,
I used the below MainDeployer.deploy to deploy WAR from the folder outside JBoss deploy folder. I have used the below ant script to perform this task.
<jmx serverURL="localhost">
<invoke target="jboss.system:service=MainDeployer"
operation="deploy">
<parameter type="java.lang.String"
arg="file:${webapp.dist}/${webapp.war}"/>
</invoke>
</jmx>
I am able to deploy and redeploy the applications, however, when i restart my jboss server all the applications that are deployed using the jmx operation (MainDeployer.deploy) are not getting started automatically.
I am not sure why this happens, when I copy the WAR to deploy folder the WAR gets started when the server is restarted. Can you please let me know what needs to be done in order to automatically start the applications that are deployed using MainDeployer.deploy jmx operation?
Thanks,
Ram
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months
[JBoss JIRA] Created: (JBRULES-2420) Be able to call drools-server without creating an agent configuration file
by Régis Ramillien (JIRA)
Be able to call drools-server without creating an agent configuration file
--------------------------------------------------------------------------
Key: JBRULES-2420
URL: https://jira.jboss.org/jira/browse/JBRULES-2420
Project: Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Affects Versions: 5.0.1.FINAL
Reporter: Régis Ramillien
Assignee: Mark Proctor
Creating snapshots can be done dynamically in guvnor.
drools-server should allow to call such elements without human intervention.
For now, we have to manually create an agent configuration file in the resources folder of drools-server.
Using the servlet parameters to dynamically generate a default agent configuration could be usefull for many cases and can be done very easily.
Here is a simple modification of some methods of the KnowledgeStatelessServlet.java.
The behavior is simple. We assume than the URL called finish with the package name (So, the agent name should be the same as the package).
We also assume that all released package snapshots have the same name. (For instance, for a package 'my_package1', the rules to use in production are stored in a snapshot called 'release').
Therefore, the drools-server URL to call by the application should be
- http://localhost:9085/drools-guvnor/org.drools.guvnor.Guvnor/my_package1/
And drools-server should call the following url of guvnor
- http://localhost:9085/drools-guvnor/org.drools.guvnor.Guvnor/package/my_p...
Here is the code for doing this:
{code}RuleBase getRuleBase(String configName) {
if (cachedAgents.containsKey(configName)) {
return cachedAgents.get(configName).getRuleBase();
} else {
synchronized (cachedAgents) {
if (!cachedAgents.containsKey(configName)) {
//Check for agent configuration existence or create it
Properties configProperties = checkAgentConfigExistenz(configName);
try {
RuleAgent ag = RuleAgent.newRuleAgent(configProperties);
cachedAgents.put(configName, ag);
} catch (NullPointerException npe) {
npe.printStackTrace();
return null;
}
}
return cachedAgents.get(configName).getRuleBase();
}
}
}
protected Properties checkAgentConfigExistenz(String configName) {
//Get the folder where resources goes
URL root = KnowledgeStatelessServlet.class.getClassLoader().getResource(DEFAULT_SERVER_PROPERTIES_FILE);
String rootPath = root.getPath().replace(DEFAULT_SERVER_PROPERTIES_FILE, "");
//Get the agent file path
String configFilePath = rootPath + configName
+ ".properties";
File configFile = new File(configFilePath);
Properties configProperties = null;
//If agent config does not exists, create it using default parameters
if (!configFile.exists()) {
configProperties = createConfigFile(configName, configFilePath);
}
return configProperties;
}
protected Properties createConfigFile(String configName, String configFilePath) {
//Get default properties and populate new config file with these guys
Properties defaultProperties = loadFromProperties(DEFAULT_SERVER_PROPERTIES_FILE);
String releaseName = (String) defaultProperties
.get("snapshot.release.name");
Properties ruleAgentProperties = new Properties();
ruleAgentProperties.put("name", configName);
ruleAgentProperties.put("newInstance", defaultProperties
.get("newInstance"));
ruleAgentProperties.put("poll", defaultProperties.get("poll"));
String url = ((String) defaultProperties.get("guvnor.url"))
+ configName + "/" + releaseName;
ruleAgentProperties.put("url", url);
//Save agent configuration
try {
FileOutputStream propertiesOutput = new FileOutputStream(configFilePath);
try {
ruleAgentProperties.store(propertiesOutput, null);
} catch (IOException e) {
throw new RuntimeDroolsException("Unable to store properties.",
e);
} finally {
try {
propertiesOutput.close();
} catch (IOException e) {
throw new RuntimeDroolsException(
"Unable to store properties. Could not close OutputStream.",
e);
}
}
} catch (FileNotFoundException e) {
throw new RuntimeDroolsException("Unable to store properties.", e);
}
return ruleAgentProperties;
}
static Properties loadFromProperties(String propsFileName) {
InputStream in = KnowledgeStatelessServlet.class.getClassLoader().getResourceAsStream(propsFileName);
Properties props = new Properties();
try {
props.load(in);
return props;
} catch (IOException e) {
throw new RuntimeDroolsException(
"Unable to load properties. Needs to be the path and name of a config file on your classpath.",
e);
} finally {
if (null != in) {
try {
in.close();
} catch (IOException e) {
throw new RuntimeDroolsException(
"Unable to load properties. Could not close InputStream.",
e);
}
}
}
}{code}
Here is a sample default property file
{code}guvnor.url=http://localhost:9085/drools-guvnor/org.drools.guvnor.Guvnor/package/
snapshot.release.name=release
newInstance=true
poll=60{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months