WEB开发网
开发学院操作系统Linux/Unix 如何解决Websphere中wsjar的问题 阅读

如何解决Websphere中wsjar的问题

 2010-09-27 08:17:32 来源:WEB开发网   
核心提示:概述我们知道,Websphere有自己的Classloader,如何解决Websphere中wsjar的问题,它对类的加载做了一些自己的定制,但是往往由于有些定制的特殊性,例如:No configuration found. Configuring ehcache from ehcache-failsafe.xml f

概述

我们知道,Websphere有自己的Classloader,它对类的加载做了一些自己的定制,但是往往由于有些定制的特殊性,而造成了人们在上面部署应用的不方面,这其中一个比较大麻烦就是,Webpshere中对jar包中资源的定位URL有自己特殊的格式,例如:

wsjar:file:/C:/dev/ws/default/sample_app/xsd.resources.jar!/org/eclipse/test.xml

我们知道URL是统一资源定位描述,Sun J2SE标准中,jar包中的资源的URL格式应该是以jar:开头,即类似如下的样子

jar:file:/C:/dev/ws/default/sample_app/xsd.resources.jar!/org/eclipse

而目前大多数开源技术,在以URL做为参数来载入实际资源时,并没有考虑到wsjar开头的情况,因此当一个较为复杂的应用向Webpshere服务器部署时,往往就会出现关于这方面的报错,例如:

No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath:

wsjar:file:/F:/WebSphere/AppServer/lib/workplaceoa/ehcache-1.1.jar!/ehcache-failsafe.xml

如果你仍然觉得不知道在什么情况下会出现wsjar的情况,那么给你举一个例子:下面我们使用apache commons中的commons configuration来写一个代码片断

Configuration configuration = (Configuration) confMap.get(name);
if (configuration == null) {
ConfigurationFactory factory = new ConfigurationFactory();
URL url = PropertyGetter.class.getClassLoader().getResource("myconfig.xml");//你将myconfig.xml打在某个jar包中
factory.setConfigurationURL(url);
try {
configuration = factory.getConfiguration();
} catch (Exception e) {
logger.error("could not find the configuration ", e);
}
}
String value=configuration.getString(propertyName);

编缉推荐阅读以下文章

  • 使用 WebSphere Process Server 修复流程
  • 设置并置 WebSphere Application Server 负载均衡器和内容主机
  • 利用 WebSphere Application Server 6.1 构建 SIP 集群应用环境及其性能调优
  • WebSphere Process Server V6.0.2 集群,第 1 部分:了解拓扑
  • 如何实现WebSphere Application Server 6集群环境下的定时服务
  • 迁移集群环境中的 WebSphere Commerce
  • WebSphere Process Server V6.0.2 集群,第 2 部分:安装和配置 WebSphere Process Server 集群
  • Websphere MQ v6集群的负载均衡新功能
  • 将 JUnit 插件集成到 WebSphere Studio 中
  • 使用 IBM WebSphere MQ JMS 提供程序

1 2 3 4  下一页

Tags:如何 解决 Websphere

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接