Application.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@10.21.106.168:1521:lamis</value>
</property>
<property name="username">
<value>ham</value>
</property>
<property name="password">
<value>hamham</value>
</property>
</bean>
<bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/iaspec/workflow/bean/User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="mySessionFactory" />
</property>
</bean>
<bean id="userDAO" class="com.iaspec.workflow.dao.hibernate.UserHibernateDAO">
<property name="sessionFactory">
<ref local="mySessionFactory" />
</property>
</bean>
<bean id="txProxyTemplate" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="userServiceImpl" parent="txProxyTemplate">
<property name="target">
<bean class="com.iaspec.workflow.business.service.UserServiceImpl">
<property name="userDAO">
<ref local="userDAO"/>
</property>
</bean>
</property>
</bean>
<bean id="userServiceImplRemote" class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName">
<value>UserServiceImplRemote</value>
</property>
<property name="service">
<ref bean="userServiceImpl"/>
</property>
<property name="serviceInterface">
<value>com.iaspec.workflow.business.IUserService</value>
</property>
<property name="registryPort">
<value>1098</value>
</property>
</bean>
</beans>
client.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="ServerInfo" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl"><value>rmi://10.21.109.18:1098/UserServiceImplRemote</value></property>
<property name="serviceInterface"><value>com.iaspec.workflow.business.IUserService</value></property>
</bean>
</beans>
在测试的过程中,我发现一个错误,它总是说我不能连接上服务器,可是事实上是我已经连接上去了,因为服务器端已经有响应了,最后终于找到了一个被忽略的问题,就是被传输的对象没有Searlize,只有当被传输的对象实现Searlize接口,才能在网络上进行传输。
一个小问题,害得我弄了半天的时间,nnd