Can not create a datasource with the name "jdbc/EmployeeDatasource" from console
--------------------------------------------------------------------------------
Key: GERONIMO-2314
URL: http://issues.apache.org/jira/browse/GERONIMO-2314
Project: Geronimo
Issue Type: Bug
Security Level: public(Regular issues)
Components: console
Affects Versions: 1.1, 1.1.1, 1.1.2, 1.2
Reporter: Yunfeng Ma
Fix For: 1.1.2, 1.2
Attachments: G2314-1.1.patch
Follow the database pool wizard, create a datasource with the name
"jdbc/EmployeeDatasource", the connection test is successful, but when click on the
button "deploy", see the following stacktrace in the server output window:
org.apache.geronimo.common.DeploymentException:
java.lang.IllegalArgumentException: Invalid id:
console.dbpool/jdbc/EmployeeDatasource/1.0/rar
at
org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:364)
at
org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:124)
at
org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.invoke(<generated>)
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:122)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:852)
at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
at
org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:106)
at
org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:60)
at java.lang.Thread.run(Thread.java:797)
Caused by:
java.lang.IllegalArgumentException: Invalid id: console.dbpool/jdbc/EmployeeDatasource/1.0/rar
at
org.apache.geronimo.kernel.repository.Artifact.create(Artifact.java:49)
at
org.apache.geronimo.deployment.Deployer.notifyWatchers(Deployer.java:376)
at
org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:325)
... 10 more
This error just happens in the condition of the database pool name includes the character "/", such
as "jdbc/EmployeeDatasource". If database pool name is "EmployeeDatasource", then
everything is OK.
Have a look at the souce codes of Artifact.java, the snippet of create method
as following:
public static Artifact create(String id) {
String[] parts = id.split("/", -1);
if (parts.length != 4) {
throw new IllegalArgumentException("Invalid id: " + id);
}
for (int i = 0; i < parts.length; i++) {
if (parts[i].equals("")) {
parts[i] = null;
}
}
return new Artifact(parts[0], parts[1], parts[2], parts[3]);
}
If database pool name is "jdbc/EmployeeDatasource", the parts.length would be 5
and IllegalArgumentException would be throwed.