移植工作已经结束了。最后在linux测试,是直接支持的,只是编码问题要注意,修改/etc/sysconfig/i18n为:LANG="zh_CN.GBK" SYSFONT="latarcyrheb-sun16"。这样工作流和许可证的编码就不会有问题,但linux的桌面就乱码了。。。也许可以用UTF-8
1.关于数据源加密的。数据源加密还是很有意义的,起码表面看起来比较放心,方法是修改源代码,百度上基本都可以找到那几篇类似的文章,我也觉得不可能有一种方式可以不修改源代码可以做到数据源的,毕竟加密解密方式是千奇百怪的。 我在context.xml里配置的数据源如下:
<Resource driverClassName="oracle.jdbc.driver.OracleDriver"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
name="ORACLEDS_ES_SYSTEM"
password="${com.shine.pub.database.es_system.encrypt_password}"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@${com.shine.pub.database.es_system.address}:${com.shine.pub.database.es_system.port}:${com.shine.pub.database.es_system.sid}" username="${com.shine.pub.database.es_system.user}">
</Resource>
数据源的工厂就是BasicDataSourceFactory,只要下载commons-dbcp-1.4的源代码,改完以后,覆盖到${catalina.home}/lib就好了。
2.关于欢迎首页。启动Tomcat后在地址栏输入:http://localhost:8080的跳转到tomcat的欢迎界面,但如果我们想让它跳转到登入界面,怎么做呢?我上网搜了下,然后有了一个比较好的方式:
首先保证你的项目输入:http://localhost:8080/cas/login有登录界面可以弹出
然后在${catalina.home}/webapps/ROOT下增加一个cas_login.jsp内容就一句话: <%response.sendRedirect("/cas/login");%>
最后在${catalina.home}/webapps/ROOT/WEB-INF/web.xml中增加一个节点:
<welcome-file-list>
<welcome-file>cas_login.jsp</welcome-file>
</welcome-file-list>
3.关于Tomcat的版本支持。现在用到的版本是Tomcat6+,经过初步的测试。
Tomcat5.5是不支持的:因为5.5的serlet版本为2.4而tuscany1.6要求的版本为2.5
Tomcat7+,是可以支持的
Tomcat8RC不行,会报:unsupported major.minor.version 51.0,因为Tomcat8开始用JDK7编译了,而在中国普及开来还需要很久的,暂且放下。
4.关于linux的jdk环境的。用文本编辑器打开/etc/profile,在profile文件末尾加入:
JAVA_HOME=/usr/share/jdk1.5.0_05
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
5.关于linux杀进程的。运行shutdown.sh老是报如下错误,搜了下说是tomcat的进程没有真正关闭造成的,其实想想windows也有类似的情况,运行tomcat的虚拟机还在跑。
Aug 23, 2013 5:22:48 PMorg.apache.catalina.core.AprLifecycleListener init
INFO: The APR basedApache Tomcat Native library which allows optimal performance in productionenvironments was not found on the java.library.path:/usr/java/jdk1.6.0_20/jre/lib/amd64/server:/usr/java/jdk1.6.0_20/jre/lib/amd64:/usr/java/jdk1.6.0_20/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Aug 23, 2013 5:22:50 PMorg.apache.coyote.http11.Http11Protocol init
SEVERE: Errorinitializing endpoint
java.net.BindException:Address already in use /0.0.0.0:8080
我只想知道跑tomcat的虚拟机的进程号是哪一个,然后杀。只要:pgrep -l java和kill -9 xxpid就够用了。
6如何让URL在linux和windows通用:
项目里需要找一个xml配置,完成缓存配置。
//支持linux识别
String home = StringUtils.replace(System.getProperty("catalina.home"), "\\", "/");
System.setProperty("com.shine.pub.conf.url", "file:"+home+"/conf/shine");
然后拼接路径new URL(“xxx”)就可以了。
附上URL如何在Linux获得支撑的官方文档:
file - Normal file
file://ip_server/path_segments
file:path_segments
This represents a fileor directory accessible locally. As aspecial
case, ip_server can be the string "localhost" or the emptystring;
this is interpreted as "themachine from which the URL is being
interpreted". If the path is to a directory, the viewershould dis-
play the directory's contents withlinks to each containee; not all
viewers currently do this. KDE supports generated files throughthe
URL <file:/cgi-bin>. If the given file isn't found, browserwriters
may want to try to expand thefilename via filename globbing (see
glob(7) and glob(3)).
The second format(e.g., <file:/etc/passwd>) is acorrect format for
referring to a local file. However, older standards did notpermit
this format, and some programsdon't recognize this as a URI. Amore
portable syntax is to use an emptystring as the server name, for
example, <file:///etc/passwd>; this form does the samething and is
easily recognized by patternmatchers and older programs as a URI.
Note that if you really mean tosay "start from the current loca-
tion," don't specify thescheme at all; use a relative address like
<../test.txt>, which has theside-effect of being scheme-independent.
An example of this scheme is <file:///etc/passwd>.
源文档 <http://www.man7.org/linux/man-pages/man7/url.7.html>
7.不对catalina.sh做改动,完成JAVA_OPTS设置
原理:运行exec,将停止当前进程,然后将PID,系统变量留给子进程
export JAVA_OPTS="-Xms$JVM_XMS -Xmx$JVM_XMX -XX:MaxPermSize=$JVM_MaxPermSize -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages -XX:ParallelGCThreads=8"
附上一些资料:
inux中shell变量$#,$@,$0,$1,$2的含义解释:
变量说明:
$$
Shell本身的PID(ProcessID)
$!
Shell最后运行的后台Process的PID
$?
最后运行的命令的结束代码(返回值)
$-
使用Set命令设定的Flag一览
$*
所有参数列表。如"$*"用「"」括起来的情况、以"$1$2 … $n"的形式输出所有参数。
$@
所有参数列表。如"$@"用「"」括起来的情况、以"$1""$2" … "$n" 的形式输出所有参数。
$#
添加到Shell的参数个数
$0
Shell本身的文件名
$1~$n
添加到Shell的各参数值。$1是第1参数、$2是第2参数…。
示例:
1 #!/bin/bash
2 #
3 printf"The complete list is %s\n" "$$"
4 printf"The complete list is %s\n" "$!"
5 printf"The complete list is %s\n" "$?"
6 printf"The complete list is %s\n" "$*"
7 printf"The complete list is %s\n" "$@"
8 printf"The complete list is %s\n" "$#"
9 printf"The complete list is %s\n" "$0"
10 printf "Thecomplete list is %s\n" "$1"
11 printf "Thecomplete list is %s\n" "$2
结果:
[Aric@localhost ~]$bash params.sh 123456 QQ
The complete list is24249
The complete list is
The complete list is 0
The complete list is123456 QQ
The complete list is123456
The complete list is QQ
The complete list is 2
The complete list isparams.sh
The complete list is123456
The complete list is QQ
Have a nice day!!!
源文档 <http://www.cnblogs.com/fhefh/archive/2011/04/15/2017613.html>
单引号与双引号的最大不同在于双引号仍然可以保有变量的内容,但单引号内仅能是
一般字符 ,而不会有特殊符号。我们以底下的例子做说明:假设您定义了一个变量,
name=VBird ,现在想以 name这个变量的内容定义出 myname 显示 VBird its me 这
个内容,要如何订定呢?
[root@linux ~]#name=VBird
[root@linux ~]# echo$name
VBird
[root@linux ~]#myname="$name its me"
[root@linux ~]# echo$myname
VBird its me
[root@linux ~]#myname='$name its me'
[root@linux ~]# echo$myname
$name its me
发现了吗?没错!使用了单引号的时候,那么$name 将失去原有的变量内容, 仅为
一般字符的显示型态而已!这里必需要特别小心在意!
本文出自 51CTO.COM技术博客