ITeye博客

RMI,webStart配置

hotjava · 2006-12-08 20:57 · 工作 · Markdown

今天搞了一整天部署,头都大了,发现部署这事也这么讨厌,记录一下。要不然以我的惊人的记忆力,不出48小时一定会忘记的。

spring服务器端的配置

xml 代码

  1. <bean id="room" class="oss.rms.inventory.geo.business.impl.RoomImpl">
  2. <property name="roomDao">
  3. <ref bean="roomDao"/>
  4. </property>
  5. </bean>
  6. <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
  7. <property name="serviceName"><value>oss.rms.inventory.geo.business.IRoom</value></property>
  8. <property name="service"><ref bean="room"/></property>
  9. <property name="serviceInterface"><value>oss.rms.inventory.geo.business.IRoom</value></property>
  10. <property name="registryPort"><value>1099</value></property>
  11. </bean>

 

spring客户端的配置

xml 代码

  1. <bean id="room" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
  2. <property name="serviceUrl"><value>rmi://192.168.140.1:1099/oss.rms.inventory.geo.business.IRoom</value></property>
  3. <property name="serviceInterface"><value>oss.rms.inventory.geo.business.IRoom</value></property>
  4. </bean>

打JAR包:

打jar包的时候,在Eclipse的工程选择Export....,JAR file,注意一定选上Main class。就是你程序运行的启动类。

然后导出JAR包,并给Jar包签名。

1。先用keytool -genkey -alias keystore算出一个密钥,密码可以任意输入。

2。jarsigner -signedjar a.jar b.jar keystore把b.jar签名为a.jar.

3.配置jnlp文件。格式如下:

xml 代码

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <jnlp spec="1.0+" codebase="http://10.48.44.5:7001/rms" href="rms.jnlp">
  3. <information>
  4. <title>rms</title>
  5. <vendor>cattsoft</vendor>
  6. <homepage href="rms.html" />
  7. </information>
  8. <security>
  9. <all-permissions/>
  10. </security>
  11. <resources>
  12. <j2se version="1.5+" max-heap-size ="512M"/>
  13. <jar href="rms_sign.jar" />
  14. <jar href="rms_util.jar" />
  15. </resources>
  16. <application-desc main-class="oss.rms.RmsMain" />
  17. </jnlp>

index.htm文件如下:

java 代码

  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=GBK" />
  4. <title>rms</title>
  5. <script type="text/javascript">
  6. var javawsInstalled = false;
  7. var isIE = false;
  8. var isICE = navigator.userAgent.indexOf("ICEBrowser") >= 0;
  9. if (navigator.mimeTypes && navigator.mimeTypes.length)
  10. javawsInstalled = navigator.mimeTypes['application/x-java-jnlp-file'];
  11. else
  12. isIE = true;
  13. function insertLink(url, name) {
  14. if (javawsInstalled) {
  15. document.write("</p><a href=\"" + url + "\">"  + name + "</a>");
  16. } else {
  17. if (isICE) {
  18. document.write("JBuilder's Web View does not support Web Start (no appropriate Web Start plugin is available). ");
  19. document.write("Other popular (external) browsers are supported");
  20. } else {
  21. document.write("Need to install Java Web Start");
  22. }
  23. document.write(" -- for more information, visit ");
  24. document.write("<a href=\"http://java.sun.com/products/javawebstart/\">" );
  25. document.write("the Java Web Start page");
  26. document.write("</a></p>");
  27. }
  28. }
  29. </script>
  30. <script type="text/vbscript">
  31. on error resume next
  32. If isIE Then
  33. If Not(IsObject(CreateObject("JavaWebStart.IsInstalled"))) Then
  34. javawsInstalled = false
  35. Else
  36. javawsInstalled = true
  37. End If
  38. End If
  39. </script>
  40. </head>
  41. <body>
  42. <h1>Java Web Start application</h1>
  43. <script type="text/javascript">
  44. <!--
  45. insertLink("rms.jnlp","接入网");
  46. insertLink("rms.jnlp","交换网");
  47. insertLink("rmsgeo.jnlp","空间资源");
  48. insertLink("rmsdata.jnlp","基础数据网");
  49. insertLink("rmsnode.jnlp","物理设备");
  50. // -->
  51. </script>
  52. <noscript>
  53. <a href="rms.jnlp">rms</a>
  54. </noscript>
  55. </body>
  56. </html>

然后打war包,jar -cvf rms.war *,并部署到weblogic下。

Linux的Server端启动文件

java 代码

  1. #! /usr/bin/ksh
  2. if [[ -z "$JAVA_HOME" ]]
  3. then
  4. echo "Please set the JAVA_HOME environment variable"
  5. fi
  6. echo "********************"
  7. JAVA="/home/wls/bea/jdk150_04/bin/java"
  8. LIB="../lib"
  9. # set the classpath
  10. CP=$(echo ${LIB}/*.jar ./*.jar | tr ' ' ':')
  11. CP=${CP}:../lib/:../conf:..
  12. #======================================
  13. echo  ${CP}
  14. #======================================
  15. nohup ${JAVA} -Xmx512m -cp ${CP} oss.rms.RmsServer &

在Linux下执行此脚本,就能启动oss.rms.RmsServer这个jar包了,此时server端就启动了

评论(2)

  1. #2 楼 · hotjava · 2006-12-08 21:28

    累死我了.......搞了半天

  2. #1 楼 · hotjava · 2006-12-08 20:59
    aaaaa
    

评论功能维护中,当前仅展示历史评论。