Giter Site home page Giter Site logo

myspringboot's Introduction

myspringboot's People

Contributors

samplecj avatar

Watchers

James Cloos avatar  avatar

myspringboot's Issues

Authenticating a User with LDAP(projectName="gs-authenticating-ldap")(build=Gradle)

本人在该项目实践中遇到的错误,其实已在官方github项目上的issue中有过提出和解答。但在这些反馈并没有及时更新到Guides文档或github项目的readMe上。
正确配置已于github项目的complete文件夹中。


错误报告

localhost:8080/中输入userpassword后,得到如下反馈:

org.springframework.ldap.CommunicationException: localhost:8389; nested exception is javax.naming.CommunicationException: localhost:8389 [Root exception is java.net.ConnectException: Connection refused]

这可能是缺少某种配置文件映射。

解决方法
我们新增配置文件application.properties,于以下文件路径

gs-authenticating-ldap\src\main\resources`application.properties

application.properties内容如下:

spring.ldap.embedded.ldif=classpath:test-server.ldif
spring.ldap.embedded.base-dn=dc=springframework,dc=org
spring.ldap.embedded.port=8389

注意文本规范,即不应在每句行末留下空格。

Creating a Batch Service(projectName="gs-batch-processing")(build=Gradle)

这里捉一个虫,不算作代码实现的错误。
本篇Guide在Build with your IDE\Business Data下给了表格文件sample-data.csv的内容,并提供一键复制的功能,但该复制会在Excel中成为,

Jill,Doe
Joe,Doe
Justin,Doe
Jane,Doe
John,Doe

而实际上,在clone本项目中你会发现,实际sample-data.csv应为2列5行的电子表格,

Jill | Doe
Joe | Doe
Justin | Doe
Jane | Doe
John | Doe

以上。

Acceing Data with JPA (projectName="gs-accessing-data-jpa")(build=Gradle)

由于个人开发环境与官方文档的差异,因此即使clone项目并注入代码,也有遇上阻碍。


错误报告

在错误报告log.ERROR(...)

2018-10-19 13:43:18.927 ERROR 18992 --- [ main] o.s.boot.SpringApplication : Application run failed

其下首行

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

划重点

Invocation of init method failed

nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

前者描述问题结果,后者指出可能的错误源JAXBException,即与jaxb-api有关。
这是jdk版本更替所诱发的问题。在jdk8.X至jdk9.X的更新中,jdk9.X为实现模块化,将原本于jdk8.X上仍默认捆绑的jaxb-api剔除其默认路径。
简而言之,我们的配置路径上缺少了jaxb-api的jar包。
若是build with Gradle,只需要在build.gradle文件中添加相应的依赖语句即可。

解决办法
所求依赖语句,应于Maven Repository中搜索jaxb-api可得。点入并选择最新或合适的稳定版本。
在页面下方,会有MavenGradle等的选项卡,选择我们的Gradle,得到依赖语句,

compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.X.X

我们需要手动添加依赖关系:

  • 在gs-accessing-data-jpa\ ... \build.gradle 文件下
  • 于代码块 dependencies { ... } 中添加该句

具体为

dependencies {
  ...
  compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.X.X
  ...
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.