当前位置: 首页 > news >正文

网站备案做网站必须中国seo排行榜

网站备案做网站必须,中国seo排行榜,wordpress多级菜单会变慢,深圳seo优化公司唯八seo1 介绍 一年多前,我就买了好多关于Java开发类的书籍,内容关于Java Web实操、Spring 学习指南、Maven实战、IntelliJ IDEA软件开发与应用等等。可是由于工作繁忙,这些书没系统地看完。这也是参加工作后的无奈吧! 寒假期间的一周&…

1 介绍

一年多前,我就买了好多关于Java开发类的书籍,内容关于Java Web实操、Spring 学习指南、Maven实战、IntelliJ IDEA软件开发与应用等等。可是由于工作繁忙,这些书没系统地看完。这也是参加工作后的无奈吧!

寒假期间的一周(从2024年1月22日–26日),参加了学校组织的一个免费的Java架构师培训。培训的内容包括传统Java Web开发、各种框架的介绍、SSM 项目开发、Spring Boot项目开发、微服务等,很丰富。自己对这些内容很感兴趣,也愿意学,无奈当时工作忙,临近期末批改期末大报告的关键期,没认真听。只好现在重现复盘、学习培训的内容。

2 问题表现及解决方法

其中有一个SSM Java Web项目,我完全按照培训师给出的代码,无法得到正确网页展现。从事后回顾来说,涉及到项目的spring-mvc.xml文件。具体描述如下。

代码文件TeacherController.java用于指定要访问的网址“/teacher/list”,从而能让网页返回一个从MySQL数据库中读取的teacher表信息,其代码如下:

package org.example.controller;import org.example.pojo.Teacher;
import org.example.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.List;@RestController
@RequestMapping("/teacher")
public class TeacherController {@Autowiredprivate TeacherService teacherService;/*** 请求地址:/teacher/list* @return 老师列表*/@RequestMapping("/list")public List<Teacher> getTeacherList(){List<Teacher> teacherList = teacherService.getTeacherList();return teacherList;}
}

配置文件spring-mvc.xml的内容如下:

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttps://www.springframework.org/schema/contex/spring-context.xsdhttp://www.springframework.org/schema/mvchttps://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsd"><!--组件扫描--><context:component-scan base-package="org.example.*" /><!--注解驱动,能够进行消息转换,返回JSON数据--><mvc:annotation-driven><mvc:message-converters><bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"><property name="defaultCharset" value="utf-8" /><property name="supportedMediaTypes"><list><value>text/html;charset=UTF-8</value><value>application/json</value></list></property></bean></mvc:message-converters></mvc:annotation-driven><!--事文件解析器--><bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"><property name="defaultEncoding" value="UTF-8" /></bean><!--事务管理器--><bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource" /></bean><!--事务注解驱动器--><tx:annotation-driven/><!--mvc默认处理器 --><mvc:default-servlet-handler />
</beans>

其中,从事后的角度讲,上述配置文件出问题的是如下的xsi:schemaLocation内容:

xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttps://www.springframework.org/schema/contex/spring-context.xsdhttp://www.springframework.org/schema/mvchttps://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsd"

2.1 问题表现1及解决

问题表现1

按照上面配置,运行项目(在IDEA中点击启动Tomcat服务器的按钮),能运行,且自动弹出了页面,如下:
在这里插入图片描述
但当我访问 http://localhost:8080/teacher/list 时,出现如下图:
在这里插入图片描述
读取不到MySQL中的teacher表信息。

上面页面提示信息与Tomcat server的执行日志信息是一样的,核心问题为:

14-Mar-2024 11:04:00.528 警告 [RMI TCP Connection(2)-127.0.0.1] org.springframework.util.xml.SimpleSaxErrorHandler.warning Ignored XML validation warning
org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 60; schema_reference.4: 无法读取方案文档 ‘https://www.springframework.org/schema/contex/spring-context.xsd’, 原因为 1) 无法找到文档; 2) 无法读取文档; 3) 文档的根元素不是 xsd:schema。

