-
Notifications
You must be signed in to change notification settings - Fork 1
Java VS Code Case API Troubleshooting
MsaasAPI edited this page Sep 20, 2018
·
14 revisions
📑This list is NOT intended to be exhaustive.📑
- Dependency Resolution Issue
- GIT Detached HEAD
- Log4j StaticLoggerBinder Loading Warnings
- Logger Appenders Not Found
- Symptom: In spite of correct dependency entry in pom.xml, the following error occurs in code.
[Java] The import xxx cannot be resolved
- Suggestions
- Restart VS Code.
- Clean the workspace directory.
-
Symptom:
When running GIT command:git status
It returns:
HEAD detached at b9aee7d nothing to commit, working tree clean
When running GIT command:
git merge
It returns:
fatal: No current branch.
When running GIT command:
git symbolic-ref HEAD
It returns:
fatal: ref HEAD is not a symbolic ref
-
Analysis: per Stack Overflow article: HEAD is the symbolic name for the currently checked out commit. When HEAD is not detached (the “normal”1 situation: you have a branch checked out), HEAD actually points to a branch’s “ref” and the branch points to the commit. HEAD is thus “attached” to a branch. When HEAD is detached, it points directly to a commit—instead of indirectly pointing to one through a branch. You can think of a detached HEAD as being on an unnamed branch.
-
Suggestions: Run the following commands per same Stack Overflow article.
git branch temp git checkout temp git log --graph --decorate --pretty=oneline --abbrev-commit master origin/master temp git diff master temp git diff origin/master temp git branch -f master temp git checkout master git branch -d temp git push origin master
- Symptom: When running console debugger, the following warning appears.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
-
Suggestions: Add following dependency to pom.xml.
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.25</version> </dependency>
- Symptom: When running console debugger (especially after resolving StaticLoggerBinder Loading issue, the following warning appears.
log4j:WARN No appenders could be found for logger (adal4jPii.class com.microsoft.aad.adal4j.AuthenticationContext). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
-
Suggestions: Add following snippets to Program.java.
import org.apache.log4j.BasicConfigurator; BasicConfigurator.configure();