tomcat5应用移植到WAS5.1中的一些问题及解决
应用架构:
WebStart/jsp + struts1.1 + spring115 + hibernate2.1

1、由于was512不支持jstl2.0,因此,使用它时(当前可能在login.jsp和
其的统计页面中用到),需要web.xml中增加配置,或直接写明使用:
<%@ taglib uri="/WEB-INF/tld/c-1_0.tld" prefix="c" %>
而不是2.0
在web.xml中增加如下即可
<taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/tld/c-1_0.tld</taglib-location>
</taglib>
如果支持,则可以直接用而不需要配置!
注意:jstl并不是WEB容器必须支持的东东!

3、session行不通呀:
这是我在BBS上提的问题:
我用URLConnection调用Servlet,有两种方法设置我当前的SESSION(后端传过来的):
设置Cookie的:JSESSIONID 
或重写URL:http://localhost:9080/myapp/getList.do;jsessionid=-JW0T70Esp9QZlyfUKOsO7o?current=PEK
这在tomcat完全没有问题
但在WebSphere5.1下却不行,到服务器又创建了一个新的SESSION,不知道为什么?
安j2ee规范中,WEB容器必须支持这两种方式呀!帮帮我呀,谢谢。
还好,很快我就自己解决了,当然,主要还是看了IBM相关BBS上的信息才解决的。
可考虑:

一般而言,有两种最常用的会话跟踪机制,一种就是URL重写。在客户端不接受cookie的情况下可以使用URL重写进行会话跟踪。
URL重写包括向URL路径添加一些容器可以解释的数据。规范要求会话ID必须编码在URL路径中,参数名称必须是jsessionid,
例如: http://www.myserver.com/catalog/index.html;jsessionid=1234
一种就是现在最常用的cookie了,规范要求所有的servlet都必须支持cookie。容器向客户端发送一个cookie,
客户端在后续的处于同一个会话的请求中向服务器返回该cookie。会话跟踪cookie的名字必须是JSESSIONID。

httpUrl=http://localhost:9080/Agile/getFlightList.do;jsessionid=-JW0T70Esp9QZlyfUKOsO7o?currentCity=PEK
上面的方式也不行,也不知道还需要做什么设置?

好象是在WAS中,SESSIONID不止这些,而应该是:<your_session>:<websphere_clone_id>,而返回的只有:前的部分,当然没有呀!!
看下面的日志:
swt process,sessionID is :uEVqj3UC4yYmIAZvmyZzuPw
2005-06-21 13:24:06 [com.ibatis.struts.SwtAction]-[DEBUG]

other:0000uEVqj3UC4yYmIAZvmyZzuPw:-1,JSESSIONID=0000uEVqj3UC4yYmIAZvmyZzuPw:-1
2005-06-21 13:24:06 [com.ibatis.struts.SwtAction]-[DEBUG] cookie:JSESSIONID=0000uEVqj3UC4yYmIAZvmyZzuPw:-1
在链接页面中,代码如下:
<%
String sessionid = "";
Cookie[] cookie = request.getCookies();
for(int i = 0; i < cookie.length; i++)
{
 if(cookie[i].getName().trim().equalsIgnoreCase("JSESSIONID"))
 {
  sessionid = cookie[i].getValue().trim();
  break;
  //logger.debug("cookie:"+cookie[i].getName() + "=" +cookie[i].getValue());
 }
 
}

%>

<a href="/app/swt/index.jnlp?sessionid=<%=sessionid%>">lanuch client here</a>
 
实际上,解决此方法唯一要改的地方就是链接处(见上):
但为了以后其它的兼容性,将URL重写也加上,这在HTTPUTIL文件中。
即不能通过调用getSession().getId()得到,而应该自己从Cookie中找

5、ORB得不到,也无法得到SUN的ORB,好象他用的是JDK1.4.1,还是是SUN的,可以试试更换JRE看看,另外,如果真上WAS的话,应该用
更好的方式去调用TUXEDO,而不是现在的方式!
答:将Jre1.4.2下的rt.jar拷到WAS的JRE的LIB/EXT下即可,为防止冲突,要将java/javax下的全删掉,注意,这个方法不行,类型转换时
会有问题。

最终可以了,好象是测试时TUXEDO端有问题,同时,还改了如下代码:

通过JNDI得到:
orb = (org.omg.CORBA.ORB) ctx.lookup("java:comp/ORB");
orb =(org.omg.CORBA.ORB)javax.rmi.PortableRemoteObject.narrow(
     ctx.lookup("java:comp/ORB"),
     org.omg.CORBA.ORB.class);
应该不改也可以的!

