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.
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);
Need some help debugging. Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Object.equals(Object)" because "this.items[i]" is null
Property.get in ValueSource throws java.lang.NullPointerException: Cannot invoke "java.lang.Class.getName()" because "this.type" is null
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null
internal exception java.lang.nullpointerexception can not invoke "net.minecraft.nbt.compoundtag.m_128459_(string) | Forge 1.20.1 Server
public class ArraySet<T> {
private T[] items;
private int size;
public ArraySet() {
items = (T[]) new Object[100];
size = 0;
}
public void add(T value) {
for (int i = 0; i < size; i++) {
if (items[i] == value) {
return;
}
}
items[size + 1] = value;
size ++;
}
public boolean contains(T x) {
for (int i = 0; i < size; i++) {
if (items[i].equals(x)) {
return true;
}
}
return false;
}
public static void main(String[] args) {
ArraySet<String> s = new ArraySet<>();
// test add function
s.add("horse");
System.out.println(s.size);
s.add("fish");
System.out.println(s.size);
// test contains function
System.out.println(s.contains("horse"));
}
}I self create an Arrayset class to store strings with add function and contains function, but the contains function goes wrong. I try to modify my add function but it doesn't works.
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Object.equals(Object)" because "this.items[i]" is null
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)
when people try to connect to my server, they receive this error messageinternal exception java.lang.nullpointerexception can not invoke "net.minecraft.nbt.compoundtag.m_128459_(string)
i also received this error message as well but during this test for some reason it let me join the server, i've tested this out on singleplayer as well and the world works fine nothing seems to be corrupted it just doesn't work for the server.
we've also made multiple worlds for this specific pack i've made and they all have had this problem, randomly sometimes people will be able to join and play normally but other times they get this error and they cant play.
friends latest.log: https://mclo.gs/mHmks83
servers lastest.log: https://mclo.gs/si9AJk2