views:

40

answers:

1

I have a Java application. I created a OSGi bundle and in Activator.start i added MyMain Class.main() .Application started but it have a problem with DB connection. 'java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.' If i start my application as an application it works fine. What is wrong? Thanks a lot!

A: 

Not sure exactly what you have done, but there is no need for a main method when using OSGi. A main method is for starting your program, which in this case is the OSGi container, NOT your code. The container will run your code by running your Activator class, and in here you can instantiate your own application specific objects and call whatever methods are appropriate.

Since you haven't posted the code (you should), I can only guess that you are creating your DB connection in your main method instead of a normal method, which is why it is not working, since the main is not called.

Robin