views:

23

answers:

1

For my services in production environment I always set up DB connections pool in Tomcat's context.xml:

<Resource name="jdbc/MyDB" auth="Container" type="javax.sql.DataSource"
    maxActive="256" maxIdle="5" maxWait="10000"
    removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
    username="xxx" password="xxx" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://host:3306/dbname?autoReconnect=true"
    validationQuery="SELECT 1"
/>

Then later in my service I use:

InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MyDB");
Connection db = ds.getConnection(); 

For development I want to run Axis2 standalone - is there a way how I could set up somewhere DB connections pool in Axis as well so I would not need to modify service code and use it the same way as with Tomcat?

A: 

Why not have different context.xml files for different environments.

e.g.

context_DEV.xml
context_UAT.xml
context_PROD.xml

and then use a symlink to point to the correct one.

e.g.

context.xml -> context_DEV.xml

Also, see this thread which recommends using a servlet container (such as Tomcat) rather than axis2 standalone server for stability.

dogbane
This would be possible, but my goal is to do not use Tomcat at all...
Laimoncijus
But Axis runs within a servlet container, such as Tomcat, Weblogic, Jetty or WebSphere. You can't run it standalone.
dogbane
If you download Standard Binary Distribution you can run Axis2 as a Standalone Server: http://ws.apache.org/axis2/1_3/installationguide.html#standalone
Laimoncijus
Thanks I didn't know that.
dogbane