2 modify hibernate config file hibernate.cfg.xml
<property name="hibernate.connection.datasource">data source jndi</property>
<property name="hibernate.connection.username">name</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.session_factory_name">HibernateSessionFactory</property>
<property name="connection.autocommit">false</property>
<property name="net.sf.hibernate.transaction.JTATransactionFactory">net.sf.hibernate.transaction.WebSphereTransactionManagerLookup</property>
<property name="show_sql">false</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
娉ㄦ剰錛氬鏋滄槸闈炰簨鍔℃ф暟鎹簮 閭d箞鍦╤ibernate.cfg.xml 蹇呴』璁劇疆 <property name="connection.autocommit">false</property>
涓篺alse
3 create datasource jndi on was
濡傛灉鏄潪浜嬪姟鎬ф暟鎹簮錛屽湪寤虹珛鏁版嵁婧愭椂錛屼篃瑕佽緗負(fù)闈炰簨鍔℃ф暟鎹簮銆?br />
4 config custom service bean on Websphere
was console >servers> application server > server1>manage>custom service >new
5 start Server
// Allow to use ibm jdk extensions grant codeBase "file:${was.install.root}/java/ext/-" { permission java.security.AllPermission; }; // Allow to use ibm tools grant codeBase "file:${was.install.root}/java/tools/ibmtools.jar" { permission java.security.AllPermission; }; // Allow to use sun tools grant codeBase "file:/QIBM/ProdData/Java400/jdk14/lib/tools.jar" { permission java.security.AllPermission; }; // Allow to use sun tools (V5R2M0 codebase) grant codeBase "file:/QIBM/ProdData/OS400/Java400/jdk/lib/tools.jar" { permission java.security.AllPermission; }; // WebSphere system classes grant codeBase "file:${was.install.root}/plugins/-" { permission java.security.AllPermission; }; grant codeBase "file:${was.install.root}/lib/-" { permission java.security.AllPermission; }; grant codeBase "file:${was.install.root}/classes/-" { permission java.security.AllPermission; }; // Allow the WebSphere deploy tool all permissions grant codeBase "file:${was.install.root}/deploytool/-" { permission java.security.AllPermission; }; // Allow the WebSphere deploy tool all permissions grant codeBase "file:${was.install.root}/optionalLibraries/-" { permission java.security.AllPermission; }; // Allow Channel Framework classes all permission grant codeBase "file:${was.install.root}/installedChannels/-" { permission java.security.AllPermission; }; grant codeBase "file:${user.install.root}/lib/-" { permission java.security.AllPermission; }; grant codeBase "file:${user.install.root}/classes/-" { permission java.security.AllPermission; };
濡傛灉鑺傜偣涓婃湁涓浜涙湇鍔″櫒紼嬪簭闇瑕佽鍙潈錛岃岃繖浜涜鍙潈鍦?server.policy 鏂囦歡鍜?server.policy 鏂囦歡涓湭瀹氫箟涓虹己鐪佸鹼紝閭d箞鏇存柊 server.policy 鏂囦歡銆傜己灝戣鍙潈?yōu)畣鍒涘?java.security.AccessControlException 寮傚父銆傜己灝戠殑璁稿彲鏉冨湪寮傚父鏁版嵁涓垪紺恒?
鐒跺悗閲嶆柊鍚姩鏈嶅姟鍣?/p>
The createEJBStubs tool
Even though the Just-In-Time deployment feature will, in many cases, dynamically generate the RMI-IIOP stub classes that are required for invocation of remote EJB interfaces, there remain some cases where these stub classes are not dynamically generated. For EJB 3.0 clients not running inside a WebSphere feature-pack-upgraded web container, EJB container, or client container, it is necessary for you to generate the stub classes with the createEJBStubs tool, then make the generated stubs available in the client environment's classpath. Typically you would accomplish this by copying the generated stubs to the location where the client's business interface class resides.
To summarize, the createEJBStubs tool must be used to generate client-side stubs for the following environments:
* "Bare" Java SE clients, where a Java SE JVM is the client environment
* WebSphere Application Server container environments without the EJB 3.0 feature pack applied
* Non-WebSphere application server environments