国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

網(wǎng)站續(xù)費(fèi)怎么做分錄百度搜一下

網(wǎng)站續(xù)費(fèi)怎么做分錄,百度搜一下,公安網(wǎng)站備案到底需要什么,工作室 網(wǎng)站經(jīng)營性備案1 介紹 一年多前,我就買了好多關(guān)于Java開發(fā)類的書籍,內(nèi)容關(guān)于Java Web實(shí)操、Spring 學(xué)習(xí)指南、Maven實(shí)戰(zhàn)、IntelliJ IDEA軟件開發(fā)與應(yīng)用等等??墒怯捎诠ぷ鞣泵?amp;#xff0c;這些書沒系統(tǒng)地看完。這也是參加工作后的無奈吧! 寒假期間的一周&…

1 介紹

一年多前,我就買了好多關(guān)于Java開發(fā)類的書籍,內(nèi)容關(guān)于Java Web實(shí)操、Spring 學(xué)習(xí)指南、Maven實(shí)戰(zhàn)、IntelliJ IDEA軟件開發(fā)與應(yīng)用等等??墒怯捎诠ぷ鞣泵?#xff0c;這些書沒系統(tǒng)地看完。這也是參加工作后的無奈吧!

寒假期間的一周(從2024年1月22日–26日),參加了學(xué)校組織的一個(gè)免費(fèi)的Java架構(gòu)師培訓(xùn)。培訓(xùn)的內(nèi)容包括傳統(tǒng)Java Web開發(fā)、各種框架的介紹、SSM 項(xiàng)目開發(fā)、Spring Boot項(xiàng)目開發(fā)、微服務(wù)等,很豐富。自己對(duì)這些內(nèi)容很感興趣,也愿意學(xué),無奈當(dāng)時(shí)工作忙,臨近期末批改期末大報(bào)告的關(guān)鍵期,沒認(rèn)真聽。只好現(xiàn)在重現(xiàn)復(fù)盤、學(xué)習(xí)培訓(xùn)的內(nèi)容。

2 問題表現(xiàn)及解決方法

其中有一個(gè)SSM Java Web項(xiàng)目,我完全按照培訓(xùn)師給出的代碼,無法得到正確網(wǎng)頁展現(xiàn)。從事后回顧來說,涉及到項(xiàng)目的spring-mvc.xml文件。具體描述如下。

代碼文件TeacherController.java用于指定要訪問的網(wǎng)址“/teacher/list”,從而能讓網(wǎng)頁返回一個(gè)從MySQL數(shù)據(jù)庫中讀取的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;/*** 請(qǐng)求地址:/teacher/list* @return 老師列表*/@RequestMapping("/list")public List<Teacher> getTeacherList(){List<Teacher> teacherList = teacherService.getTeacherList();return teacherList;}
}

配置文件spring-mvc.xml的內(nèi)容如下:

<?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.*" /><!--注解驅(qū)動(dòng),能夠進(jìn)行消息轉(zhuǎn)換,返回JSON數(shù)據(jù)--><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><!--事務(wù)管理器--><bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource" /></bean><!--事務(wù)注解驅(qū)動(dòng)器--><tx:annotation-driven/><!--mvc默認(rèn)處理器 --><mvc:default-servlet-handler />
</beans>

其中,從事后的角度講,上述配置文件出問題的是如下的xsi:schemaLocation內(nèi)容:

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 問題表現(xiàn)1及解決

問題表現(xiàn)1

按照上面配置,運(yùn)行項(xiàng)目(在IDEA中點(diǎn)擊啟動(dòng)Tomcat服務(wù)器的按鈕),能運(yùn)行,且自動(dòng)彈出了頁面,如下:
在這里插入圖片描述
但當(dāng)我訪問 http://localhost:8080/teacher/list 時(shí),出現(xiàn)如下圖:
在這里插入圖片描述
讀取不到MySQL中的teacher表信息。

上面頁面提示信息與Tomcat server的執(zhí)行日志信息是一樣的,核心問題為:

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’, 原因?yàn)?1) 無法找到文檔; 2) 無法讀取文檔; 3) 文檔的根元素不是 xsd:schema。

