在linux下的weblogic报错,但是 在window下的tomcat不报错!!十万火急!

问题描述

对URL参数加密之后再重定向跳转的时候就报错了!报错信息SecurityHelper类packagecom.huarun;importjava.security.*;importjavax.crypto.*;importjavax.crypto.spec.*;publicclassSecurityHelper{privatefinalstaticintITERATIONS=20;publicstaticStringencrypt(Stringkey,StringplainText)throwsException{try{byte[]salt=newbyte[8];MessageDigestmd=MessageDigest.getInstance("MD5");md.update(key.getBytes());byte[]digest=md.digest();for(inti=0;i<8;i++){salt[i]=digest[i];}PBEKeySpecpbeKeySpec=newPBEKeySpec(key.toCharArray());SecretKeyFactorykeyFactory=SecretKeyFactory.getInstance("PBEWithMD5AndDES");SecretKeyskey=keyFactory.generateSecret(pbeKeySpec);PBEParameterSpecparamSpec=newPBEParameterSpec(salt,ITERATIONS);Ciphercipher=Cipher.getInstance("PBEWithMD5AndDES");cipher.init(Cipher.ENCRYPT_MODE,skey,paramSpec);byte[]cipherText=cipher.doFinal(plainText.getBytes());StringsaltString=newString(Base64.encode(salt));StringciphertextString=newString(Base64.encode(cipherText));returnsaltString+ciphertextString;}catch(Exceptione){thrownewException("EncryptTextError:"+e.getMessage(),e);}}publicstaticStringdecrypt(Stringkey,StringencryptTxt)throwsException{intsaltLength=12;try{Stringsalt=encryptTxt.substring(0,saltLength);Stringciphertext=encryptTxt.substring(saltLength,encryptTxt.length());byte[]saltarray=Base64.decode(salt.getBytes());byte[]ciphertextArray=Base64.decode(ciphertext.getBytes());PBEKeySpeckeySpec=newPBEKeySpec(key.toCharArray());SecretKeyFactorykeyFactory=SecretKeyFactory.getInstance("PBEWithMD5AndDES");SecretKeyskey=keyFactory.generateSecret(keySpec);PBEParameterSpecparamSpec=newPBEParameterSpec(saltarray,ITERATIONS);Ciphercipher=Cipher.getInstance("PBEWithMD5AndDES");cipher.init(Cipher.DECRYPT_MODE,skey,paramSpec);byte[]plaintextArray=cipher.doFinal(ciphertextArray);returnnewString(plaintextArray);}catch(Exceptione){thrownewException(e);}}}

Base64类packagecom.huarun;importjava.io.*;importjavax.mail.internet.MimeUtility;publicclassBase64{publicstaticbyte[]encode(byte[]b)throwsException{ByteArrayOutputStreambaos=null;OutputStreamb64os=null;try{baos=newByteArrayOutputStream();b64os=MimeUtility.encode(baos,"base64");b64os.write(b);b64os.close();returnbaos.toByteArray();}catch(Exceptione){thrownewException(e);}finally{try{if(baos!=null){baos.close();baos=null;}}catch(Exceptione){}try{if(b64os!=null){b64os.close();b64os=null;}}catch(Exceptione){}}}publicstaticbyte[]decode(byte[]b)throwsException{ByteArrayInputStreambais=null;InputStreamb64is=null;try{bais=newByteArrayInputStream(b);b64is=MimeUtility.decode(bais,"base64");byte[]tmp=newbyte[b.length];intn=b64is.read(tmp);byte[]res=newbyte[n];System.arraycopy(tmp,0,res,0,n);returnres;}catch(Exceptione){thrownewException(e);}finally{try{if(bais!=null){bais.close();bais=null;}}catch(Exceptione){}try{if(b64is!=null){b64is.close();b64is=null;}}catch(Exceptione){}}}}

browseVideo.jsp页面<%@pagelanguage="java"import="java.util.*"pageEncoding="utf-8"%><%@pageimport="com.neusoft.seas.core.session.CSessionManager,com.neusoft.seas.core.session.CSession"%><%@pageimport="huarun.SecurityHelper"%><%@pageimport="java.net.URLEncoder"%><html><head><title>浏览影像原文</title></head><body><%//影像系统的IP地址StringvideoUrl="http://10.241.94.31:30028/imsp/SunIASTokenApplyServlet.do";//StringvideoUrl="http://www.baidu.com";CSessionManagersessionMgr=CSessionManager.getSessionManager();CSessionseasSession=sessionMgr.getSession(request);//拼接的urlStringurl="";//个贷档案申请流水号StringapplyNumber=request.getParameter("applyNumber");//影像系统接入用户(固定)StringUID="admin";//影像系统接入用户密码(固定)StringPWD="111";//个贷系统应用ID(固定,等待个贷系统确认)StringAppID="DD";//当前档案登录用户IDStringUserID=seasSession.getUserId();//当前档案登录用户名称StringUserName=seasSession.getUserName();//(是不是登录用户的部门ID)StringOrgID="100001";//华润银行(信贷)StringOrgName="华润银行(信贷)";//BUSI_SERIAL_NO:个贷档案申请流水号;RIGHT:1101100(进入影像系统的人员权限;固定:查看、下载、打印)Stringinfo1="BUSI_SERIAL_NO:"+applyNumber+";OBJECT_NAME:SUN_CUST_DOC;QUERY_TIME:20140929;FILELEVEL:3;PERIOD:1;RIGHT:1101100";System.out.println("info1="+info1);StringnewUserName=URLEncoder.encode(UserName,"utf-8");StringnewOrgName=URLEncoder.encode(OrgName,"utf-8");//调用影像系统的加密包进行加密StringnewInfo1=URLEncoder.encode(SecurityHelper.encrypt("crbank",info1),"utf-8");url="?UID="+UID+"&PWD="+PWD+"&AppID="+AppID+"&UserID="+UserID+"&UserName="+newUserName+"&OrgID="+OrgID+"&OrgName="+newOrgName+"&info1="+newInfo1;//形成最终访问链接videoUrl+=url;System.out.println(videoUrl);//重定向到最终的链接地址response.sendRedirect(videoUrl);%></body></html>

