有个人对James .领导的JSR-99.groovy Language specification
进展缓慢非常不满.要求James改进工作方法,并寻找熟悉语言规范文档规范的助手来做.
并对Groovy语言目前竟然没有完全的语言手册大大不满.
Re: [groovy-dev] Pragmatic Groovy Development and Project
老外也是整天喜欢搞政治的.
星期三, 一月 26, 2005
星期二, 一月 25, 2005
JBOSS JAAS 403错误解决问题.
问题描述:
当使用JAAS Login成功后,访问任何页面出现:
HTTP Status 403 - Access to the requested resource has been denied
错误
分析:
当使用JAAS login的时候.在login jsp里包括如下Form:
在conf/login-config.xml包含如下:
<application-policy name = "Demo">
<authentication>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag = "required">
<module-option name = "dsJndiName">java:/MySqlDS</module-option>
<module-option name = "principalsQuery">
Select userpassword from sys_L_UserLogin where userid = ?
</module-option>
<module-option name = "rolesQuery">
Select roleid,roleid as Role from sys_L_UserRole where userid =?
</module-option>
</login-module>
</authentication>
</application-policy>
在web.xml包含如下:
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>/Demo/*.jsp</url-pattern>
<url-pattern>*.*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Demo</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error_error.jsp</form-error-page>
</form-login-config>
</login-config>
注意红色部分.
出现403 错误:
jboss-web.xml 包含:
<同jboss-web.xml中的 <security-domain>java:/jaas/Demo</security-domain>相同>
当使用JAAS Login成功后,访问任何页面出现:
HTTP Status 403 - Access to the requested resource has been denied
错误
分析:
当使用JAAS login的时候.在login jsp里包括如下Form:
在conf/login-config.xml包含如下:
<application-policy name = "Demo">
<authentication>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag = "required">
<module-option name = "dsJndiName">java:/MySqlDS</module-option>
<module-option name = "principalsQuery">
Select userpassword from sys_L_UserLogin where userid = ?
</module-option>
<module-option name = "rolesQuery">
Select roleid,roleid as Role from sys_L_UserRole where userid =?
</module-option>
</login-module>
</authentication>
</application-policy>
在web.xml包含如下:
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>/Demo/*.jsp</url-pattern>
<url-pattern>*.*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Demo</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error_error.jsp</form-error-page>
</form-login-config>
</login-config>
注意红色部分.
出现403 错误:
jboss-web.xml 包含:
<同jboss-web.xml中的 <security-domain>java:/jaas/Demo</security-domain>相同>
星期一, 一月 24, 2005
JBOSS如何启动Mbean在EJB EAR包部属完成之后?
在Jboss-Services.xml中加入:
jboss.j2ee:module=myapp-ejb-jar.jar,service=EjbModule
现在需要一个Solution:在建立EJB的时候在注册MBean.
现在需要一个Solution:在建立EJB的时候在注册MBean.
星期五, 一月 21, 2005
Java 控制台得到用户输入字符串最完美演示代码.
按照OnkeyUP或OnKeyDown来写Java方法算法真是希奇古怪.
竟然用了近半个小时,My,God.
晕.
import java.io.*;
public class test
{
public static void main(String[] args) throws Exception
{
//OnEvent事件,知道回车才得到结果.
String input = "" ;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) ;
input = in.readLine() ;
System.out.println(input);
//Onkey事件,这个算法算是最完美的了。真麻烦
String password="";
while (true)
{
char c = (char)System.in.read();
if (c == '\r') {
c = (char)System.in.read();
if (c == '\n') {
break;
} else {
continue;
}
} else if (c == '\n') {
break;
} else {
password += c;
}
}
System.out.println("Password:"+password);
}
}
竟然用了近半个小时,My,God.
晕.
import java.io.*;
public class test
{
public static void main(String[] args) throws Exception
{
//OnEvent事件,知道回车才得到结果.
String input = "" ;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) ;
input = in.readLine() ;
System.out.println(input);
//Onkey事件,这个算法算是最完美的了。真麻烦
String password="";
while (true)
{
char c = (char)System.in.read();
if (c == '\r') {
c = (char)System.in.read();
if (c == '\n') {
break;
} else {
continue;
}
} else if (c == '\n') {
break;
} else {
password += c;
}
}
System.out.println("Password:"+password);
}
}
星期四, 一月 20, 2005
MySQL的常用方便命令之一
把符合查询条件的记录保存到一个文件中.
比如:
SELECT * into outfile "outdata.txt" FIELDS TERMINATED BY ',' FROM emp_M_EmploymentInfo
FIELDS TERMINATED 表示字段之间隔离的符号.
比如:
SELECT * into outfile "outdata.txt" FIELDS TERMINATED BY ',' FROM emp_M_EmploymentInfo
FIELDS TERMINATED 表示字段之间隔离的符号.
JBOSS JMX FAQ 1
1.Q:如何给我写的Servlet添加一个JMX的监控组件呢?
A: 在Servlet init() 方法中调用MBeanServer.registerMBean(...)
来注册你的servlet
Code Example:
List srvrlist = MBeanServerFactory.findMBeanServer(null);
MBeanServer server = (MBeanServer)srvrlist.iterator().next();
ObjectName name = new ObjectName("com.wxk:service=mybean");
Mybean emb = new Mybean();
server.registerMBean(emb, name);
2.Q:为什么我发布的sar总是扔出:Class does not expose a management interface :错误:
A:JBoss规则或JMX规范:一个Class的JMX Management Interfact必须是添加后缀MBean
比如你的Class为 x.y那么对应的JMX管理接口的class名字必须为x.yMBean
3.Q:如何得到当前系统的默认MBeanServer?
A:使用MBeanServerFactory.findMBeanServer(null).iterator().next();
要注意必须使用同一个VM/ClassLoader.
A: 在Servlet init() 方法中调用MBeanServer.registerMBean(...)
来注册你的servlet
Code Example:
List srvrlist = MBeanServerFactory.findMBeanServer(null);
MBeanServer server = (MBeanServer)srvrlist.iterator().next();
ObjectName name = new ObjectName("com.wxk:service=mybean");
Mybean emb = new Mybean();
server.registerMBean(emb, name);
2.Q:为什么我发布的sar总是扔出:Class does not expose a management interface :错误:
A:JBoss规则或JMX规范:一个Class的JMX Management Interfact必须是添加后缀MBean
比如你的Class为 x.y那么对应的JMX管理接口的class名字必须为x.yMBean
3.Q:如何得到当前系统的默认MBeanServer?
A:使用MBeanServerFactory.findMBeanServer(null).iterator().next();
要注意必须使用同一个VM/ClassLoader.
星期三, 一月 19, 2005
WindowSXP 批文件新增强大功能.
SET 变量字符串替换:
/P 命令行开关允许将变量数值设成用户输入的一行输入。读取输入
行之前,显示指定的 promptString。promptString 可以是空的。
环境变量替换已如下增强:
%PATH:str1=str2%
会扩展 PATH 环境变量,用 "str2" 代替扩展结果中的每个 "str1"。
要有效地从扩展结果中删除所有的 "str1","str2" 可以是空的。
"str1" 可以以星号打头;在这种情况下,"str1" 会从扩展结果的
开始到 str1 剩余部分第一次出现的地方,都一直保持相配。
也可以为扩展名指定子字符串。
%PATH:~10,5%
会扩展 PATH 环境变量,然后只使用在扩展结果中从第 11 个(偏
移量 10)字符开始的五个字符。如果没有指定长度,则采用默认
值,即变量数值的余数。如果两个数字(偏移量和长度)都是负数,
使用的数字则是环境变量数值长度加上指定的偏移量或长度。
%PATH:~-10%
会提取 PATH 变量的最后十个字符。
%PATH:~0,-2%
会提取 PATH 变量的所有字符,除了最后两个。
set DT=%DATE%_%TIME%
echo %DT%
set DT=%DT: =%
echo %DT%
set DT=%DT:/=-%
echo %DT%
set DT=%DT::=-%
echo %DT%
set DT=%DT:~4%
echo %DT%
set DT=%DT:~0,-3%
echo %DT%
/P 命令行开关允许将变量数值设成用户输入的一行输入。读取输入
行之前,显示指定的 promptString。promptString 可以是空的。
环境变量替换已如下增强:
%PATH:str1=str2%
会扩展 PATH 环境变量,用 "str2" 代替扩展结果中的每个 "str1"。
要有效地从扩展结果中删除所有的 "str1","str2" 可以是空的。
"str1" 可以以星号打头;在这种情况下,"str1" 会从扩展结果的
开始到 str1 剩余部分第一次出现的地方,都一直保持相配。
也可以为扩展名指定子字符串。
%PATH:~10,5%
会扩展 PATH 环境变量,然后只使用在扩展结果中从第 11 个(偏
移量 10)字符开始的五个字符。如果没有指定长度,则采用默认
值,即变量数值的余数。如果两个数字(偏移量和长度)都是负数,
使用的数字则是环境变量数值长度加上指定的偏移量或长度。
%PATH:~-10%
会提取 PATH 变量的最后十个字符。
%PATH:~0,-2%
会提取 PATH 变量的所有字符,除了最后两个。
举例
set DT=%DATE%_%TIME%
echo %DT%
set DT=%DT: =%
echo %DT%
set DT=%DT:/=-%
echo %DT%
set DT=%DT::=-%
echo %DT%
set DT=%DT:~4%
echo %DT%
set DT=%DT:~0,-3%
echo %DT%
Groovy Beta 9 依然没有进步!
Sign.要大叹一口气.
我已经报告了内存泄露的问题,并且在fix list已经列出了被修复了.可是依然是没有修复.
我真的很遗憾.对Groovy的质量问题.
我已经报告了内存泄露的问题,并且在fix list已经列出了被修复了.可是依然是没有修复.
我真的很遗憾.对Groovy的质量问题.
星期二, 一月 18, 2005
如何在Java 5.0里面最简洁的得到系统环境变量的?
Just on statement:
for(String key:System.getenv().keySet())
{
System.out.println(key+" = "+System.getenv(key));
}
for(String key:System.getenv().keySet())
{
System.out.println(key+" = "+System.getenv(key));
}
MySQLD Tuning 参数配置.
/etc/my.cnf 配置
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 1024
sort_buffer_size = 8M
read_buffer_size = 2M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size = 32M
set-variable = max_connections=500
thread_concurrency = 8
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 1024
sort_buffer_size = 8M
read_buffer_size = 2M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size = 32M
set-variable = max_connections=500
thread_concurrency = 8
星期一, 一月 17, 2005
J2SE 5.0 New Features.
J2SE 5.0新操作符含义
1. Generics(泛型)
,读做:” of Type”,比如Collection c读做”Collectioin of String c
2. for-loop:
Colon( : ) 冒号,读做: for each typeObject t in c.”
比如:
for (TimerTask t : c) 读做: for each TimerTask t in c
3. varargs(变元),声明参数个数不确定的方法或接口.
三个点(…);
public static String format(String pattern,Object... arguments);
public static String format(String pattern,Object... arguments)
{
String temp="";
for(Object t:arguments)temp+=t;
return pattern+":"+temp;
}
4. enum 枚举声明
简单enum:
enum Season { WINTER, SPRING, SUMMER, FALL }
Examples:
//Test for enum simple
for (Season rank : Season.values())System.out.println("Enum:"+rank);
复杂enum:
可以包含数据,行为
public enum Planet {
MERCURY (3.303e+23, 2.4397e6),
VENUS (4.869e+24, 6.0518e6),
EARTH (5.976e+24, 6.37814e6),
MARS (6.421e+23, 3.3972e6),
JUPITER (1.9e+27, 7.1492e7),
SATURN (5.688e+26, 6.0268e7),
URANUS (8.686e+25, 2.5559e7),
NEPTUNE (1.024e+26, 2.4746e7),
PLUTO (1.27e+22, 1.137e6);
private final double mass; // in kilograms
private final double radius; // in meters
Planet(double mass, double radius) {
this.mass = mass;
this.radius = radius;
}
private double mass() { return mass; }
private double radius() { return radius; }
// universal gravitational constant (m3 kg-1 s-2)
public static final double G = 6.67300E-11;
double surfaceGravity() {
return G * mass / (radius * radius);
}
double surfaceWeight(double otherMass) {
return otherMass * surfaceGravity();
}
}
Example:
//Test for complex enum Planet
for (Planet p : Planet.values())
System.out.printf("Your weight on %s is %f%n",
p, p.surfaceWeight(8));
5. 注解(Annotations)
目的:很多API要求提供一些模板代码,以供方便使用.
1. Generics(泛型)
2. for-loop:
Colon( : ) 冒号,读做: for each typeObject t in c.”
比如:
for (TimerTask t : c) 读做: for each TimerTask t in c
3. varargs(变元),声明参数个数不确定的方法或接口.
三个点(…);
public static String format(String pattern,Object... arguments);
public static String format(String pattern,Object... arguments)
{
String temp="";
for(Object t:arguments)temp+=t;
return pattern+":"+temp;
}
4. enum 枚举声明
简单enum:
enum Season { WINTER, SPRING, SUMMER, FALL }
Examples:
//Test for enum simple
for (Season rank : Season.values())System.out.println("Enum:"+rank);
复杂enum:
可以包含数据,行为
public enum Planet {
MERCURY (3.303e+23, 2.4397e6),
VENUS (4.869e+24, 6.0518e6),
EARTH (5.976e+24, 6.37814e6),
MARS (6.421e+23, 3.3972e6),
JUPITER (1.9e+27, 7.1492e7),
SATURN (5.688e+26, 6.0268e7),
URANUS (8.686e+25, 2.5559e7),
NEPTUNE (1.024e+26, 2.4746e7),
PLUTO (1.27e+22, 1.137e6);
private final double mass; // in kilograms
private final double radius; // in meters
Planet(double mass, double radius) {
this.mass = mass;
this.radius = radius;
}
private double mass() { return mass; }
private double radius() { return radius; }
// universal gravitational constant (m3 kg-1 s-2)
public static final double G = 6.67300E-11;
double surfaceGravity() {
return G * mass / (radius * radius);
}
double surfaceWeight(double otherMass) {
return otherMass * surfaceGravity();
}
}
Example:
//Test for complex enum Planet
for (Planet p : Planet.values())
System.out.printf("Your weight on %s is %f%n",
p, p.surfaceWeight(8));
5. 注解(Annotations)
目的:很多API要求提供一些模板代码,以供方便使用.
ERM BOM
物料清单(BOM),又称为产品结构表或产品结构树;在某些工业领域,可能称为“配方”、“要素表”或其它名称。在ERP系统中,物料一词有着广泛的含义,它是所有产品、半成品、在制品、原材料、配套件、协作件、易耗品等等与生产有关的物料的统称。BOM作用于计算机识别物料、接受客户定单、编制计划、配套(装配)和领料、加工过程跟踪、采购和外协、成本计算、报价参考、物料追溯、改进产品设计等等。系统可以采用多种方法描述物料清单,如单层法、缩进法、模块法、暂停法、矩阵法以及成本法等等。
BOM(Bill of material )物料清单;
PP(Production Planning)生产计划大纲;
MPS(Master Production Scheduling)主生产计划;
RCCP( Rough Cut Capacity Planning)粗能力需求计划;
MRP(Materiel Requirements Planning) 物料需求计划;
CRP(Capacity Requirements Planning) 能力需求计划;
PAC(Production Activity Control) 车间作业管理;
IM(Inventory Management) 库存管理;
CO(Controlling) 管理会计(Management Accounting);
FI(Financial Accounting) 财务会计(GL总帐、AR应收、AP应付);
COE(Customer order Entry) 客户订单输入;
HR(Human Resources) 人力资源计划;
SD(Sales and Distribution) 分销管理。
BOM(Bill of material )物料清单;
PP(Production Planning)生产计划大纲;
MPS(Master Production Scheduling)主生产计划;
RCCP( Rough Cut Capacity Planning)粗能力需求计划;
MRP(Materiel Requirements Planning) 物料需求计划;
CRP(Capacity Requirements Planning) 能力需求计划;
PAC(Production Activity Control) 车间作业管理;
IM(Inventory Management) 库存管理;
CO(Controlling) 管理会计(Management Accounting);
FI(Financial Accounting) 财务会计(GL总帐、AR应收、AP应付);
COE(Customer order Entry) 客户订单输入;
HR(Human Resources) 人力资源计划;
SD(Sales and Distribution) 分销管理。
星期六, 一月 15, 2005
如何用Linux下Sendmail把所有的近来的Email全部转发到另外一个Sendmail Server上呢?
这种模式叫做:smart Host模式.
在/etc/sendmail.cf里,找到DS关键词.
在后面加入你要转发到的Senmail server的名字
必须是名字,如果用IP可能不能成功.同sendmail版本有关.
1.在/etc/hosts加入一行
10.2.5.1 MailGW
2.在/etc/sendmail.cf里加入
# "Smart" relay host (may be null)
DSMailGW
就可以了.然后可以用.
mail -v 来跟踪一下发送过程
在/etc/sendmail.cf里,找到DS关键词.
在后面加入你要转发到的Senmail server的名字
必须是名字,如果用IP可能不能成功.同sendmail版本有关.
1.在/etc/hosts加入一行
10.2.5.1 MailGW
2.在/etc/sendmail.cf里加入
# "Smart" relay host (may be null)
DSMailGW
就可以了.然后可以用.
mail -v
问题:为什么Linux启动的时候在Sendmail就停在那里,非常慢?
原因:可能的原因是修改了网卡IP.
你必须在/etc/hosts
把localhost加在IP不是127.0.0.1的那行
如下:
10.2.5.240 localhost SZSE199
你必须在/etc/hosts
把localhost加在IP不是127.0.0.1的那行
如下:
10.2.5.240 localhost SZSE199
星期二, 一月 11, 2005
JBOSS如何在Web加如虚拟目录
I made the following changes. Not all of them may be required. You can try one at a time.
1. jboss/server/default/conf/jboss-service.xml
Code:
<server>
<!-- Load all jars from the JBOSS_DIST/server/<config>/lib directory. This
can be restricted to specific jars by specifying them in the archives
attribute.
-->
<classpath codebase="lib" archives="*"/>
<!-- Set the virtual directory to be used by the application
Ref: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=48300 -->
<attribute name="Config">
<Server>
<Service name="JBoss-Tomcat">
<Engine name="MainEngine" defaultHost="localhost">
<Host name="localhost">
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" appBase="/cmpe275" path="/images"/>
</Host>
</Engine>
</Service>
</Server>
</attribute>
<!-- Virtual directory setting - END -->
one more place
Code:
<!-- ==================================================================== -->
<!-- Deployment Scanning -->
<!-- ==================================================================== -->
<!-- An mbean for hot deployment/undeployment of archives.
-->
<mbean code="org.jboss.deployment.scanner.URLDeploymentScanner" name="jboss.deployment:type=DeploymentScanner,flavor=URL">
<attribute name="URLs">
deploy/cmpe275, file:///C:/images/
</attribute>
2. jboss/server/default/deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml
Code:
<server>
<mbean code="org.jboss.web.tomcat.tc5.Tomcat5" name="jboss.web:service=WebServer">
<!-- Get the flag indicating if the normal Java2 parent first class
loading model should be used over the servlet 2.3 web container first
model.
-->
<attribute name="Java2ClassLoadingCompliance">true</attribute>
<attribute name="LenientEjbLink">true</attribute>
<!-- A flag indicating if the JBoss Loader should be used. This loader
uses a unified class loader as the class loader rather than the tomcat
specific class loader.
-->
<!-- Set the virtual directory to be used by the application
Ref: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=48300 -->
<attribute name="Config">
<Server>
<Service name="JBoss-Tomcat">
<Engine name="MainEngine" defaultHost="localhost">
<Host name="localhost">
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" appBase="/cmpe275" path="/images"/>
</Host>
</Engine>
</Service>
</Server>
</attribute>
<!-- Virtual directory setting - END -->
<attribute name="UseJBossWebLoader">true</attribute>
3. jboss/server/default/deploy/jbossweb-tomcat50.sar/server.xml
Code:
<Host name="localhost" autoDeploy="false" deployOnStartup="false" deployXML="false">
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" path="/cmpe275/images"/>
4. copy web.xml to
jboss/server/default/conf
This has worked for me. Hope this helps you.
There has to be easier way to solve this.
1. jboss/server/default/conf/jboss-service.xml
Code:
<server>
<!-- Load all jars from the JBOSS_DIST/server/<config>/lib directory. This
can be restricted to specific jars by specifying them in the archives
attribute.
-->
<classpath codebase="lib" archives="*"/>
<!-- Set the virtual directory to be used by the application
Ref: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=48300 -->
<attribute name="Config">
<Server>
<Service name="JBoss-Tomcat">
<Engine name="MainEngine" defaultHost="localhost">
<Host name="localhost">
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" appBase="/cmpe275" path="/images"/>
</Host>
</Engine>
</Service>
</Server>
</attribute>
<!-- Virtual directory setting - END -->
one more place
Code:
<!-- ==================================================================== -->
<!-- Deployment Scanning -->
<!-- ==================================================================== -->
<!-- An mbean for hot deployment/undeployment of archives.
-->
<mbean code="org.jboss.deployment.scanner.URLDeploymentScanner" name="jboss.deployment:type=DeploymentScanner,flavor=URL">
<attribute name="URLs">
deploy/cmpe275, file:///C:/images/
</attribute>
2. jboss/server/default/deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml
Code:
<server>
<mbean code="org.jboss.web.tomcat.tc5.Tomcat5" name="jboss.web:service=WebServer">
<!-- Get the flag indicating if the normal Java2 parent first class
loading model should be used over the servlet 2.3 web container first
model.
-->
<attribute name="Java2ClassLoadingCompliance">true</attribute>
<attribute name="LenientEjbLink">true</attribute>
<!-- A flag indicating if the JBoss Loader should be used. This loader
uses a unified class loader as the class loader rather than the tomcat
specific class loader.
-->
<!-- Set the virtual directory to be used by the application
Ref: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=48300 -->
<attribute name="Config">
<Server>
<Service name="JBoss-Tomcat">
<Engine name="MainEngine" defaultHost="localhost">
<Host name="localhost">
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" appBase="/cmpe275" path="/images"/>
</Host>
</Engine>
</Service>
</Server>
</attribute>
<!-- Virtual directory setting - END -->
<attribute name="UseJBossWebLoader">true</attribute>
3. jboss/server/default/deploy/jbossweb-tomcat50.sar/server.xml
Code:
<Host name="localhost" autoDeploy="false" deployOnStartup="false" deployXML="false">
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<!-- Add a static context /Storage using directory /tmp/images -->
<Context docBase="C:/images" path="/cmpe275/images"/>
4. copy web.xml to
jboss/server/default/conf
This has worked for me. Hope this helps you.
There has to be easier way to solve this.
星期一, 一月 10, 2005
JbuilderX如何把任意类型的文件都打包到War或Jar里?
以Jbuildx为列
1.选择Tools/Prefefences/Browser..File Types
2,选则Module的老鼠右键选择properties..
入图:
3.还有一种最简洁的方法,假如Filters
加入Include型的Filter,Module的老鼠右键选择properties/Content/Filter,加入*.*类型的过滤.
1.选择Tools/Prefefences/Browser..File Types
2,选则Module的老鼠右键选择properties..
入图:
3.还有一种最简洁的方法,假如Filters
加入Include型的Filter,Module的老鼠右键选择properties/Content/Filter,加入*.*类型的过滤.
星期六, 一月 08, 2005
星期五, 一月 07, 2005
星期三, 一月 05, 2005
如何用XML-RPC来传递汉字参数.
我这里使用的是xml.apache.org的实现.
关键的一点:改变字符集合可以使用:org.apache.xmlrpc.XmlRpc.setEncoding("UTF-8");
这会影响对传递的数据的encode.
下面用一个简单的Client/Server/Handler来说明XML-RPC的实现:
package home.wxk;
import org.apache.xmlrpc.*;
import java.util.Vector;
public class RpcClient {
public RpcClient() {
}
public static void main(String[] args) throws Exception
{
//org.apache.xmlrpc.XmlRpc.setEncoding("UTF-8");
XmlRpcClient xmlrpc = new XmlRpcClient ("http://localhost:8080");
Vector params = new Vector ();
// params.addElement (new String(" 123".getBytes(),"UTF-8"));
params.addElement(new String("这时候汉字的未来xmlrpc123".getBytes(),"ISO-8859-1"));
// this method returns a string
String a="";
// try
// {
a=(String)xmlrpc.execute("hello.sayHello", params);
System.out.println("........"+a);
// }catch(Exception e)
// {
// System.out.println("异常:......."+a);
// }
}
}
package home.wxk;
import org.apache.xmlrpc.*;
public class RpcServer {
public static void initServer() {
// XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");
//start the server
System.out.println("Starting XML-RPC Server......");
org.apache.xmlrpc.XmlRpc.setEncoding("ISO-8859-1");
WebServer server = new WebServer(8080);
//register our handler class
server.addHandler("hello", new HelloHandler());
server.start();
System.out.println("Now accepting requests......");
}
public static void main(String[] args){
initServer();
}
}
package home.wxk;
public class HelloHandler {
public String sayHello(String name) throws Exception
{
System.out.println("I am come ing..."+name+new String(name.getBytes("UTF-8")+new String(name.getBytes("ISO-8859-1")+new String(name.getBytes()))));
String echo="Hello 你好";
//String returnstr=new String(name.getBytes(),"ISO-8859-1");
return new String(name.getBytes(),"iso-8859-1");
}
}
关键的一点:改变字符集合可以使用:org.apache.xmlrpc.XmlRpc.setEncoding("UTF-8");
这会影响对传递的数据的encode.
下面用一个简单的Client/Server/Handler来说明XML-RPC的实现:
Client的实现
package home.wxk;
import org.apache.xmlrpc.*;
import java.util.Vector;
public class RpcClient {
public RpcClient() {
}
public static void main(String[] args) throws Exception
{
//org.apache.xmlrpc.XmlRpc.setEncoding("UTF-8");
XmlRpcClient xmlrpc = new XmlRpcClient ("http://localhost:8080");
Vector params = new Vector ();
// params.addElement (new String(" 123".getBytes(),"UTF-8"));
params.addElement(new String("这时候汉字的未来xmlrpc123".getBytes(),"ISO-8859-1"));
// this method returns a string
String a="";
// try
// {
a=(String)xmlrpc.execute("hello.sayHello", params);
System.out.println("........"+a);
// }catch(Exception e)
// {
// System.out.println("异常:......."+a);
// }
}
}
服务器端的实现
package home.wxk;
import org.apache.xmlrpc.*;
public class RpcServer {
public static void initServer() {
// XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");
//start the server
System.out.println("Starting XML-RPC Server......");
org.apache.xmlrpc.XmlRpc.setEncoding("ISO-8859-1");
WebServer server = new WebServer(8080);
//register our handler class
server.addHandler("hello", new HelloHandler());
server.start();
System.out.println("Now accepting requests......");
}
public static void main(String[] args){
initServer();
}
}
Handler的实现
package home.wxk;
public class HelloHandler {
public String sayHello(String name) throws Exception
{
System.out.println("I am come ing..."+name+new String(name.getBytes("UTF-8")+new String(name.getBytes("ISO-8859-1")+new String(name.getBytes()))));
String echo="Hello 你好";
//String returnstr=new String(name.getBytes(),"ISO-8859-1");
return new String(name.getBytes(),"iso-8859-1");
}
}
Groovy Beta 8 的一个bug
Beta 8修改了GroovyClassLoader在反复运行大量小脚本的情况下会泄露内存的问题.但是又把GroovyShell.execute的默认行为给修改了.
execute在beta 7中,会首先判定才cache中是否有同名的scriptText,如果有,则运行Cached的脚本.但Beta 8却扔出了一个:duplicate class definition:
Guillaume Laforge
回复到:
"Hello William,
In CVS Head, there should be a fix that solved your problem.
When beta-9 is released, could you please check if this issue is still
present? Thanks in advance."
当然,我在Beta 9 released的时候,会检查这个问题是否纠正了.
我的Payroll系统Groovy这可是核心的技术了.
execute在beta 7中,会首先判定才cache中是否有同名的scriptText,如果有,则运行Cached的脚本.但Beta 8却扔出了一个:duplicate class definition:
Guillaume Laforge
回复到:
"Hello William,
In CVS Head, there should be a fix that solved your problem.
When beta-9 is released, could you please check if this issue is still
present? Thanks in advance."
当然,我在Beta 9 released的时候,会检查这个问题是否纠正了.
我的Payroll系统Groovy这可是核心的技术了.
订阅:
博文 (Atom)