cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to use my oracle database even after configuring db.properties file.

shivam_0311
Champ in-the-making
Champ in-the-making
My db.properties file contains..

db=oracle
jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbcSmiley Surprisedracle:thin:@MY_IP:xe
jdbc.username=myusername
jdbc.password=mypassword

and I am trying to run the bookOrder example from chapter1 of "Activiti in Action". On running this example i am getting following errors:


18 Feb 2016 16:33:29,423 [main] ERROR org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl:846 - Exception while initializing Database connection
org.h2.jdbc.JdbcSQLException: Connection is broken: "java.net.ConnectException: Connection refused: connect: localhost" [90067-176]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
   at org.h2.message.DbException.get(DbException.java:167)
   at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:434)
   at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:311)
   at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
   at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
   at org.h2.Driver.connect(Driver.java:74)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:201)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:196)
   at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:93)
   at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:385)
   at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:89)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDatabaseType(ProcessEngineConfigurationImpl.java:835)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDataSource(ProcessEngineConfigurationImpl.java:786)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:602)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:590)
   at BookOrderTest.startBookOrder(BookOrderTest.java:26)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(Unknown Source)
   at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
   at java.net.PlainSocketImpl.connect(Unknown Source)
   at java.net.SocksSocketImpl.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at org.h2.util.NetUtils.createSocket(NetUtils.java:123)
   at org.h2.util.NetUtils.createSocket(NetUtils.java:103)
   at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:100)
   at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:430)
   … 39 more
9 REPLIES 9

hari
Star Contributor
Star Contributor
Hi Shivam,
Is the oracle service up and running when you tried to execute this ?
If its up, please check the connection url again.

shivam_0311
Champ in-the-making
Champ in-the-making
Thanks Harikiran,
yes, oracle service is up.and my jdbcUrl is jdbcSmiley Surprisedracle:thin:@MY_IP:1521:xe
i wrote wrong url in above post by mistake.
but still facing the issue.

hari
Star Contributor
Star Contributor
Unfortunately I use a different database so just cant give you the exact answer.
Can you do a quick check if everythings fine by writing a piece of java code to connect to database. If that gets connected then we should look at whats wrong here. Else you know where to look for.

shivam_0311
Champ in-the-making
Champ in-the-making
Yes,there is no issue with oracle database connection as my another application is working fine with the same database.
I am trying to run the application given in following link
http://www.codeproject.com/Tips/699392/Step-by-Step-your-First-journey-with-Activiti?fid=1849867&sel...
I am seeing in the error that still this application is trying to connect to h2 localhost even after changing db.properties and activiti.cfg.xml.

hari
Star Contributor
Star Contributor
I hope you have changed the db.properties in the below path.
<catalina_home>\webapps\activiti-explorer\WEB-INF\classes\db.properties.

Also I believe you have changed it in activiti.cfg.xml. Am I correct ? If so ideally it has to connect to which ever you have defined.

shivam_0311
Champ in-the-making
Champ in-the-making
Yes, I have changed db.properties in the above mentioned path.
My activiti.cfg.xml is as given below.

and I have put it in the class path of my activiti project and (in webapps\activiti-explorer\WEB-INF\classes and in webapps\activiti-explorer\WEB-INF\lib folder.  (As I have read to put it in such locations in this forum itself)).
Is there any need to put it in other locations?

And i also want to mention that activiti-explorer is working fine with my oracle database,I am able to create task and users as well.But through creating activiti project in eclipse is not going to work with the same database.

hari
Star Contributor
Star Contributor
I am not really sure whats wrong at your end but just to help you out, please refer to the below code snippet. I think this might be helpful to you.  That's a standalone java code and I hope you should be able to take it forward from here.
<java>
public static void main(String args[]){
  ProcessEngine processEngineInstance = ProcessEngineConfiguration
    .createStandaloneProcessEngineConfiguration()
    .setJdbcDriver("oracle.jdbc.driver.OracleDriver")
    .setJdbcUrl("jdbcSmiley Surprisedracle:thin:@MY_IP:1521:xe")
    .setJdbcPassword("MY_user")
    .setJdbcUsername("MY_pass")
    .buildProcessEngine();
   
  List<Task> tasks = processEngineInstance.getTaskService().createTaskQuery().taskAssignee("Kermit").list();
}
</java>
The above code gets all the tasks assigned to user Kermit from your database.

shivam_0311
Champ in-the-making
Champ in-the-making
Thanks , This code is working fine with my oracle database and I am able to fetch all assigned tasks to kermit.
But if you find the solution to my exact problem(Using Activiti Project with BPMN20.xml files),then please let me know.

hari
Star Contributor
Star Contributor
When the above thing works, you can just read the username, pwd, driver and connection string from a properties file and get your work done.