ejb-jar.xml in ejb/META-INF
... ...
XPCDataSource
javax.sql.DataSource
Application
Shareable
jboss.xml in ejb/META-INF
"-//JBoss//DTD JBOSS 3.0//EN"
">
CacheDemo1
ejb/CacheDemo1
ejb/CacheDemo1Local
XPCDataSource
java:/XPCDataSource
web.xml in web/WEB-INF
XPCDataSource
javax.sql.DataSource
Application
Shareable
jboss-web.xml in web/WEB-INF
XPCDataSource
java:/XPCDataSource
创建Data Source
Context c = new InitialContext();
Object obj = c.lookup("java:comp/env/XPCDataSource");
DataSource ds = (DataSource)narrow(obj, DataSource.class);
connection = ds.getConnection();
取得Transaction
//context is javax.ejb.SessionContext
//Transaction should be getten from EJB
UserTransaction tx = context.getUserTransaction();
Webspere deployer will change ejb-jar.xml. Never put struts to Webspere/lib/ext