---
title: "tomcat 移植到weblogic session 为null 问题"
author: "simon_zhang"
date: "2011-07-14T12:14:39Z"
tags: []
categories: ["编程语言"]
slug: "tomcat-weblogic-session-null"
draft: false
lastmod: "2011-07-14T12:14:39Z"
id: 1124205
url: "https://mogee.iteye.com/blog/1124205"
---

# tomcat weblogic session null 失效

 

最近将tomcat 下的项目移植到weblogic中时发现所有的session拿到后都为null，在tomcat下是正常的。解决方法：是在WEB-INF下加weblogic.xml配置文件：

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 6.1//EN" "http://www.bea.com/servers/wls610/dtd/weblogic-web-jar.dtd">
<wls:weblogic-web-app
 xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-web-app"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java
.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
 <session-descriptor>
       <session-param>         
             <param-name>CookieName</param-name>         
             <param-value>JSESSIONID1</param-value>       
      </session-param>    
 </session-descriptor>

</wls:weblogic-web-app>
```

 

即可解决该问题 。