JXTA Configuration issue: jxta:HTTPTransportAdvertisement not registered

78 views Asked by At

I am trying to the run a "Hello World" sample. The problem is I keep getting the following error when trying to run the HelloWorld.java example ...

Fatal error -- Quitting
java.util.NoSuchElementException: key 'jxta:HTTPTransportAdvertisement' not registered.
    at net.jxta.util.ClassFactory.getInstantiator(ClassFactory.java:355)
    at net.jxta.document.AdvertisementFactory.newAdvertisement(AdvertisementFactory.java:249)
    at net.jxta.platform.NetworkConfigurator.createHttpAdv(NetworkConfigurator.java:1833)
    at net.jxta.platform.NetworkConfigurator.<init>(NetworkConfigurator.java:528)
    at net.jxta.platform.NetworkConfigurator.newAdHocConfiguration(NetworkConfigurator.java:436)
    at net.jxta.platform.NetworkManager.configure(NetworkManager.java:321)
    at net.jxta.platform.NetworkManager.startNetwork(NetworkManager.java:402)
    at tutorial.helloworld.HelloWorld.main(HelloWorld.java:90)

Now from digging around through the code and doing some reading the NoSuchElementException comes from the fact the a XML element or key cannot be found the in the configuration. OK that's cool, but reading the documentation when the NetworkManager.ConfigMode is ADHOC it looks like you don't need a configuration file.

I have tried with some wild hope that turning off my firewall and Host and Network IPS and Anti-virus may help, but no. Using Sysinternals Process Monitor I do not see the eclipse.exe or java.exe trying to read a PlatformConfig file or even look for the reconf file. So this again leads me to believe (right ot wrong) that I don't need a configuration file.

I am using JXTA 2.7 from [https://svn.java.net/svn/jxta-jxse~svn/, Tag: 2.7] in Eclipse Neon with JDK 1.8. I have included the dependencies from https://sourceforge.net/projects/practicaljxta/files/ in my project.

The sample code was located on the tutorials/src/main/java/tutorial/HelloWorld/HelloWorld.java path.

I would like to understand why JXTA cannot register the jxta:HTTPTransportAdvertisement and how to correct the issue.

1

There are 1 answers

0
therealdtw On

Debugging the JXTA/JXSE code I found out that it was looking for a file in a META-INF folder that exists in the built jar file. This is something I did not have in my build from source.

One likely resolution would be to build your own jar file and included the META-INF folder located in source src/main/resources, but I can not fully vouch for that method.

My resolution was to download the binary build of JXSE from https://oss.sonatype.org/service/local/repositories/releases/content/com/kenai/jxse/jxse/2.7/jxse-2.7.jar which is in the projects Maven repository and include it in my project along with the required jar's for jxse-2.7.jar from https://sourceforge.net/projects/practicaljxta/files/lib-dependencies-2.7.zip/download