是这以前出现的异常:
JNDI:
org.omg.CORBA.INTERNAL:   vmcid: 0x4f422000  minor code: 77  completed: No

6、有关InitServlet晚于listener执行的问题,解决无非两程:
1)让Spring在需要时才生成对象
2)自己写listener载入配置(不在InitServlet中进行),且必须在Spring的listener之前执行。
3)规定不要在SPRING管理的类构造函数中调用配置。
先安3)去做,以后有时间再照前两种。

以下是IBM BBS上的一些问答,供参考:

附录:
http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?message=4023650&cat=9&thread=54497&treeDisplayType=threadmode1&for

um=266#4023650

JSESSIONID cookie - Help!
Originally posted: 2004 July 15 05:39 AM
  Nau      Post new reply 
 
Hi, All

I have a need to call a servlet from another one withing the same session:

URL url = new URL( someURL );
URLConnection connection = url.openConnection();
connection.setDoInput( true );
connection.setRequestProperty( "Cookie", "JSESSIONID=" + request.getSession().getId() );

This piece of code works fine for Tomcat but on Webspere I'm getting a new session.

Any help please!
Thanks a million

Re: JSESSIONID cookie - Help!
Originally posted: 2004 July 19 07:15 AM
  Ben_      Post new reply 
 
WebSphere generates a cookie named JSESSIONID with value
<your_session>:<websphere_clone_id>.

It can be JSESSIONID=000024N1ZDMZZH022EANUW2ZO5I:u7078j8m, for example.

You can see this if you look at the cookies the browser received or dump the
HTTP request headers.

You built an HTTP request containing the JSESSIONID cookie with
"JSESSIONID=" + request.getSession().getId(), but this code is broken
because getSession().getId() only return the value before the ':' sign in
the cookie value.

Since only the *name* of the cookie is standardized in J2EE (JSESSIONID),
it's a bad idea to assume the format of the cookie is simply the session id,
because the way the *value* of the session cookie is computed is not J2EE
standardized.

You'd better read the actual value from the HTTP request header instead.

Re: JSESSIONID gets overwritten
Originally posted: 2005 Feb 28 05:01 PM
  sjostrand2@hotmail.com      Post new reply

Lukasz Szelag wrote:
> JSESSIONID gets overwritten in the following scenario:
>
> 1. HTTP Request is sent to "A" URL.
>
> 2. HTTP session is created for "A" and session ID is stored in
> JSESSIONID cookie.
>
> 3. "A" stores an object in the session.
>
> 4. "A" calls "B" ("B" provides a menu)
>
> 5. HTTP session is created for "B" and session ID is stored in
> JSESSIONID cookie overwriting the previous value ("A" session ID).
>
> 6. Second HTTP request is sent to "A" URL.
>
> 7. "A" fails to lookup the object in the session stored in step 3.
> request.getSession(false) returns null.
>
> Is there a way to cure this problem? Thanks.
>
> PS. Not sure if that matters but "A" and "B" are deployed on two
> different servers. Specifying a different names for cookies seems to
> help, i.e. JSESSIONID_A and JSESSIONID_B but this is WebSphere
specific
> extension (Servlet specification requires that the cookie name is
> JSESSIONID).
>
> Lukasz

I assume that A and B are in two different WAR files and therefore have
different context roots, right?

In that case you could use WebSphere's admin console and change the
cookie path from the default (which is /, meaning the cookie is sent as
long as the URL starts with a /, which is always) to the context root
for each application.
So for application A, set the cookie path to /appA_contextRoot and for
application B, set the cookie path to /appB_contextRoot.

In WebSphere's admin console, go to Enterprise Applications ->
Application A -> Session Management -> {click the Enable Cookies link}
and change the Cookie path.

Good luck

/Henrik Sjostrand

http:

accept : image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint,

