Skip to content

Commit cf41e62

Browse files
adding FAQ to README
1 parent 561adfd commit cf41e62

File tree

2 files changed

+269
-2
lines changed

2 files changed

+269
-2
lines changed

README.md

Lines changed: 268 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,271 @@ If you would like learn about what's new in Spring Framework 5, click [here](htt
88

99
If you'd like to learn more about the cool new reactive types in Spring Framework 5, click [here](https://springframework.guru/spring-web-reactive/)
1010

11-
You can learn about my Spring Framework 5 Online course [here.](https://courses.springframework.guru/p/spring-framework-5-begginer-to-guru)
11+
You can learn about my Spring Framework 5 Online course [here.](https://courses.springframework.guru/p/spring-framework-5-begginer-to-guru)
12+
13+
# Spring Framework 5: Beginner to Guru Course FAQs
14+
15+
Check out this section for answers to frequently asked questions!
16+
17+
## Development Environment Setup
18+
19+
### Recommended Versions
20+
21+
| Recommended | Reference | Notes |
22+
| ----------- | --------- | ----- |
23+
| Oracle Java 8 JDK | [Download](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) | Java 11 is okay, see notes in FAQ |
24+
| IntelliJ 2018 or Higher | [Download](https://www.jetbrains.com/idea/download/) | Ultimate Edition recommended |
25+
| Maven 3.6.0 or higher | [Download](https://maven.apache.org/download.cgi) | [Installation Instructions](https://maven.apache.org/install.html)|
26+
| Gradle 4.8 or higher | [Download](https://gradle.org/install/) | **Note:** Use Version 5 or higher if using Java 11 |
27+
| Git 2.15 or higher | [Download](https://git-scm.com/downloads) | |
28+
| Git GUI Clients | [Downloads](https://git-scm.com/downloads/guis) | Not required. But can be helpful if new to Git. SourceTree is a good option for Mac and Windows users. |
29+
| Spring Boot 2.1 or higher | [What's new](https://content.pivotal.io/springone-platform-2017/whats-new-in-spring-boot-2-0-phillip-webb-madhura-bhave) | |
30+
31+
### Getting Help With the Course
32+
#### Udemy Q&A
33+
Each course section has a Q&A Section. This should always be your first stop. Thousands of people have take this course.
34+
Check to see if someone else asked a question related to your problem.
35+
36+
If not, share your problem here. The instructor, teacher's assistants, and other students watch and answer questions.
37+
38+
#### Slack
39+
By enrolling in *Spring Framework 5: Beginner to Guru* you can join a Slack community exclusive to this course.
40+
41+
In Slack you can get help 24 hrs a day, 7 days a week. The instructor, teachers assistants, and other students monitor Slack.
42+
43+
See section 1 of the course for instructions on how to join.
44+
45+
#### Do's and Don't of Getting Help
46+
47+
###### Do - Use Udemy Q&A or Slack
48+
These resources are monitored by the instructor, teachers assistants, and other students.
49+
50+
###### Don't - Email or message the instructor directly
51+
Asking your question in the public forums actually help others learn too. When you go outside the community, this is lost.
52+
Also, the instructor is not always on-line and does take days off. You are likely to get a much faster response using Udemy Q&A or
53+
Slack.
54+
55+
###### Do - Share a Link to your Project on GitHub
56+
This helps others re-create your problem.
57+
58+
###### Don't - Share just a short part of the Error
59+
Example of error shared:
60+
```xml
61+
Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project pet-clinic: Maven execution failed, exit code: '1' -> [Help 1]
62+
```
63+
In the above example, it is impossible to tell what the root cause is. The person has not shared enough details.
64+
65+
When seeking help, help others help you!
66+
67+
###### Do - Share the Error Output in a GitHub Gist Link
68+
Create a [Gist](https://help.github.com/articles/about-gists/) of the error output to share.
69+
70+
**Pro-Tip** - You can create a gist from the run window of IntelliJ. In the console, right click > select option for
71+
create gist.
72+
73+
###### Don't Share Screenshots
74+
Using a gist is usually a better option!
75+
76+
###### Don't - Open GitHub Issues
77+
Unfortunately, the course has been pirated. Support is for people who are legitimately enrolled in the course. There is
78+
no way to verify enrollment from GitHub. Thus, problems raised on GitHub will not be addressed.
79+
80+
**Exception:** One exception is the Pet Clinic project, which is being treated as a community project.
81+
### Java Version
82+
83+
#### Which version of Java should I use?
84+
85+
Majority of the course has been developed on Java 8. The course is being updated to Java 11.
86+
87+
If you wish to use Java 9 or higher, please modify the following:
88+
89+
**Note:** If you are on Java 9, or Java 10 you should consider updating to Java 11.
90+
91+
Update your Maven POM properties to reflect the Java version.
92+
```xml
93+
<properties>
94+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
95+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
96+
<java.version>11</java.version>
97+
<jaxb.version>2.3.0</jaxb.version>
98+
<maven.compiler.source>${java.version}</maven.compiler.source>
99+
<maven.compiler.target>${java.version}</maven.compiler.target>
100+
</properties>
101+
102+
```
103+
104+
The JAXB API is no longer included with Java in Java 9 and higher. You will need to add this dependency as follows:
105+
106+
```xml
107+
<dependency>
108+
<groupId>javax.xml.bind</groupId>
109+
<artifactId>jaxb-api</artifactId>
110+
<version>${jaxb.version}</version>
111+
</dependency>
112+
<dependency>
113+
<groupId>com.sun.xml.bind</groupId>
114+
<artifactId>jaxb-core</artifactId>
115+
<version>${jaxb.version}</version>
116+
</dependency>
117+
<dependency>
118+
<groupId>com.sun.xml.bind</groupId>
119+
<artifactId>jaxb-impl</artifactId>
120+
<version>${jaxb.version}</version>
121+
</dependency>
122+
```
123+
124+
#### Do I need to use the Oracle JDK?
125+
No. Open JDK should work just as well.
126+
127+
#### Do I need to pay Oracle for a license to use Java?
128+
No, the Oracle JDK is free to use for development.
129+
130+
### Java IDE
131+
#### Do I meed to use IntelliJ for this course?
132+
No, all source code examples use Maven or Gradle. Any modern Java IDE supports these build tools.
133+
134+
#### Is it okay to use Eclipse for this course?
135+
Yes. However, please understand the instructor has not used Eclipse in over 10 years and will not be able to
136+
answer IDE related questions.
137+
138+
#### Can I use the Community Edition of IntelliJ?
139+
Yes. The Community edition of IntelliJ is very good. The Ultimate Edition does have advanced features to support
140+
Spring Framework development. These features are used in the course, and will not be available in the
141+
Community Edition.
142+
143+
#### How do I get the free 120 Day Trial to IntelliJ Ultimate?
144+
See section 1 of the course. There is a lecture with a sign-up link to register. You can download IntelliJ Ultimate with a
145+
free 30 day trial right away. You will be emailed a code with instructions within 3-5 business days. (often faster)
146+
147+
#### I haven't received my 120 Day Trial code to IntelliJ Ultimate
148+
If it has been more than 5 days, check your spam folder. (Almost always there!) If not found, email John Thompson. If
149+
messaging on Udemy please include the email you registered with.
150+
151+
#### The code I received is not working.
152+
This is often one of the following:
153+
* You are entering the code as a license in IntelliJ. It is not a license code. It is a code for JetBrains to
154+
issue you a 120 day license. Use this [link](https://www.jetbrains.com/store/redeem/) to register with JetBrains.
155+
* If you get the error ```This coupon code is not applicable to the product.``` often it is because the email you are
156+
using has been registered with JetBrains in the past. Try using a different email account.
157+
158+
#### Can I Use the EAP version of IntelliJ?
159+
Yep! The instructor typically runs on the EAP version to get all the latest features. The EAP version is usually
160+
very stable. Checkout the latest EAP version [here](https://www.jetbrains.com/idea/whatsnew/)
161+
162+
## Common Problems
163+
#### Getting error - Whitelabel Error Page - This application has no explicit mapping for /error...
164+
This is a generic error page generated by Spring Boot. The root cause can be many different things.
165+
166+
If you see this web page, you need to view the Spring Boot console messages to determine the root cause.
167+
168+
#### Project wont start. Getting error: java.net.BindException: Address already in use
169+
May see in console log:
170+
```
171+
***************************
172+
APPLICATION FAILED TO START
173+
***************************
174+
175+
Description:
176+
177+
The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.
178+
179+
Action:
180+
181+
Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
182+
```
183+
184+
This means another application is already running on port 8080. You need to find and stop the other application.
185+
186+
#### Database tables missing in H2 Database console.
187+
By default Spring Boot will configure the datasource as ```jdbc:h2:mem:testdb```
188+
189+
However, if running the H2 database console for the first time, the datasource URL is ```jdbc:h2:~/test```
190+
191+
What happens is the H2 database console is connecting to a different instance of the H2 database console, thus you will
192+
not see the database tables.
193+
194+
**Solution:** When connecting in the H2 Database Console, change the JDBC URL to ```jdbc:h2:mem:testdb```
195+
196+
#### Multi-Module Maven Project has error 'can't find Main class'
197+
Spring Boot is trying to build an executable fat JAR with dependencies for a module that should be a normal JAR, thus looking
198+
for the main class for the JAR manifest file.
199+
200+
**Solution:**
201+
You need to tell the Spring Boot Maven Plugin to **not** repackage the jar.
202+
203+
Add the following property to the Maven module you wish packaged as a normal jar.
204+
205+
```xml
206+
<properties>
207+
<spring-boot.repackage.skip>true</spring-boot.repackage.skip>
208+
</properties>
209+
```
210+
**Note:** For Spring Boot 2.1 or Higher! This configuration has changed from earlier versions of Spring Boot.
211+
212+
#### Getting an error, but cannot find what is different from lesson source code.
213+
Sometimes it can be a very small difference. You can use Git to report the differences between your code and the example
214+
source code for the lesson.
215+
216+
**Note:** This will only work if you've forked the original source code example to your GitHub repository.
217+
218+
1. Commit all of your changes.
219+
2. Add remote for original repo - ```git remote add sfgRepo github_url```
220+
3. Fetch remote - ```git fetch sfgRepo```
221+
4. Run diff - ```git diff HEAD..sfgRepo/master``` <- update branch name from master to desired branch for lesson
222+
223+
#### Error - java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
224+
You are running Java 9+ and have not added the JAXB dependencies.
225+
226+
Add the following dependencies to your Maven POM:
227+
228+
```xml
229+
<properties>
230+
<jaxb.version>2.3.0</jaxb.version>
231+
</properties>
232+
233+
<dependencies>
234+
<dependency>
235+
<groupId>javax.xml.bind</groupId>
236+
<artifactId>jaxb-api</artifactId>
237+
<version>${jaxb.version}</version>
238+
</dependency>
239+
<dependency>
240+
<groupId>com.sun.xml.bind</groupId>
241+
<artifactId>jaxb-core</artifactId>
242+
<version>${jaxb.version}</version>
243+
</dependency>
244+
<dependency>
245+
<groupId>com.sun.xml.bind</groupId>
246+
<artifactId>jaxb-impl</artifactId>
247+
<version>${jaxb.version}</version>
248+
</dependency>
249+
</dependencies>
250+
```
251+
252+
#### JUnit 5 Tests are not running from Maven
253+
There are several reasons for this, and a lot of bad advice on the internet.
254+
255+
Please see this [blog post!](https://springframework.guru/why-your-junit-5-tests-are-not-running-under-maven/)
256+
257+
#### Spring Pet Clinic - CSS is not rendered, page is not styled.
258+
The CSS resources are generated with Maven. Thus if the project is cleaned, not built, or re-generated with IntelliJ
259+
the CSS resources will not exist.
260+
261+
**Solution:** Just build the project with Maven. ```mvn clean package```
262+
263+
#### Error 'No qualifying Bean of type [Java class name] found for dependency...'
264+
Spring is looking for a bean of a specific type in the context, but is unable to find it. Error is because Spring
265+
has not been configured to create a bean for the Java class indicated in the message.
266+
267+
This may be due to several different reasons, but when troubleshooting - keep in mind Spring is telling you
268+
that Java class is missing from the context. You need to tell Spring to create a bean of that type.
269+
270+
Try the following:
271+
1. Make sure you have a bean of the type configured.
272+
* Is the missing Java class annotated with a Spring stereotype - @Component, @Controller, @RestController, @Service, @Repository?
273+
* Or has the bean been declared in a Java configuration class using the @Bean annotation?
274+
2. Is the package of the Java class or configuration class being scanned?
275+
* By default, Spring Boot will do a component scan of the package of the main application class, and all sub-packages.
276+
A common mistake is to create a package outside of this package structure. (thus, Spring does not 'see' the configuration)
277+
* If the component is not under the package of the main application class, use the @ComponentScan annotation. See this
278+
[link](https://springframework.guru/spring-component-scan/) for additional information.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>2.0.0.M5</version>
17+
<version>2.1.2.RELEASE</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

0 commit comments

Comments
 (0)