Programming and So

Tips and tricks in Java

Archive for February 2009

Spring WS web app deployment on different application servers

without comments

JEE libraries dependencies is one of the most delicate processes when configuring any web app deployment. Many developers include extra libraries, incoherent combinations of library versions or releases non approved for production environments due to lack of documentation or knowledge. Maven have contributed to make this process easier, however there is a long way to walk in this issue yet.

In the last years some services have been created to help with this dark task:

Below a sample configuration for a Spring WS web app with XWSS support on several application servers is exposed.

First of all, note that Spring’s application context file must declare SAAJ 1.3 usage to avoid application server dependencies problems.

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
  <property name="messageFactory">
    <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/>
  </property>
</bean>

Following WEB-INF/lib content by application server is required in order to achieve desired configuration.

Oracle Weblogic 10

Logging

Spring 2.0

Spring WS 1.0

XWSS 3.0

SUN Glassfish 2.1

It works with exactly the same configuration Weblogic 10 has. 

IBM WebSphere 6.1

Following libraries must be added to Weblogic 10 configuration.

JAXP 1.4.2

StAX 1.0

SAAJ 1.3.2

Apache Tomcat 6.0

Following libraries must be added to Weblogic 10 configuration.

Spring WS 1.0 (JDK 6 required libraries)

SAAJ 1.3.2

 

Final considerations

As it can be seen, every included library is identified by version and origin.

Written by angelborroy

February 13, 2009 at 11:49 am

Posted in java

Tagged with

Oracle JDBC: Implicit Connection Caching bug exposed

without comments

References:

Note. Following code behaves equal in standalone or application server environments.

Right way

// IBM's example
// The following property ordering results in
// a cache being created.

OracleDataSource ods = new OracleDataSource();

ods.setConnectionCachingEnabled(true);
ods.setURL("jdbc:" + "oracle:thin:@localhost:1521:IBM");
ods.setConnectionCacheName("ICC");

ods.setUser("scott");
ods.setPassword("manager1");

Wrong way

// ORACLE's example
// The following property ordering causes no exception,
// but no cache is created.

// create a DataSource
OracleDataSource ods = new OracleDataSource();

// set cache properties
java.util.Properties prop = new java.util.Properties();
prop.setProperty("MinLimit", "2");
prop.setProperty("MaxLimit", "10");

// set DataSource properties
String url = "jdbc:" + "oracle:thin:@";
ods.setURL(url);
ods.setUser("hr");
ods.setPassword("hr");
ods.setConnectionCachingEnabled(true); // be sure set to true
ods.setConnectionCacheProperties (prop);
ods.setConnectionCacheName("ImplicitCache01"); // this cache's name

Oracle documentation includes an example with the incorrect order and has no reference to the bug!

Written by angelborroy

February 2, 2009 at 6:24 pm

Posted in java

Tagged with ,