有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么在jitsi中,我不能将一个包的类访问到另一个包中?它抛出ClassNotFoundException?

有人帮我吗, 我正在调用包net.java.sip.communicator.impl.gui.main.account的一个方法NewAccountDialog到另一个包net.java.sip.communicator.plugin.simpleaccregSimpleAccountRegistrationActivator类中,但它抛出以下异常

java.lang.NoClassDefFoundError: net/java/sip/communicator/impl/gui/main/account/NewAccountDialog at net.java.sip.communicator.plugin.simpleaccreg.SimpleAccountRegistrationActivator$LoginFrame$1.actionPerformed(SimpleAccountRegistrationActivator.java:302) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$300(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: net.java.sip.communicator.impl.gui.main.account.NewAccountDialog not found by net.java.sip.communicator.plugin.simpleaccreg [155] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1988) at java.lang.ClassLoader.loadClass(Unknown Source) ... 37 more


共 (1) 个答案

  1. # 1 楼答案

    Jiti使用OSGI框架和ApacheFelix客户端。所以基本上当你在构建中应用run命令时。xml它将创建一捆罐子

    现在,当类在编译时可用,但在运行时不可用时,NoClassDefFoundError会上升。所以,由于罐子的包装,他们两个班都会放在不同的罐子里。所以,这个错误上升了

    解决方案:现在,通过在类B之外导入,类A抛出了猜测错误

           find Class A's parent package and search for its manifest file if you are not able to find its manifest file than go to parent of that package. Continue this steps until you find its manifest file.
           In manifest file import package of Class B.
    
           find Class B's parent package and search for its manifest file if you are not able to find its manifest file than go to parent of that package. Continue this steps until you find its manifest file. 
           In manifest file export package of Class B.
    
     there are some rules for editing manifest file. So,before editing please read it .