我目前有一个正在运行的基于Kafka的超级账本在docker上运行。
完整的容器列表如下:
我已通过以下命令使用cli成功创建了一个频道
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
/**
*
* @author blj0011
*/
public class JavaFXApplication319 extends Application
{
@Override
public void start(Stage primaryStage)
{
String javaString = "/* HelloWorld.java\n"
+ " */\n"
+ "\n"
+ "public class HelloWorld\n"
+ "{\n"
+ " public static void main(String[] args) {\n"
+ " System.out.println(\"Hello World!\");\n"
+ " }\n"
+ "}";
String htmlString = "<!DOCTYPE html>\n"
+ "<html>\n"
+ "<head>"
+ "<link href=\"" + getClass().getResource("prism.css") + "\"" + " rel=\"stylesheet\"" + " type=\"text/css\"" + " />\n"
+ "<script src=\"" + getClass().getResource("prism.js") + "\"" + " type=\"text/javascript\"" + "></script>\n"
+ "</head>"
+ "<body>\n"
+ "\n"
+ "<h1>My First Heading</h1>\n"
+ "\n"
+ "<p>My first paragraph.</p>\n"
+ "\n"
+ "<pre>"
+ " <code class=\"language-java\">\n"
+ javaString
+ "</code>\n"
+ "</pre>\n"
+ "</body>\n"
+ "</html>";
WebView webView = new WebView();
WebEngine engine = webView.getEngine();
engine.setJavaScriptEnabled(true);
engine.loadContent(htmlString);
StackPane root = new StackPane(webView);
Scene scene = new Scene(root, 500, 400);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
launch(args);
}
}
我可以使用以下命令看到对等方:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
/**
*
* @author blj0011
*/
public class JavaFXApplication319 extends Application
{
@Override
public void start(Stage primaryStage)
{
String htmlStringPreCode = "<!DOCTYPE html>\n"
+ "<html>\n"
+ "<head>\n"
+ "</head>\n"
+ "<body>\n"
+ "This is a Test\n"
+ "</body>\n"
+ "</html>\n";
String htmlString = "<!DOCTYPE html>\n"
+ "<html>\n"
+ "<head>"
+ "<link href=\"" + getClass().getResource("prism.css") + "\"" + " rel=\"stylesheet\"" + " type=\"text/css\"" + " />\n"
+ "<script src=\"" + getClass().getResource("prism.js") + "\"" + " type=\"text/javascript\"" + "></script>\n"
+ "</head>"
+ "<body>\n"
+ "\n"
+ "<h1>My First Heading</h1>\n"
+ "\n"
+ "<p>My first paragraph.</p>\n"
+ "\n"
+ "<pre>"
+ " <code class=\"language-html\">\n"
+ htmlStringPreCode
+ "</code>\n"
+ "</pre>\n"
+ "</body>\n"
+ "</html>";
WebView webView = new WebView();
WebEngine engine = webView.getEngine();
engine.setJavaScriptEnabled(true);
engine.loadContent(htmlString);
StackPane root = new StackPane(webView);
Scene scene = new Scene(root, 500, 400);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
launch(args);
}
}
然后我要这样初始化并实例化我的链码
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp/users/Admin@company/msp" peer0.company peer channel create -o orderer0.company:7050 -c messagebus -f /etc/hyperledger/configtx/channel.tx
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp/users/Admin@company/msp" peer0.company peer channel join -b messagebus.block
如最后一行所示,访问被拒绝。 我也无法将Java SDK客户端加入频道并收到类似的访问被拒绝错误。
我在peer0容器中看到以下日志:
docker exec cli peer channel list
2019-01-07 16:54:41.784 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
Channels peers has joined:
messagebus
这使我相信对等方未正确设置...但是它能够成功创建通道。
任何指针将不胜感激