使用 http://jxse.kenai.com/ 中的 JXTA 2.6 我想创建可以运行多个对等点的应用程序在一台或多台主机上。对等点应该能够在组中找到彼此并发送直接消息以及传播消息。
满足这些要求的简单 hello world 类型的应用程序会是什么样子?
我创建这个问题的目的是提供一个类似教程的答案,这是我两个月前开始为一个大学项目查看 JXTA 时非常努力找到的答案。请随意添加您自己的答案或改进我的答案。我会等几天并接受最好的。
Using JXTA 2.6 from http://jxse.kenai.com/ I want to create application that can run multiple peers on one or more hosts. The peers should be able to find each other in a group and send direct messages as well as propagate messages.
What would a simple hello world type of application look like that meet these requirements?
I created this question with the intention of supplying a tutorial like answer, an answer I tried very hard to find two months ago when starting to look at JXTA for a uni project. Feel free to add your own answers or improve on mine. I will wait a few days and accept the best one.
发布评论
评论(1)
JXTA 2.6 对等发现和管道消息简介
我希望 2 个月前就拥有该指南 =)
在大学课程建设中花费了大量时间之后
JXTA p2p 应用程序让我感到很多挫败感
我所经历的困惑本来可以通过良好的方式避免
起点。
您需要的 jar 文件可以在这里找到:
https://oss.sonatype.org/content/repositories/comkenaijxse-057/com/kenai/jxse/jxse/2.6/jxse-2.6.jar
http://sourceforge.net/projects/practicaljxta/files/lib-dependency-2.6.zip/download
将它们扔到Yourproject/lib中,打开eclipse,创建一个新项目“Yourproject “它应该解决
为您导入库。
您很快就会意识到网络上的几乎所有信息都已经过时,非常过时。
您还会遇到许多非常令人困惑的错误消息,其中大多数可以通过以下方式避免
浏览此检查清单。
您的防火墙是否已关闭或至少对您使用的端口开放?
您可以在 Fedora 下使用“sudo service iptables stop”禁用 iptables。
检查拼写!很多时候,当加入群组或尝试发送消息时,群组名称拼写错误或未使用
在寻找对等点和服务或打开管道时完全相同的广告将导致非常混乱的消息。
当我发现组名称为“Net info”和“Net_info”时,我试图找出为什么我的管道连接超时。
您使用的是 JXTA 主目录吗?您在同一台计算机上运行的每个对等点都有一个?
您真的使用唯一的对等 ID 吗?提供给IDFactory的种子需要足够长,否则你会得到重复的。
关闭 SELinux。我在开发过程中关闭了 SELinux,但可以想象它会导致错误。
虽然将所有字段分组在一起是很常见的,但我在展示需要它们的地方时会介绍它们。
注意:这在 2.7 中不起作用。我认为 PSE 会员资格存在一些问题。
Introduction to JXTA 2.6 Peer discovery and pipe messaging
The guide I wish I had 2 months ago =)
After spending a lot of time during a university course building
a JXTA p2p application I feel a lot of the frustrations and
confusion I went through could have been avoided with a good
starting point.
The jar files you will need can be found here:
https://oss.sonatype.org/content/repositories/comkenaijxse-057/com/kenai/jxse/jxse/2.6/jxse-2.6.jar
http://sourceforge.net/projects/practicaljxta/files/lib-dependencies-2.6.zip/download
Throw them into Yourproject/lib, open up eclipse, create a new project "Yourproject" and it should sort out
importing the libraries for you.
You will soon come to realize that almost any information on the web is out dated, very out dated.
You will also run into a lot of very confusing error messages and most of them can be avoided by
going through this check list.
Is your firewall turned off or at least open for the ports you use?
You can disable iptables using "sudo service iptables stop" under Fedora.
Check spelling! Many times when joining groups or trying to send messages spelling the group name wrong or not using the
exact same advertisement when looking for peers and services or opening pipes will cause very confusing messages.
Was trying to figure out why my pipe connections timed out when I spotted the group names being "Net info" and "Net_info".
Are you using a JXTA home directory? One per each peer you run on the same computer?
Do you really use a unique peer id? The seed provided to IDFactory need to be long enough or else you will get duplicates.
Turn off SELinux. I have had SELinux turned off during the development but can imagine it causing errors.
While it is common to group all fields together I introduce them as I go to show where they are needed.
Note: This will not work in 2.7. Some issue with PSE membership I think.