unreachable variable for groovy script
Hi.. I am doing a similar script to configure DB. Above is my script.
public static final instance = new ConfigurationDB ();
def String url
def String server
def String port
def String database
def String user
def String password
static getInstance() {
return instance;
}
public ConfigurationDB () {
this.server = "localhost";
this.port = "5432";
this.database = "db";
this.user = "user";
this.password = "pass";
this.url = "jdbc:postgresql://"+this.server+":"+this.port+"/"+this.database;
}
}
when I do the test separately for each value, I obtain the correct result for each one, but when I tried to test the total connector I have the next error:
Parametro de entrada script esta usando una expresion que contiene una referencia inalcanzable.
Type of expression unadmitted for the test:
Imput Parameter 'script' is using a expression that contain a unreachable variable.
thank you.. regards...
Hi Johana,
I dont understand why you need to write a script to connect to a postgresql database server (if I understand well). You have Jdbc postgresql connectors for that.
The message : Imput Parameter 'script' is using a expression that contain a unreachable variable <-- where do you use that expression 'script' ?
Comments
Hi David,
thank you for your time...
I need manage a configuration in one place because I use many connectors in my process, and my idea is when I update parameter(example change the database name or a username) in configuration, I only change in one place (in the script file in this case).
I tried create a Java Object Properties to read a properties file but I get the same error.
When I configure my connection I tried similar bellow: In connector configuration I put parameters; url, username, password Example: In username parameter I put ConfigurationDB.instance.user (when I do this I get the error "unreachable variable")
http://www.ibm.com/developerworks/library/j-bpm2/Figure26.jpg (this link is a bonita interface when I configure a connection) In this parameters I tried get the script instance. Lo que no quiero hacer es poner los parámetros en duro, por que entonces cada cambio en mi configuración implicaría tocar todos los conectores que he definido. (Sorry!! I speak spanish)
regards :)
Hi David,
I´m try do this, but don´t work for me. When I try import your connector example in my bonita (6.5.1) I get this error: "Importación ha fallado. Descriptor file not found".
When I tried create a connector definition in development -> connector -> new definition I do not see the Java connector.
Hi.. When I import the connector in menu developement > connector > import connector, I qet this error: "Importación ha fallado. Descriptor file not found".
Comments
I tried to do that, but when I go in: development -> connector -> new definition I don't see Java connector option.. :(
No sé si tiene que ver con mi versión de Bonita, estaba mirando otros ejemplos y en todos aparece como que yo puedo usar directamente ese conector, pero cuando descargue el mismo conector de otro lado, me da el mismo error.
Thank you..
You must create a definition first,
and then the java connector is created automatically when you create an implementation
Hi David..
Yesterday, I download again the connector and I import in Bonita, It's work. Perhaps the file was damaging when I download.
Now I can read the properties file and the problem is solved...
Thank you, thank you for your time.. :) regards.. que estes bien!!!
I am very glad it finally work.
Beware to put the connector where it will always be read when necessary : - as the first connector in the task when it's needed - at the process pool connector
Bien à toi