Jboss上部署war包, 第一次打开页面出现如下错误,以后再打开同样的页面就正常了,不只什么原因,很是郁闷!
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: java.util.zip.ZipException: invalid entry size (expected 1939669000 but got 727 bytes)
org.jboss.web.tomcat.service.jasper.TagLibCache.init(TagLibCache.java:106)
org.jboss.web.tomcat.service.jasper.TagLibCache.getLocation(TagLibCache.java:83)
org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:530)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:419)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:476)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1426)
org.apache.jasper.compiler.Parser.parse(Parser.java:133)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
最近项目中要求在前台通过jsp以进度条显示数据库操作进度(导数据), 其它没问题, 只是不是很清楚如何获取后台数据库操作的进度信息,因为要在前台做进度条的话,得即时获得后台数据库的操作进度信息,不知道该如何去实现,望各位大侠指点
简单的一个java版的AES文件加密demo, 运行正常, 但文件一大速度就会很慢,不知道是否能优化一下,以提高增快加密的速度
或许是我的代码写法有问题, 希望各位大俠指正
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public class AES {
// 加密文件
public static void encryptfile(String pwd, File fileIn) throws Exception {
try {
//读取文件
FileInputStream fis = new FileInputStream(fileIn);
byte[] bytIn = new byte[(int) fileIn.length()];
for (int i = 0; i < fileIn.length(); i++) {
bytIn[i] = (byte) fis.read();
}
//AES加密
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128, new SecureRandom(pwd.getBytes()));
SecretKey skey = kgen.generateKey();
byte[] raw = skey.getEncoded();
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
//写文件
byte[] bytOut = cipher.doFinal(bytIn);
FileOutputStream fos = new FileOutputStream(fileIn.getPath()
+ ".aes");
for (int i = 0; i < bytOut.length; i++) {
fos.write((int) bytOut[i]);
}
fos.close();
fis.close();
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
public static void main(String[] args) throws Exception {
AES aes = new AES();
String pwd = "123";
File file = new File("d:/xxx.doc");
aes.encryptfile(pwd, file);
}
}