Parsing of JSP File

在将JSP文件从Tomcat迁移到WebLogic时遇到解析失败的问题,具体表现为重复定义了language指令。通过调整%@ page指令的顺序解决了该问题。
将jsp文件从tomcat移动到weblogic的时候出现错误。
导致错误的代码:
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%@ page language="java" import="java.sql.*" %>
浏览器上的错误信息:
Parsing of JSP File '/index.jsp' failed:

/index.jsp(2): page directive language at /index.jsp:2 previously defined at /index.jsp:1
probably occurred due to an error in /index.jsp line 2:
<%@ page language="java" import="java.sql.*" %>

Mon Jan 15 14:48:28 CST 2007

解决方法:
修改代码为:
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*" %>

为何同样代码在tomcat可运行,在weblogic却要做这个修改,望路人指点,谢谢!
避免附件拖慢速度 跳过 download.jsp 类型链接 ,日志分析 查看 Scraped from 数量估算整体耗时,异常处理 避免因个别错误导致程序崩溃 要添加这三个import scrapy from urllib.parse import urljoin import filetype import tempfile import os import pdfplumber import docx2txt class NepuSpider(scrapy.Spider): name = "nepu" allowed_domains = ["www.nepu.edu.cn"] start_urls = ["https://www.nepu.edu.cn/"] def parse(self, response): try: # 判断是否为文本响应(HTML) if response.text: title = response.xpath('//title/text()').get() content = ' '.join(response.xpath('//body//text()').getall()).strip() yield { 'url': response.url, 'title': title, 'content': content } # 继续跟进链接 for href in response.css('a::attr(href)').getall(): full_url = urljoin(response.url, href) if self.allowed_domains[0] in full_url: yield response.follow(full_url, callback=self.parse) else: # 非文本响应(如 PDF、Word) kind = filetype.guess(response.body) if kind is not None: file_extension = kind.extension # 如 'pdf', 'docx' with tempfile.NamedTemporaryFile(delete=False, suffix=f".{file_extension}") as tmpfile: tmpfile.write(response.body) tmpfile_path = tmpfile.name try: text = "" if file_extension == "pdf": try: with pdfplumber.open(tmpfile_path) as pdf: for page in pdf.pages: extracted = page.extract_text() if extracted: text += extracted except Exception as e: self.logger.error(f"PDF extraction failed for {response.url}: {e}") elif file_extension == "docx": try: text = docx2txt.process(tmpfile_path) except Exception as e: self.logger.error(f"DOCX extraction failed for {response.url}: {e}") yield { 'url': response.url, 'title': f"Attachment_{file_extension}", 'content': text.strip() or "[Empty Content]" } except Exception as e: self.logger.error(f"Unexpected error during file processing: {e}") finally: os.unlink(tmpfile_path) else: self.logger.warning(f"Unknown binary file (no type detected): {response.url}") except Exception as e: self.logger.error(f"Error parsing response from {response.url}: {str(e)}") 改一下
07-04
我用Spring5的aop应用时报这个错误Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [D:\ecliple\web5\WEB-INF\applicationContext.xml]; nested exception is java.nio.file.NoSuchFileException: WEB-INF\applicationContext.xml,他说我的applicationContext.xml文件不存在,可是我明明有这个文件,另外我的web.xml需要更改吗<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <context-param> <param-name>contextConfigLocation </param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <display-name>Struts2</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class> <!--2.5版本的写法 --> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/* </url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> </web-app>
05-30
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值