简体   繁体   English

试图通过GlassFish在Netbeans上运行Vaadin Web应用程序项目,但是服务器显然没有自动启动

[英]Trying to run Vaadin web app project on Netbeans via GlassFish but apparently server is not started automatically

So as the title of this question indicates, I'm working with a Vaadin project on Netbeans. 因此,正如该问题的标题所指示的,我正在与Netbeans上的Vaadin项目合作。 Upon running the GlassFish server in ISOLATION, there is no issue at all; 在ISOLATION中运行GlassFish服务器时,根本没有问题; the output log for both the Java Database DB Process and GlassFish Server show no errors. Java数据库DB进程和GlassFish Server的输出日志均未显示错误。 As further evidence, I can successfully go to the localhost server that was started, seen in this screenshot: 作为进一步的证据,我可以成功转到已启动的localhost服务器,如以下屏幕快照所示:

在此处输入图片说明

As seen in the URL, the port I selected for this server was 8080 (the admin port is 4848, and I can successfully go there, too). 从URL中可以看到,我为此服务器选择的端口为8080(管理端口为4848,我也可以成功访问该端口)。 However, when I run my Vaadin project, which I was under the assumption would automatically start the server and then display the results of running the project there (as per https://vaadin.com/docs/v8/framework/getting-started/getting-started-netbeans.html ), I can't even connect to localhost:8080 anymore. 但是,当我运行Vaadin项目时,我假设该项目将自动启动服务器,然后在此处显示运行项目的结果(按照https://vaadin.com/docs/v8/framework/getting-started /getting-started-netbeans.html ),我什至无法再连接到localhost:8080。 For reference, I do have the server selected in the project options (Right click on my project -> properties -> run -> Server [dropdown]). 作为参考,我确实在项目选项中选择了服务器(右键单击我的项目->属性->运行->服务器[下拉])。

I originally thought that it was just some sort of issue with code inside my project (and that might be part of it), but what dissuades me from that assumption are the following: 我本来以为这只是项目内部代码的某种问题(可能是其中的一部分),但是以下原因阻止了我的设想:

1) The project builds successfully, with no failure statements whatsoever 1)项目成功构建,没有任何失败说明

2) The icon for the server does not display the green play sign next to it (I'm using GlassFish Server, not the Mark 2 one, but neither show the sign anyways), which it does when i run it in isolation: 2)服务器的图标不会在其旁边显示绿色播放符号(我使用的是GlassFish Server,而不是Mark 2,但是无论如何都不会显示该符号),当我单独运行它时会显示:

在此处输入图片说明

3) There is a significant difference between when I just run the project vs. when I start the server manually and THEN run the project. 3)刚运行项目与手动启动服务器然后运行项目之间存在显着差异。 For reference, here is the result of me attempting to connect to the server after only running the project: 作为参考,这是我仅在运行项目后尝试连接到服务器的结果:

在此处输入图片说明

Here is the result of accessing the server after first manually starting up the server and then running the project; 这是在首先手动启动服务器然后运行项目之后访问服务器的结果; note that the name of the project is nchandlerv2, but regardless of what I put after localhost:8080/ (for example in the below picture, I used nchandl, which I thought would have completely failed): 请注意,该项目的名称为nchandlerv2,但是无论我在localhost:8080 /之后加上什么(例如,在下图中,我都使用了nchandl,我认为它会完全失败):

在此处输入图片说明

However, what's particularly confusing to me is that in this case, I can still go to localhost:8080 just fine (as long as nothing is appended after it). 但是,令我特别困惑的是,在这种情况下,我仍然可以很好地进入localhost:8080(只要后面没有附加任何内容)。 So I guess my questions boil down to the following: 所以我想我的问题可以归结为以下几点:

1) Why does the server not automatically start when I run the project (or at least, why does it seem that way)? 1)为什么在我运行项目时服务器没有自动启动(或者至少为什么看起来是这样)? I've provided the code for the init method of my project at the bottom, but I thought that was really all that was needed for the project to be runnable (my MainUI class extends UI (which itself is from Vaadin) and then overwrites the init method) 2) Why does the server encounter an HTTP error when I first manually start the server and then run the project? 我在底部提供了项目的init方法的代码,但我认为这实际上是项目可运行所需的全部内容(我的MainUI类扩展了UI(其本身来自Vaadin),然后覆盖了init方法)2)为什么在我首先手动启动服务器然后运行项目时服务器遇到HTTP错误?

Here's the code: 这是代码:

import com.vaadin.annotations.Push;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.themes.ValoTheme;
import com.cisco.stbarth.netconf.anc.NetconfSSHClient;
import com.vaadin.ui.UI;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import javax.servlet.annotation.WebServlet;


