今天搞了一整天部署,头都大了,发现部署这事也这么讨厌,记录一下。要不然以我的惊人的记忆力,不出48小时一定会忘记的。
spring服务器端的配置
xml 代码
- <bean id="room" class="oss.rms.inventory.geo.business.impl.RoomImpl">
- <property name="roomDao">
- <ref bean="roomDao"/>
- </property>
- </bean>
- <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
- <property name="serviceName"><value>oss.rms.inventory.geo.business.IRoom</value></property>
- <property name="service"><ref bean="room"/></property>
- <property name="serviceInterface"><value>oss.rms.inventory.geo.business.IRoom</value></property>
- <property name="registryPort"><value>1099</value></property>
- </bean>
spring客户端的配置
xml 代码
- <bean id="room" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
- <property name="serviceUrl"><value>rmi://192.168.140.1:1099/oss.rms.inventory.geo.business.IRoom</value></property>
- <property name="serviceInterface"><value>oss.rms.inventory.geo.business.IRoom</value></property>
- </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 代码
- <?xml version="1.0" encoding="UTF-8"?>
- <jnlp spec="1.0+" codebase="http://10.48.44.5:7001/rms" href="rms.jnlp">
- <information>
- <title>rms</title>
- <vendor>cattsoft</vendor>
- <homepage href="rms.html" />
- </information>
- <security>
- <all-permissions/>
- </security>
- <resources>
- <j2se version="1.5+" max-heap-size ="512M"/>
- <jar href="rms_sign.jar" />
- <jar href="rms_util.jar" />
- </resources>
- <application-desc main-class="oss.rms.RmsMain" />
- </jnlp>
index.htm文件如下:
java 代码
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=GBK" />
- <title>rms</title>
- <script type="text/javascript">
- var javawsInstalled = false;
- var isIE = false;
- var isICE = navigator.userAgent.indexOf("ICEBrowser") >= 0;
- if (navigator.mimeTypes && navigator.mimeTypes.length)
- javawsInstalled = navigator.mimeTypes['application/x-java-jnlp-file'];
- else
- isIE = true;
- function insertLink(url, name) {
- if (javawsInstalled) {
- document.write("</p><a href=\"" + url + "\">" + name + "</a>");
- } else {
- if (isICE) {
- document.write("JBuilder's Web View does not support Web Start (no appropriate Web Start plugin is available). ");
- document.write("Other popular (external) browsers are supported");
- } else {
- document.write("Need to install Java Web Start");
- }
- document.write(" -- for more information, visit ");
- document.write("<a href=\"http://java.sun.com/products/javawebstart/\">" );
- document.write("the Java Web Start page");
- document.write("</a></p>");
- }
- }
- </script>
- <script type="text/vbscript">
- on error resume next
- If isIE Then
- If Not(IsObject(CreateObject("JavaWebStart.IsInstalled"))) Then
- javawsInstalled = false
- Else
- javawsInstalled = true
- End If
- End If
- </script>
- </head>
- <body>
- <h1>Java Web Start application</h1>
- <script type="text/javascript">
- <!--
- insertLink("rms.jnlp","接入网");
- insertLink("rms.jnlp","交换网");
- insertLink("rmsgeo.jnlp","空间资源");
- insertLink("rmsdata.jnlp","基础数据网");
- insertLink("rmsnode.jnlp","物理设备");
- // -->
- </script>
- <noscript>
- <a href="rms.jnlp">rms</a>
- </noscript>
- </body>
- </html>
然后打war包,jar -cvf rms.war *,并部署到weblogic下。
Linux的Server端启动文件
java 代码
- #! /usr/bin/ksh
- if [[ -z "$JAVA_HOME" ]]
- then
- echo "Please set the JAVA_HOME environment variable"
- fi
- echo "********************"
- JAVA="/home/wls/bea/jdk150_04/bin/java"
- LIB="../lib"
- # set the classpath
- CP=$(echo ${LIB}/*.jar ./*.jar | tr ' ' ':')
- CP=${CP}:../lib/:../conf:..
- #======================================
- echo ${CP}
- #======================================
- nohup ${JAVA} -Xmx512m -cp ${CP} oss.rms.RmsServer &
在Linux下执行此脚本,就能启动oss.rms.RmsServer这个jar包了,此时server端就启动了