14-Mar-2024 11:04:00.537 嚴(yán)重 [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。

再次運(yùn)行??梢园l(fā)現(xiàn),問題1的表現(xiàn)不再出現(xiàn)。但出現(xiàn)了新的問題。

2.2 問題表現(xiàn)2及解決

問題表現(xiàn)2

運(yùn)行上面修改后的項(xiàng)目,仍會(huì)自動(dòng)彈出"Hello World!"頁面,但訪問 http://localhost:8080/teacher/list 時(shí),出現(xiàn)如下圖:
在這里插入圖片描述
從Tomcat server的執(zhí)行日志信息中取出核心問題描述:

14-Mar-2024 12:02:58.706 嚴(yán)重 [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解決

根據(jù)問題2的表述及與原始xsi:schemaLocation內(nèi)容的對(duì)比,我認(rèn)為在xsi:schemaLocation的值中應(yīng)該追加如下內(nèi)容:

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"><!--讀取數(shù)據(jù)庫配置文件 --><context:property-placeholder location="classpath:jdbc.properties" /><!--數(shù)據(jù)源 --><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工廠對(duì)象 --><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>

運(yùn)行后,會(huì)自動(dòng)彈出“Hello World!”頁面,但是,再次訪問http://localhost:8080/teacher/list,服務(wù)器的執(zhí)行l(wèi)og中無限循環(huán)報(bào)錯(cuò)。

2.3 問題表現(xiàn)3及解決

問題表現(xiàn)3

出現(xiàn)的問題核心描述為:

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

問題3解決

將jdbc的連接設(shè)為:

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

再次運(yùn)行,訪問http://localhost:8080/teacher/list,得到:
在這里插入圖片描述
能讀取到數(shù)據(jù)庫中的信息了。

3 結(jié)語

遇到問題,要敢于解決。培訓(xùn)老師留下了好多空白,需要自己課下摸索。因?yàn)榕嘤?xùn)和平時(shí)上課很不一樣。培訓(xùn)一般要求是在短時(shí)間內(nèi)講授大量的內(nèi)容。

所以參加培訓(xùn),課下加強(qiáng)編程實(shí)踐鍛煉很有必要。

http://m.aloenet.com.cn/news/41121.html

相關(guān)文章:

  • 網(wǎng)站主機(jī)安全網(wǎng)絡(luò)推廣公司聯(lián)系方式
  • java里面做網(wǎng)站都要學(xué)什么百度營銷客戶端
  • dede 轉(zhuǎn)wordpressseo分析報(bào)告
  • 咸陽市住房和城鄉(xiāng)建設(shè)規(guī)劃局網(wǎng)站武漢網(wǎng)站設(shè)計(jì)
  • 張店易寶網(wǎng)站建設(shè)百度分公司
  • 濟(jì)南做網(wǎng)站公司xywlcn網(wǎng)站搜索引擎優(yōu)化報(bào)告
  • 手表網(wǎng)站制作照片網(wǎng)絡(luò)營銷的核心
  • 購物網(wǎng)站排行nba季后賽最新排名
  • 做返利網(wǎng)站能賺錢aso排名優(yōu)化
  • 做的比較好的官方網(wǎng)站上海百度推廣方案
  • 珠海做網(wǎng)站哪家專業(yè)seo sem論壇
  • 如何做網(wǎng)站的搜索欄網(wǎng)絡(luò)營銷的推廣方法有哪些
  • 自己搭建服務(wù)器做網(wǎng)站91手機(jī)用哪個(gè)瀏覽器
  • 網(wǎng)站優(yōu)化主旨百度廣告推廣收費(fèi)標(biāo)準(zhǔn)
  • 武漢專業(yè)網(wǎng)站建設(shè)zz51上海網(wǎng)站制作開發(fā)
  • 競(jìng)網(wǎng)做的網(wǎng)站交換鏈接營銷成功案例
  • 做網(wǎng)站與考研學(xué)技術(shù)包分配的培訓(xùn)機(jī)構(gòu)
  • WordPress方糖無錫網(wǎng)站建設(shè)優(yōu)化公司
  • 專業(yè)的團(tuán)隊(duì)網(wǎng)站建設(shè)引擎搜索入口
  • 室內(nèi)裝修設(shè)計(jì)圖紙seo快速軟件
  • 外國人做外貿(mào)都會(huì)瀏覽哪些網(wǎng)站焊工培訓(xùn)內(nèi)容有哪些
  • 網(wǎng)站建設(shè)常用代碼營銷策劃36計(jì)
  • 直播視頻網(wǎng)站如何做網(wǎng)站策劃
  • 佛山專業(yè)做企業(yè)網(wǎng)站上海今天最新發(fā)布會(huì)
  • 吉 360 網(wǎng)站建設(shè)如何做好精準(zhǔn)營銷
  • 網(wǎng)站客服工作內(nèi)容重慶網(wǎng)站建設(shè)哪家好
  • 凡客專賣店網(wǎng)站優(yōu)化入門
  • 安徽國貿(mào)集團(tuán)網(wǎng)站建設(shè)沈陽網(wǎng)站推廣優(yōu)化
  • 合肥專業(yè)做網(wǎng)站的互聯(lián)網(wǎng)域名注冊(cè)查詢
  • 做網(wǎng)站拍攝照片用什么佳能相機(jī)好網(wǎng)站優(yōu)化課程培訓(xùn)