@Theme("adtportal")
@Push
public class MainUI extends UI{
    String hostName;
    String ssh_ip;
    String username;
    String password;
    String pathToYangRepoHTTP;
    //String pathToYangRepoSCP;  <<TO BE USED POTENTIALLY LATER>>
    //The below returns in the format: [(SC1, ([YP1_1, YC1_1, XML1_1], 
[YP1_2, YC1_2, XML1_2] ...)), (SC2, ...) .... ] 
    LinkedHashMap<String, ArrayList<String[]>> showCommandsToPathYangXML = 
new LinkedHashMap<>();

    NetconfSSHClient client;
    YangParser parser;
    Collection <String> capabilities;
    //Curretnly, whichView's values correspond to the following transitions:
    //0: go to RetrieverView
    //1: go to ShowCommandView
    //2: go to TabView (one tab per show command), each tab of which contains subtabs for YANG paths
    int whichView;




    @Override
    protected void init(VaadinRequest vaadinRequest) {
        Page.getCurrent().setTitle("New NETCONF Tool");
        addStyleName(ValoTheme.UI_WITH_MENU);
        showNextView();
    }

    //oldShowValues is only really applicable when going from TabView back to ShowCommandView
    public void showNextView(String ... oldShowValues) {
        switch (whichView) {
            case 0:
                setContent(new RetrieverView(this));
                //addStyleName("loginview");
                break;
            case 1:
                //setSizeFull();
                getPage().setTitle("Netconf session with: " + hostName);
                setContent(new ShowCommandView(this));
                // Might be transferring from 2 to 1, not just from 0 to 1
                //removeStyleName(getStyleName());
                //addStyleName("showcommandview");
                break;
            case 2:
                setContent(new TabView(this));
                //removeStyleName("showcommandview");
                //addStyleName("tabview");
                break;
            default:
                System.out.println("To be further developed.");
                break;
        }
    }

    @WebServlet(urlPatterns = {"/hello"}, name = "MyUIServlet", 
asyncSupported = true)
    @VaadinServletConfiguration(ui = MainUI.class, productionMode = true)
    public static class MyUIServlet extends VaadinServlet {
    }

}

Edit: Apparently this was in the Glassfish server output (and only appeared once I attempted to access anywhere in localhost:8080 (such as /nchandler) - ie, it was not there when I ran the server in isolation): 编辑:显然,这是在Glassfish服务器输出中(仅当我尝试访问localhost:8080中的任何地方(例如/ nchandler)时才出现-即,当我独立运行服务器时它不存在):

Severe: SEC5054: Certificate has expired: [
[
  Version: V3
  Subject: CN=GTE CyberTrust Root 5, OU="GTE CyberTrust Solutions, Inc.", O=GTE Corporation, C=US
  Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
  Key:  Sun RSA public key, 2048 bits
  modulus: 23741889829347261660812437366387754385443431973861114865490414153884050331745811968523116847625570146592736935209718565296053386842135985534863157983128812774162998053673746470782252407673402238146869994438729551246768368782318393878374421033907597162218758024581735139682087126982809511479059100617027892880227587855877479432885604404402435662802390484099065871430585284534529627347717530352189612077130606642676951640071336717026459037542552927905851171460589361570392199748753414855675665635003335769915908187224347232807336022456537328962095005323382940080676931822787496212635993279098588863972868266229522169377
  public exponent: 65537
  Validity: [From: Fri Aug 14 07:50:00 PDT 1998,
               To: Wed Aug 14 16:59:00 PDT 2013]
  Issuer: CN=GTE CyberTrust Root 5, OU="GTE CyberTrust Solutions, Inc.", O=GTE Corporation, C=US
  SerialNumber: [    01b6]
Certificate Extensions: 4
[1]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:5
]
[2]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.2.840.113763.1.2.1.3]
[]  ]
]
[3]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  Key_CertSign
  Crl_Sign
]
[4]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 76 0A 49 21 38 4C 9F DE   F8 C4 49 C7 71 71 91 9D  v.I!8L....I.qq..
]
]
]

OK, so apparently, the issue was with my system's environment variables; 好的,显然,问题出在我系统的环境变量上。 sometime in the past, I had done some messing around with my path variable, and I found out that I had forgot to add C:\\Windows\\System32 back to my system's path. 在过去的某个时候,我对path变量做了一些弄乱,发现我忘了将C:\\ Windows \\ System32添加回系统路径。

After the "BUILD SUCCESSFUL" message in the output, there was actually another message: "cmd is not recognized as an internal or external command". 在输出中的“ BUILD SUCCESSFUL”消息之后,实际上还有另一条消息:“ cmd无法识别为内部或外部命令”。 Searching up the solution online and fixing the environment variable now allows the server to be run when the I run the project. 在线搜索解决方案并修复环境变量现在允许在我运行项目时运行服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM