I think your problem is related with the lack of a @Component annotation in your BoardDao class.
The component should have a @Component annotation to instantiate the singleton to be injected in your Service Layer.
@Component
public class BoardDao extends SqlSessionDaoSupport{
@Autowired
SqlSessionTemplate session;
public List<BoardDto> listboard(BoardDto dto) {
System.out.println("dao.");
List<BoardDto> result = session.selectList("boarddate.listboard", dto);
return result;
}
}
If the problem persist, you may try with the @Repository annotation. Sadly I haven't used the class SqlSessionDaoSupport, so I don't know exactly the best annotation for that.
java - Cannot invoke "" because "" is null - Stack Overflow
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.createStatement()" because is null
[BUG] Eclipse: java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.internal.compiler.CompilationResult.getCompilationUnit()" because "unitResult" is null
BUILD: ERROR: Cannot invoke "java.util.Map.get(Object)" because "strings" is null
I think your problem is related with the lack of a @Component annotation in your BoardDao class.
The component should have a @Component annotation to instantiate the singleton to be injected in your Service Layer.
@Component
public class BoardDao extends SqlSessionDaoSupport{
@Autowired
SqlSessionTemplate session;
public List<BoardDto> listboard(BoardDto dto) {
System.out.println("dao.");
List<BoardDto> result = session.selectList("boarddate.listboard", dto);
return result;
}
}
If the problem persist, you may try with the @Repository annotation. Sadly I haven't used the class SqlSessionDaoSupport, so I don't know exactly the best annotation for that.
In my case it was with a Map, I wanted to increase its value, but this initial one will not exist, therefore it is null.
map.put(0, map.get(0) 1);
It was fixed by adding a validation, like so:
map.put(0, map.get(0) != null ? map.get(0) + 1 : 1);
hello, im doing a list with SQL, and when i try to connect to the database, I always get this error, I already saw the ports, and everything is correct, but it says that it cannot connect, maybe a typing problem? can someone tell why what is wrong pls?
https://pastebin.com/vtcMwSRn
So I am currently going crazy trying to get images to load when you export it to a .jar file. Before I was just using, "new imageicon("picturepath")"
As you can see from lines 30-34.
Then I found out that doesn't carry over when you make the project into a .jar file, okay cool. So I found out that you want to use, "getResource" okay cool got it. Try that and now I get the error in the title. when that location isn't fucking null so that's horse shit. I've tried every variation of that path. I have tried moving my images folder all over the project; from inside the src folder, where it is now, to just in the main project folder, etc. I don't know why it isn't happy.
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:234) at LaunchPage.<init>(LaunchPage.java:25) at Main.main(Main.java:5)