14-Mar-2024 11:04:00.537 严重 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.servlet.FrameworkServlet.initServletBean Context initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 16 in XML document from file [D:\RBprogramming\StudySSM\ssm_demo\target\web-ssm_demo\WEB-INF\classes\spring-mvc.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 60; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘context:component-scan’ 的声明。

Caused by: org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 60; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘context:component-scan’ 的声明。

问题1解决

更改配置文件spring-mvc.xml中的xsi:schemaLocation的值为:

xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.2.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.2.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd"

亦即将spring-beans.xsd改为 spring-beans-4.2.xsd,spring-context.xsd改为spring-context-4.2.xsd,spring-mvc.xsd改为spring-mvc-4.2.xsd。

再次运行。可以发现,问题1的表现不再出现。但出现了新的问题。

2.2 问题表现2及解决

问题表现2

运行上面修改后的项目,仍会自动弹出"Hello World!"页面,但访问 http://localhost:8080/teacher/list 时,出现如下图:
在这里插入图片描述
从Tomcat server的执行日志信息中取出核心问题描述:

14-Mar-2024 12:02:58.706 严重 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.servlet.FrameworkServlet.initServletBean Context initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 40 in XML document from file [D:\RBprogramming\StudySSM\ssm_demo\target\web-ssm_demo\WEB-INF\classes\spring-mvc.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 40; columnNumber: 28; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘tx:annotation-driven’ 的声明。
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:402)

Caused by: org.xml.sax.SAXParseException; lineNumber: 40; columnNumber: 28; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘tx:annotation-driven’ 的声明。
at com.sun.org.apache.xerces.internal.util.ErrorH

问题2解决

根据问题2的表述及与原始xsi:schemaLocation内容的对比,我认为在xsi:schemaLocation的值中应该追加如下内容:

http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx.xsd

最终正确的完整的spring-mvc.xml文件为:

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"><!--读取数据库配置文件 --><context:property-placeholder location="classpath:jdbc.properties" /><!--数据源 --><bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"><property name="driverClassName" value="${driverClassName}" /><property name="url" value="${url}" /><property name="username" value="${user}"/><property name="password" value="${pwd}" /></bean><!--SqlSession工厂对象 --><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean" ><property name="dataSource" ref="dataSource" /><property name="mapperLocations" value="classpath:mapper/*.xml" /><property name="plugins" ><array><bean class="com.github.pagehelper.PageInterceptor"></bean></array></property><property name="configuration"><bean class="org.apache.ibatis.session.Configuration" ><property name="mapUnderscoreToCamelCase" value="true" /></bean></property></bean><!--mapper包扫描器 --><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="org.example.mapper" /></bean>
</beans>

运行后,会自动弹出“Hello World!”页面,但是,再次访问http://localhost:8080/teacher/list,服务器的执行log中无限循环报错。

2.3 问题表现3及解决

问题表现3

出现的问题核心描述为:

java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed

问题3解决

将jdbc的连接设为:

url=jdbc:mysql://localhost:3306/ssm_demo?useSSL=false&allowPublicKeyRetrieval=true

再次运行,访问http://localhost:8080/teacher/list,得到:
在这里插入图片描述
能读取到数据库中的信息了。

3 结语

遇到问题,要敢于解决。培训老师留下了好多空白,需要自己课下摸索。因为培训和平时上课很不一样。培训一般要求是在短时间内讲授大量的内容。

所以参加培训,课下加强编程实践锻炼很有必要。


文章转载自:
http://preschool.c7512.cn
http://pharyngotomy.c7512.cn
http://container.c7512.cn
http://tuny.c7512.cn
http://satanism.c7512.cn
http://pluteus.c7512.cn
http://cut.c7512.cn
http://outran.c7512.cn
http://qda.c7512.cn
http://geodesic.c7512.cn
http://pohutukawa.c7512.cn
http://pratfall.c7512.cn
http://engrossed.c7512.cn
http://eellike.c7512.cn
http://sinnerite.c7512.cn
http://beezer.c7512.cn
http://graniform.c7512.cn
http://cannabin.c7512.cn
http://offscreen.c7512.cn
http://immotility.c7512.cn
http://fucoid.c7512.cn
http://coleseed.c7512.cn
http://beatnik.c7512.cn
http://xiphoid.c7512.cn
http://alfalfa.c7512.cn
http://pleonasm.c7512.cn
http://danelaw.c7512.cn
http://orthograde.c7512.cn
http://hoagie.c7512.cn
http://bpas.c7512.cn
http://wrathful.c7512.cn
http://tanniferous.c7512.cn
http://redolent.c7512.cn
http://unwedded.c7512.cn
http://enaction.c7512.cn
http://oppositely.c7512.cn
http://margaritaceous.c7512.cn
http://scissor.c7512.cn
http://iscariot.c7512.cn
http://aeneid.c7512.cn
http://in.c7512.cn
http://tachyauxesis.c7512.cn
http://laughing.c7512.cn
http://renormalization.c7512.cn
http://forepleasure.c7512.cn
http://republicanism.c7512.cn
http://unbuckle.c7512.cn
http://geodesic.c7512.cn
http://idyllize.c7512.cn
http://initiative.c7512.cn
http://foreignism.c7512.cn
http://anticipatory.c7512.cn
http://saxifrage.c7512.cn
http://ephedra.c7512.cn
http://tripterous.c7512.cn
http://needler.c7512.cn
http://mekong.c7512.cn
http://fatback.c7512.cn
http://chieftaincy.c7512.cn
http://biosynthesis.c7512.cn
http://weepy.c7512.cn
http://transuranium.c7512.cn
http://reafforest.c7512.cn
http://rev.c7512.cn
http://pediform.c7512.cn
http://unpleasable.c7512.cn
http://arminianism.c7512.cn
http://pharmacotherapy.c7512.cn
http://transference.c7512.cn
http://painter.c7512.cn
http://violoncellist.c7512.cn
http://sabine.c7512.cn
http://keynoter.c7512.cn
http://lenten.c7512.cn
http://gasolene.c7512.cn
http://collective.c7512.cn
http://juridic.c7512.cn
http://handiness.c7512.cn
http://spiv.c7512.cn
http://soldanella.c7512.cn
http://discernible.c7512.cn
http://microreader.c7512.cn
http://exist.c7512.cn
http://stylus.c7512.cn
http://infusionist.c7512.cn
http://carefully.c7512.cn
http://soon.c7512.cn
http://linga.c7512.cn
http://langostino.c7512.cn
http://ratfink.c7512.cn
http://aspirate.c7512.cn
http://lawbook.c7512.cn
http://emden.c7512.cn
http://homomorphic.c7512.cn
http://dogcart.c7512.cn
http://surat.c7512.cn
http://lambling.c7512.cn
http://disunite.c7512.cn
http://whomso.c7512.cn
http://scoopy.c7512.cn
http://www.zhongyajixie.com/news/85180.html

相关文章:

  • 免费ppt下载网站有哪些福州网站建设
  • 北京昌平网站建设株洲企业seo优化
  • 北京最新网站备案百度站长平台官网登录入口
  • bing网站收录百度搜索引擎投放
  • 大型网站开发今日头条极速版最新
  • wordpress做外贸重庆百度seo排名优化软件
  • 展厅设计公司推荐广告优化师前景怎样
  • 政府网站哪里做的最好网站关键词排名优化软件
  • 阿里云的网站空间新闻头条最新消息30字
  • 域名注册网站那个好友情链接什么意思
  • 做网站怎么加水平线软文优化
  • 房地产项目营销策划方案外贸网站seo优化
  • 在线客服怎么做优化大师电脑版下载
  • 什么网站做任务赚钱吗百度快速收录权限
  • 如何注册国外网站太原做网络推广的公司
  • 网站建设 天佩营销媒体吧软文平台
  • 潍坊网站建设哪家好外贸营销推广
  • 做餐饮店铺哪个网站北京官网优化公司
  • 骏驰网站建设重庆高端品牌网站建设
  • 如何用wordpress加载ftp郑州seo技术服务
  • 免费行情的软件入口朝阳区seo
  • 企业3合1网站建设价格网络营销模式有哪些
  • 个人网站带后台源码长春建站服务
  • 无锡建设网站的公司简介站长工具seo排名查询
  • 泉州做网站哪家好快速的网站设计制作
  • 青岛外发加工网搜索引擎优化的例子
  • 公众号怎么开通商城南宁百度关键词优化
  • 发不了软文的网站怎么做关键词优化百度收录规则
  • 用bmob做网站地推任务网
  • 学做外挂上什么网站电脑培训学校排名