application/msword, application/vnd.ms-excel, */*
accept-language : zh-cn
accept-encoding : gzip, deflate
user-agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
host : localhost:9080
connection : Keep-Alive

tomcat5应用移植到WAS5.1中的一些问题及解决相关推荐

  1. 同花顺选股python开发_Funcat 将同花顺、通达信等的公式写法移植到了 Python 中

    Funcat Funcat 将同花顺.通达信.文华财经等的公式移植到了 Python 中. 同花顺.通达信.文华财经麦语言等公式的表达十分简洁,适合做技术分析. 苦于 Python 缺乏这种领域特定语 ...

  2. 麦语言和python区别_funcat: Funcat 将同花顺、通达信、文华财经麦语言等的公式写法移植到了 Python 中。...

    Funcat Funcat 将同花顺.通达信.文华财经等的公式移植到了 Python 中. 同花顺.通达信.文华财经麦语言等公式的表达十分简洁,适合做技术分析. 苦于 Python 缺乏这种领域特定语 ...

  3. 麦语言转换python_funcat: Funcat 将同花顺、通达信、文华财经麦语言等的公式写法移植到了 Python 中。...

    Funcat Funcat 将同花顺.通达信.文华财经等的公式移植到了 Python 中. 同花顺.通达信.文华财经麦语言等公式的表达十分简洁,适合做技术分析. 苦于 Python 缺乏这种领域特定语 ...

  4. 麦语言和python区别_GitHub - cedricporter/funcat: Funcat 将同花顺、通达信、文华财经麦语言等的公式写法移植到了 Python 中。...

    Funcat Funcat 将同花顺.通达信.文华财经等的公式移植到了 Python 中. 同花顺.通达信.文华财经麦语言等公式的表达十分简洁,适合做技术分析. 苦于 Python 缺乏这种领域特定语 ...

  5. 麦语言和python区别_GitHub - bankwang/funcat: Funcat 将同花顺、通达信、文华财经麦语言等的公式写法移植到了 Python 中。...

    Funcat Funcat 将同花顺.通达信.文华财经等的公式移植到了 Python 中. 同花顺.通达信.文华财经麦语言等公式的表达十分简洁,适合做技术分析. 苦于 Python 缺乏这种领域特定语 ...

  6. 编译FFmpeg4.1.3并移植到Android app中使用(最详细的FFmpeg-Android编译教程)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/bobcat_kay/article/d ...

  7. 移植代码,keil中出现Undefined symbol 等问题解决办法

    移植UCOS的代码中,经常提示Undefined symbol , 我实际上已经加上了头文件也定义,非常不爽啊. 解决办法: 找到软件中的那个三个颜色的按钮. 点进去,把相关变量定义的C文件添加进去. ...

  8. windows7安装sql server 2000安装步骤 及安装过程中遇到的问题和解决方式

    提示:文章写完后windows7安装sql server 2000安装步骤 及安装过程中遇到的问题和解决方式, 文章目录 一.ms sql server 2000是什么? 版本简介: **特点:** ...

  9. JAVA Web项目中所出现错误及解决方式合集(不断更新中)

    JAVA Web项目中所出现错误及解决方式合集 前言 一.几个或许会用到的软件下载官网 二.Eclipse的[preferences]下没有[sever]选项 三.Tomcat的安装路径找不到 四.T ...

最新文章

  1. 这个省到2025年,PUE>1.3存量大型数据中心将全部腾退关停!
  2. WINCE串口WriteFile阻塞问题解决方法
  3. 已编辑好的mysql_如何修改一个已存在的数据库名称?
  4. java treemap_Java TreeMap putAll()方法与示例
  5. 前端工程师如何摆脱舒适区,持续精进?
  6. ajax之jsonp跨域请求
  7. 完成css的切图 图片任意,css切图是什么意思
  8. jQuery Mobile 所有class选项,开发全解+完美注释
  9. 代码帝:一个月10万行代码
  10. 引用内部函数绑定机制,R转义字符,C++引用,别名,模板元,宏,断言,C++多线程,C++智能指针...
  11. macd底背离的python_Python量化交易之MACD'顶底背离'形态的实现,自动化交易!
  12. 战战兢兢尝试tensorflow2.0
  13. 显示upnp服务器 sonos,蒲公英的上层设备如何开启UPnP及其优点
  14. CPU天梯图/显卡天梯图---kalrry
  15. linux修改默认22端口失败,【原创文章】修改亚马逊AWS EC2 LINUX系统SSH默认22端口失败的原因和解决办法...
  16. 设计模式之九原型模式
  17. 分布式事务之TCC模型 confirm失败补偿
  18. 计算机 手机原理是什么,什么是手机投屏,手机投屏到电脑上的原理
  19. VUEecharts图表之得分环
  20. 2021-10-28 MyBatis学习

热门文章

  1. python如何使用sdk_七牛云存储Python SDK使用教程 - 基本介绍
  2. python前端学习-----Flask进阶
  3. 备考信息系统项目管理师5点必过经验
  4. Mysql Errcode: 24 - Too many open files
  5. 笔记-高项案例题-2009年上-需求管理
  6. Windows服务器上Mqtt服务器EMQX的安装使用
  7. Cordova将vue项目打包成apk(全使用命令行)
  8. 用于显示本地通知的跨平台插件flutter_local_notifications
  9. 系统监理师备考经验分享
  10. isamchk mysql_利用Myisamchk对MySQL数据表进行体检