无法从浏览器访问嵌入式 Glassfish 的运行实例
我正在尝试使用嵌入式 Glassfish 来运行一些单元测试。我已成功配置并启动服务器,但无法从浏览器访问管理控制台。我也无法从 java 代码访问 REST 接口。我的问题是:是否可以使用 REST 从浏览器或 Java 代码访问嵌入式 Glassfish 服务器?如果是的话,我做错了什么?
使用的代码是这样的:
File installDir = new File("e:\\Glassfish3\\glassfish");
File domainDir = new File(installDir, "domains\\domain1");
File domainConfig = new File(domainDir, "config");
File domainXml = new File(domainConfig, "domain.xml");
Server.Builder builder = new Server.Builder("test");
EmbeddedFileSystem.Builder efsb = new EmbeddedFileSystem.Builder();
efsb.installRoot(installDir);
efsb.instanceRoot(domainDir);
efsb.configurationFile(domainXml);
EmbeddedFileSystem efs = efsb.build();
builder.embeddedFileSystem(efs);
Server server = builder.build();
server.createPort(4849);
server.addContainer(ContainerBuilder.Type.web);
server.start();
非常感谢!
I'm trying to use the embedded Glassfish for running some unit tests. I have managed to configure and start the server, but i can't access the management console from my browser. Nor can i access the REST Interface from tha java code. My questions are: Is it possible to access the embedded Glassfish server from the browser or from java code, using REST? If it is, what i am doing wrong?
The code is use is this:
File installDir = new File("e:\\Glassfish3\\glassfish");
File domainDir = new File(installDir, "domains\\domain1");
File domainConfig = new File(domainDir, "config");
File domainXml = new File(domainConfig, "domain.xml");
Server.Builder builder = new Server.Builder("test");
EmbeddedFileSystem.Builder efsb = new EmbeddedFileSystem.Builder();
efsb.installRoot(installDir);
efsb.instanceRoot(domainDir);
efsb.configurationFile(domainXml);
EmbeddedFileSystem efs = efsb.build();
builder.embeddedFileSystem(efs);
Server server = builder.build();
server.createPort(4849);
server.addContainer(ContainerBuilder.Type.web);
server.start();
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过更多研究后,我发现这个 link 并且管理控制台似乎在嵌入的 Glassfish 中不可用。
有关 REST 接口的问题仍然悬而未决。
After doing some more research, i found this link and it seems like the administration console is not available in Glassfish embedded.
The question about the REST interface is still open.