|
Spring |
|
4. D:\springdemo\rmserviceclient.java
import java.io.*;
import org.springframework.beans.factory.*;
import org.springframework.beans.factory.
xml.*;
import org.springframework.core.io.*;
class rmserviceclient {
public static void main(String args[]) {
try {
System.out.println(“Wait..”);
Resource res = new
ClassPathResource(“rmservice.xml”);
System.out.println(“wait..”);
BeanFactory factory = new
XmlBeanFactory(res);
System.out.println(“factory created”);
rmservice bean1 =
(rmservice)factory.getBean(“rmservice”);
String s = bean1.getresult(args[0]);
System.out.println(s);
}
catch(Exception e1) {
System.out.println(“”+e1);
}
}
}
To run:
D:\springdemo>javac rmservice.java
D:\springdemo>javac rmserviceimpl.java
D:\springdemo>javac rmserviceclient.java
D:\springdemo>java rmsserviceclient “Amit”
We will get Output as:
wait.
wait...
Sep 28, 2007 3:16:22 PM
org.springframework.core.CollectionFactory
<clinit>
INFO: JDK 1.4+ collections available
Sep 28, 2007 3:16:22 PM
org.springframework.beans.factory.xml.
XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from
class path resource [rmservice.xml]
here comes....
constructor ok
Hai Amit |
|
Here the service interface doesn’t extend the ‘java.rmi.Remote’ method and ‘RemoteException’ is not thrown by the
methods. There is no binding in the implementation code. Also we can direcly run
the client. Now there is no need to run the ‘rmserverimpl’ class. Also there is no need to
run the RMI registry.
|
|
Oct 2007 | Java Jazz Up | 45 |
|
|
|
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53 ,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63 ,
64,
65 ,
66 ,
67 ,
68 ,
69 ,
70,
71,
72,
73,
74,
75,
76,
77,
78,
Download PDF |
|
|
|
|
|
|
|
|
|