我有一个java项目(Netbeans平台和hibernate for ORM)。我使用hibernate构建实体,并将这个jar文件添加到我的项目中,它运行良好。当我将新表添加到数据库并重建实体时,它出现了错误。虽然我已经检查了代码,但没有找到新的实体类,但我找不到任何解决方案。请帮我(我的桌子名是菜单)
这是我的代码
for (int i = 0; i < table_row; i++) {
Menu menus = (Menu) items.get(i);
objectData[i][0] = menus.getId();
objectData[i][1] = menus.getTitle();
objectData[i][2] = menus.getLevel();
objectData[i][3] = menus.getParentId();
objectData[i][4] = menus.getClassname();
objectData[i][5] = menus.getCategoryId();
objectData[i][6] = menus.getIcon();
objectData[i][7] = menus.getOrder();
objectData[i][8] = menus.getCreated();
objectData[i][9] = menus.getModified();
}
这是的例外
Classes: loaded=3871 total loaded=3871 unloaded 0
INFO [org.netbeans.core.ui.warmup.DiagnosticTask]: Total memory 4,074,373,120
INFO [null]: Total physical memory 4,074,373,120
SEVERE [global]
java.lang.ClassNotFoundException: com.osstech.dbentities.Menu
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:222)
Caused: java.lang.ClassNotFoundException: com.osstech.dbentities.Menu starting from ModuleCL@302d6b3[com.osstech.Systems] with possible defining loaders [ModuleCL@759d36f1[com.osstech.dbentities]] and declared parents [ModuleCL@7f28abd9[org.netbeans.modules.settings], ModuleCL@fcd0400[org.openide.windows], org.netbeans.MainImpl$BootClassLoader@6db17b38, ModuleCL@561ac555[org.netbeans.api.progress], ModuleCL@52b4e7ec[com.osstech.DataAccess], ModuleCL@759d36f1[com.osstech.dbentities], ModuleCL@2716630b[com.osstech.wraplibrary], ModuleCL@6461d2bf[com.osstech.Utilities], ModuleCL@f27bf78[org.openide.awt]]
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:224)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Caused: java.lang.NoClassDefFoundError: com/osstech/dbentities/Menu
需要一些代码才能得出结论。但是,您似乎在layer.xml中配置了一个名为com.osstech.dbentities.Menu
的菜单。这是错误配置的。当netbeans试图初始化这个对象时,它找不到它。