RuntimeException:Cm无法创建目录,JXTA

时间:2015-03-05 12:50:24

标签: java eclipse scala jxta

可能是一个菜鸟问题: 我正在尝试使用JXTA并希望创建一个简单的hello world程序。为此,我将hello world示例复制到Eclipse中的scala项目中,并包含jxta.jar来访问API。

代码目前看起来像这样(请注意,这是一个scala项目,因此语法与Java略有不同,但应该是等效的。

package JXTA_test

import net.jxta.platform.NetworkManager
import java.text.MessageFormat
import java.io.File;
import java.lang.Boolean

object main {
    def main(args: Array[String]): Unit = {

            //Copied from helloworld
            try
            {
                System.out.println("Configuring JXTA");

                val manager = new NetworkManager(NetworkManager.ConfigMode.ADHOC, "HelloWorld", new File(new File(".cache"), "HelloWorld").toURI());

                // Start the JXTA 
                System.out.println("Starting JXTA");
                manager.startNetwork();
                System.out.println("JXTA Started");

                // Wait up to 20 seconds for a connection to the JXTA Network.
                System.out.println("Waiting for a rendezvous connection");
                val connected : Boolean = manager.waitForRendezvousConnection(20 * 1000);
                System.out.println(MessageFormat.format("Connected :{0}", connected));

                // Stop JXTA
                System.out.println("Stopping JXTA");
                manager.stopNetwork();
                System.out.println("JXTA stopped");            
            }
            catch
            {
            case e: Throwable => {
                // Some type of error occurred. Print stack trace and quit.
                System.err.println("Fatal error -- Quitting");
                e.printStackTrace(System.err);
                System.exit(-1);
            }
            }
    }
}

当执行此操作时,我得到:

Configuring JXTA
Starting JXTA
mar 05, 2015 12:54:36 EM net.jxta.platform.NetworkManager configure
INFO: Created new configuration. mode = ADHOC
mar 05, 2015 12:54:36 EM net.jxta.platform.NetworkManager startNetwork
INFO: Starting JXTA Network! MODE = ADHOC,  HOME = file:/D:/Övrigt/Arbete/ExJobb3/Scala_Workspace/JXTA_test_25/.cache/HelloWorld
mar 05, 2015 12:54:36 EM net.jxta.impl.protocol.RelayConfigAdv <init>
WARNING: Unhandled Element: net.jxta.impl.document.LiteXMLElement@504bae78 / isOff = <<null value>>
mar 05, 2015 12:54:36 EM net.jxta.peergroup.WorldPeerGroupFactory newWorldPeerGroup
INFO: Making a new World Peer Group instance using : net.jxta.impl.peergroup.Platform
mar 05, 2015 12:54:36 EM net.jxta.impl.cm.Cm <init>
SEVERE: Unable to create Cm
java.lang.RuntimeException: Cm cannot create directory D:\Övrigt\Arbete\ExJobb3\Scala_Workspace\JXTA_test_25\.cache\HelloWorld\cm\jxta-WorldGroup
    at net.jxta.impl.cm.Cm.<init>(Cm.java:190)
    at net.jxta.impl.peergroup.StdPeerGroup.initFirst(StdPeerGroup.java:775)
    at net.jxta.impl.peergroup.Platform.initFirst(Platform.java:205)
    at net.jxta.impl.peergroup.GenericPeerGroup.init(GenericPeerGroup.java:929)
    at net.jxta.peergroup.WorldPeerGroupFactory.newWorldPeerGroup(WorldPeerGroupFactory.java:310)
    at net.jxta.peergroup.WorldPeerGroupFactory.<init>(WorldPeerGroupFactory.java:178)
    at net.jxta.peergroup.NetPeerGroupFactory.<init>(NetPeerGroupFactory.java:205)
    at net.jxta.platform.NetworkManager.startNetwork(NetworkManager.java:410)
    at JXTA_test.main$.main(main.scala:25)
    at JXTA_test.main.main(main.scala)

mar 05, 2015 12:54:36 EM net.jxta.impl.peergroup.StdPeerGroup initFirst
SEVERE: Error during creation of local store
java.lang.RuntimeException: Cm cannot create directory D:\Övrigt\Arbete\ExJobb3\Scala_Workspace\JXTA_test_25\.cache\HelloWorld\cm\jxta-WorldGroup
    at net.jxta.impl.cm.Cm.<init>(Cm.java:190)
    at net.jxta.impl.peergroup.StdPeerGroup.initFirst(StdPeerGroup.java:775)
    at net.jxta.impl.peergroup.Platform.initFirst(Platform.java:205)
    at net.jxta.impl.peergroup.GenericPeerGroup.init(GenericPeerGroup.java:929)
    at net.jxta.peergroup.WorldPeerGroupFactory.newWorldPeerGroup(WorldPeerGroupFactory.java:310)
    at net.jxta.peergroup.WorldPeerGroupFactory.<init>(WorldPeerGroupFactory.java:178)
    at net.jxta.peergroup.NetPeerGroupFactory.<init>(NetPeerGroupFactory.java:205)
    at net.jxta.platform.NetworkManager.startNetwork(NetworkManager.java:410)
    at JXTA_test.main$.main(main.scala:25)
    at JXTA_test.main.main(main.scala)

mar 05, 2015 12:54:36 EM net.jxta.peergroup.WorldPeerGroupFactory newWorldPeerGroup
SEVERE: World Peer Group could not be instantiated.
net.jxta.exception.PeerGroupException: Error during creation of local store
    at net.jxta.impl.peergroup.StdPeerGroup.initFirst(StdPeerGroup.java:782)
    at net.jxta.impl.peergroup.Platform.initFirst(Platform.java:205)
    at net.jxta.impl.peergroup.GenericPeerGroup.init(GenericPeerGroup.java:929)
    at net.jxta.peergroup.WorldPeerGroupFactory.newWorldPeerGroup(WorldPeerGroupFactory.java:310)
    at net.jxta.peergroup.WorldPeerGroupFactory.<init>(WorldPeerGroupFactory.java:178)
    at net.jxta.peergroup.NetPeerGroupFactory.<init>(NetPeerGroupFactory.java:205)
    at net.jxta.platform.NetworkManager.startNetwork(NetworkManager.java:410)
    at JXTA_test.main$.main(main.scala:25)
    at JXTA_test.main.main(main.scala)
Caused by: java.lang.RuntimeException: Cm cannot create directory D:\Övrigt\Arbete\ExJobb3\Scala_Workspace\JXTA_test_25\.cache\HelloWorld\cm\jxta-WorldGroup
    at net.jxta.impl.cm.Cm.<init>(Cm.java:190)
    at net.jxta.impl.peergroup.StdPeerGroup.initFirst(StdPeerGroup.java:775)
    ... 8 more

Fatal error -- Quitting
net.jxta.exception.PeerGroupException: World Peer Group could not be instantiated.
    at net.jxta.peergroup.WorldPeerGroupFactory.newWorldPeerGroup(WorldPeerGroupFactory.java:335)
    at net.jxta.peergroup.WorldPeerGroupFactory.<init>(WorldPeerGroupFactory.java:178)
    at net.jxta.peergroup.NetPeerGroupFactory.<init>(NetPeerGroupFactory.java:205)
    at net.jxta.platform.NetworkManager.startNetwork(NetworkManager.java:410)
    at JXTA_test.main$.main(main.scala:25)
    at JXTA_test.main.main(main.scala)
Caused by: net.jxta.exception.PeerGroupException: Error during creation of local store
    at net.jxta.impl.peergroup.StdPeerGroup.initFirst(StdPeerGroup.java:782)
    at net.jxta.impl.peergroup.Platform.initFirst(Platform.java:205)
    at net.jxta.impl.peergroup.GenericPeerGroup.init(GenericPeerGroup.java:929)
    at net.jxta.peergroup.WorldPeerGroupFactory.newWorldPeerGroup(WorldPeerGroupFactory.java:310)
    ... 5 more
Caused by: java.lang.RuntimeException: Cm cannot create directory D:\Övrigt\Arbete\ExJobb3\Scala_Workspace\JXTA_test_25\.cache\HelloWorld\cm\jxta-WorldGroup
    at net.jxta.impl.cm.Cm.<init>(Cm.java:190)
    at net.jxta.impl.peergroup.StdPeerGroup.initFirst(StdPeerGroup.java:775)
    ... 8 more

显然,程序无法创建所需的文件夹。 “.cache”原来是一个文件,而不是一个文件夹,所以也许这与它有关?这是Eclipse的东西吗?我可以改变吗? 我试过给“Everyone”“完全控制”,所以我想我可以排除权限问题。

感谢任何线索。

编辑1:我已经为jxta 2.5和2.7做了同样的结果。

编辑2:问题是:为什么无法创建所需的文件夹?

0 个答案:

没有答案