解决方案

本帖最后由 czh520czh 于 2014-12-04 14:37:50 编辑

时间: 2024-08-01 22:14:18

在linux下的weblogic报错,但是 在window下的tomcat不报错!!十万火急!的相关文章

weblogic连接池-Java调用Oracle存储过程传入数组参数报错

问题描述 Java调用Oracle存储过程传入数组参数报错 weblogic连接池 JNDI提供的链接保存 Oracle数组 报错 oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection 大家好,我在用weblogic连接池 JNDI

el weblogic 报错 tomcat没报错

问题描述 el weblogic 报错 tomcat没报错 这句 weblogic 报这个错 tomcat没报错 解决方案 你用的是WebLogic10吧这个是EL写的不规范造成的 根据你抛的异常来看是在 (附近有语法错误 所以检查一下你的EL中是不是出现如下三种情况,第二种可能性比较大.1,三元运算符${a==b?xxx:yyy}需要加入括号手动处理运算优先级${a==b?(xxx):(yyy)}2,用EL取某个List的size();对于${xxxxList.size()} WebLogic

json校验格式报错,帮忙看下。

问题描述 json校验格式报错,帮忙看下. { "deplist": [ { bumen: 95, bound_id: "餐饮部", pad_sbound: "甜品类", pad_tab: 1 }, { bumen: 96, bound_id: "餐饮部", pad_sbound: "饮料类", pad_tab: 2 } ] } err info: bumen: 95, ------------------

win7 64位下 excel 连接odbc 数据源报错,32位下可以正常

问题描述 win7 64位下 excel 连接odbc 数据源报错,32位下可以正常 odbc数据源32位 excel 32位 配置的odbc数据源如图所示 在excel中 连接到odbc数据源 这种错误怎么解决 解决方案 你选错驱动了,这是Oracle的驱动,不是Access的. 解决方案二: WIN7 64位 ODBC连接Oracle 32位报错问题

javafx无法生成textfield区域,报错,报错和代码见下

问题描述 javafx无法生成textfield区域,报错,报错和代码见下 java.lang.reflect.InvocationTargetException package example; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.TextField; import java

filepath-Pathon 删除指定目录下的文件, 我是coding online,无法调试,代码报错,具体如下:

问题描述 Pathon 删除指定目录下的文件, 我是coding online,无法调试,代码报错,具体如下: #Delete all files under the pointed path import os filePath = raw_input("Input path where you want delete:n") #If file path is null, we should initial the variable "/home" if file

javaee hibernate-求助avaee hibernate 项目控制台报错 求帮忙分析下,万分感谢!!

问题描述 求助avaee hibernate 项目控制台报错 求帮忙分析下,万分感谢!! 出现异常时间: [2013年8月9日 15:15:32] org.hibernate.HibernateException: Already disconnectedat com.hiaward.common.util.HibernateUtil.rollbackTransaction(HibernateUtil.java:175) at com.hiaward.common.util.HibernateU

spring和mybatis集成时总报错 麻烦帮忙看下什么原因

问题描述 spring和mybatis集成时总报错 麻烦帮忙看下什么原因 项目请求数据的时候报Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.business.dao.system.AdminMapper.selectByPrimaryKey麻烦大神帮忙看下这是啥原因,找了好久不知道

项目启动报错-linux系统tomcat重启报错

问题描述 linux系统tomcat重启报错 以下是启动是的错误信息: INFO: Starting Coyote HTTP/1.1 on http-8080 Jan 21, 2015 4:26:24 PM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 Jan 21, 2015 4:26:24 PM org.apache.jk.server.JkMain start INFO:

hibernate 运行报错帮忙看看处理下,谢谢

问题描述 hibernate 运行报错帮忙看看处理下,谢谢 INFO: HHH000040: Configuration resource: /hibernate.cfg.xml Exception in thread "main" org.hibernate.MappingException: invalid configuration at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2158) at