当前位置: 首页 > 知识库问答 >
问题:

Netbeans在运行EAR时打开http而不是https

房冥夜
2023-03-14

我有一个Maven Enterprise应用程序项目,我在业余时间都在这个项目上工作。目前,我想切换到HTTPS,但我得到的只是头痛。

编辑:这似乎是一个GlassFish 4.1.1问题(在Windows 7 x64和Netbeans 8.0.2和GF 4.1上进行了快速测试;也在Netbeans 8.1和GF 4.1上进行了测试)。HTTPS-listeners似乎无法及时启动(标记为!!!)。是否有任何已知的解决方案或变通方法?

Edit2:重新启用不安全的HTTP侦听器“修复”了该问题(加载http://localhost:8080/myapp并重定向到http**s**:/localhost:8181/myapp)。

这是在NetBeans中运行EAR时的服务器日志:

Launching GlassFish on Felix platform
Sep 21, 2016 3:56:05 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner createBundleProvisioner
INFORMATION: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.
Sep 21, 2016 3:56:05 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNUNG: Skipping entry  because it is not an absolute URI.
Sep 21, 2016 3:56:05 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNUNG: Skipping entry  because it is not an absolute URI.
Sep 21, 2016 3:56:06 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner startBundles
WARNUNG: Can not start bundle file:/C:/Program%20Files/glassfish-4.1.1/glassfish/modules/core.jar because it is not contained in the list of installed bundles.
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@3f6b4900 in service registry.
#!## LogManagerService.postConstruct : rootFolder=C:\Program Files\glassfish-4.1.1\glassfish
#!## LogManagerService.postConstruct : templateDir=C:\Program Files\glassfish-4.1.1\glassfish\lib\templates
#!## LogManagerService.postConstruct : src=C:\Program Files\glassfish-4.1.1\glassfish\lib\templates\logging.properties
#!## LogManagerService.postConstruct : dest=C:\Users\Tobias\AppData\Roaming\NetBeans\8.1\config\GF_4.1.1\domain1\config\logging.properties
Information:   Running GlassFish Version: GlassFish Server Open Source Edition  4.1.1  (build 1)
Information:   Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter
Information:   Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Information:   Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Information:   Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
Information:   Network listener http-listener-1 on port 8080 disabled per domain.xml
Information:   Authorization Service has successfully initialized.
Information:   Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
Information:   JTS5014: Recoverable JTS instance, serverId = [100]
Schwerwiegend:   Application previously deployed is not at its original location any more: file:/E:/Work/Projects/Java/XWars/XWars-ear/target/gfdeploy/XWars-ear/
! ! ! Warnung:   Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-2, realClassName=org.glassfish.grizzly.http2.Http2AddOn
Information:   Grizzly Framework 2.3.23 started in: 20ms - bound to [/0.0.0.0:8181]
Warnung:   Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=admin-listener, realClassName=org.glassfish.grizzly.http2.Http2AddOn
Information:   Grizzly Framework 2.3.23 started in: 1ms - bound to [/0.0.0.0:4848]
Information:   Grizzly Framework 2.3.23 started in: 1ms - bound to [/0.0.0.0:3700]
Information:   GlassFish Server Open Source Edition  4.1.1  (1) startup time : Felix (10.819ms), startup services(1.002ms), total(11.821ms)
Information:   Grizzly Framework 2.3.23 started in: 1ms - bound to [/0.0.0.0:7676]
Information:   Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@32b9bd12 as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@576c5536.
Information:   JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://Tobias-PC.fritz.box:8686/jndi/rmi://Tobias-PC.fritz.box:8686/jmxrmi
Information:   HV000001: Hibernate Validator 5.1.2.Final
! ! ! Warnung:   Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-2, realClassName=org.glassfish.grizzly.http2.Http2AddOn
Information:   Grizzly Framework 2.3.23 started in: 15ms - bound to [/0.0.0.0:8181]
Warnung:   Originally deployed application at E:\Work\Projects\Java\XWars\XWars-ear\target\gfdeploy\XWars-ear not found
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   visiting unvisited references
Information:   Java security manager is disabled.
Information:   Entering Security Startup Service.
Information:   Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
Information:   Security Service(s) started successfully.
Information:   de.dnhax.xwars.persistence.entities.Player actually got transformed
Information:   EclipseLink, version: Eclipse Persistence Services - 2.6.3.v20160428-59c81c5
Information:   /file:/E:/Work/Projects/Java/XWars/XWars-ear/target/gfdeploy/XWars-ear/XWars-ejb-1.0.0-SNAPSHOT_jar/_XWarsPU login successful
! ! ! Information:   Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181
Information:   Created HTTP listener admin-listener on host/port 0.0.0.0:4848
Information:   Created virtual server server
Information:   Created virtual server __asadmin
Information:   Setting JAAS app name glassfish-web
Information:   Virtual server server loaded default web module 
Information:   JTS5014: Recoverable JTS instance, serverId = [3700]
Information:   Portable JNDI names for EJB XWarsLogicImpl: [java:global/XWars-ear/XWars-ejb-1.0.0-SNAPSHOT/XWarsLogicImpl!de.dnhax.xwars.logic.XWarsLogic, java:global/XWars-ear/XWars-ejb-1.0.0-SNAPSHOT/XWarsLogicImpl]
Information:   Glassfish-specific (Non-portable) JNDI names for EJB XWarsLogicImpl: [de.dnhax.xwars.logic.XWarsLogic#de.dnhax.xwars.logic.XWarsLogic, de.dnhax.xwars.logic.XWarsLogic]
Information:   Portable JNDI names for EJB PlayerAccess: [java:global/XWars-ear/XWars-ejb-1.0.0-SNAPSHOT/PlayerAccess, java:global/XWars-ear/XWars-ejb-1.0.0-SNAPSHOT/PlayerAccess!de.dnhax.xwars.persistence.PlayerAccess]
Information:   WELD-000900: 2.2.13 (Final)
WARN:   WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
WARN:   WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Information:   Mojarra 2.2.12 ( 20150720-0848 https://svn.java.net/svn/mojarra~svn/tags/2.2.12@14885) für Kontext '/xwars' wird initialisiert.
Information:   RewritePhaseListener starting up.
Information:   Monitoring jndi:/server/xwars/WEB-INF/faces-config.xml for modifications
Information:   Running on PrimeFaces 6.0
Information:   RewriteFilter starting up...
Information:   Loaded [4] org.ocpsoft.rewrite.servlet.spi.RewriteLifecycleListener [org.ocpsoft.rewrite.prettyfaces.PrettyFacesRewriteLifecycleListener<-100>, org.ocpsoft.rewrite.faces.FacesRewriteLifecycleListener<0>, org.ocpsoft.rewrite.servlet.impl.DefaultRewriteLifecycleListener<2147483647>, org.ocpsoft.rewrite.servlet.config.lifecycle.JoinRewriteLifecycleListener<2147483647>]
Information:   Loaded [1] org.ocpsoft.rewrite.servlet.spi.RequestCycleWrapper [org.ocpsoft.rewrite.servlet.impl.HttpRewriteRequestCycleWrapper<0>]
Information:   Loaded [1] org.ocpsoft.rewrite.spi.RewriteProvider [org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider<0>]
Information:   Loaded [1] org.ocpsoft.rewrite.servlet.spi.RewriteResultHandler [org.ocpsoft.rewrite.servlet.impl.HttpRewriteResultHandler<0>]
Information:   Loaded [1] org.ocpsoft.rewrite.servlet.spi.InboundRewriteProducer [org.ocpsoft.rewrite.servlet.impl.HttpInboundRewriteProducer<0>]
Information:   Loaded [1] org.ocpsoft.rewrite.servlet.spi.OutboundRewriteProducer [org.ocpsoft.rewrite.servlet.impl.HttpOutboundRewriteProducer<0>]
Information:   Loaded [1] org.ocpsoft.rewrite.servlet.spi.ContextListener [org.ocpsoft.rewrite.prettyfaces.PrettyConfigContextListener<0>]
Information:   Loaded [0] org.ocpsoft.rewrite.servlet.spi.RequestListener []
Information:   Loaded [1] org.ocpsoft.rewrite.servlet.spi.RequestParameterProvider [org.ocpsoft.rewrite.prettyfaces.PrettyFacesRequestParameterProvider<0>]
Information:   Loaded [1] org.ocpsoft.rewrite.el.spi.ExpressionLanguageProvider [org.ocpsoft.rewrite.faces.FacesExpressionLanguageProvider<30>]
Information:   Loaded [1] org.ocpsoft.rewrite.spi.InvocationResultHandler [org.ocpsoft.rewrite.faces.NavigatingInvocationResultHandler<100>]
Information:   Loaded [0] org.ocpsoft.common.spi.ServiceEnricher []
Information:   Loaded [1] org.ocpsoft.rewrite.spi.ConfigurationCacheProvider [org.ocpsoft.rewrite.servlet.impl.ServletContextConfigurationCacheProvider<0>]
Information:   Loaded [2] org.ocpsoft.rewrite.config.ConfigurationProvider [org.ocpsoft.rewrite.annotation.config.AnnotationConfigProvider<100>, org.ocpsoft.rewrite.prettyfaces.PrettyFacesRewriteConfigurationProvider<1>]
Information:   Loaded [0] org.ocpsoft.rewrite.spi.RuleCacheProvider []
Information:   Loaded [1] org.ocpsoft.rewrite.spi.GlobalParameterProvider [org.ocpsoft.rewrite.instance.WildcardParameterProvider<0>]
Information:   Rewrite 3.4.1.Final initialized.
Information:   Loading application [XWars-ear#XWars-web-1.0.0-SNAPSHOT.war] at [/xwars]
Information:   XWars-ear was successfully deployed in 10.439 milliseconds.

共有1个答案

松和泰
2023-03-14

确保您的web.xml中有以下条目:

<web-app>
    <security-constraint>
      <web-resource-collection>
        <web-resource-name>Enforce HTTPS for all urls</web-resource-name>
        <url-pattern>/*</url-pattern>
      </web-resource-collection>
      <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
      </user-data-constraint>
    </security-constraint>
</web-app>

来源:https://docs.oracle.com/javaee/5/tutorial/doc/bnbxw.html

 类似资料:
  • 我正处于NETBeaseV8编码项目的中间。突然,它关闭了。当我重新打开它时,我看到了附加的屏幕。我无法打开任何项目,即使我可以在那里看到它们,而且大多数选项现在都变灰了。请任何人帮忙。我运行MAC OS。有人能告诉我,我到底是怎么回到旧版本的吗? NetBeans信息现在NetBeans的屏幕截图

  • 我是Java新手,正在尝试在NetBeans中运行Java awt/javax.swing应用程序。以下是github链接。 在我按下run之后,即使Netbeans一直在其窗口中显示,并且Java application图标下出现了一个圆点,也没有真正发生任何事情(实际上没有打开Java application窗口,我知道情况是这样的,因为当我用鼠标单击Java application图标时,没

  • 我需要在我正在为一个学校项目建立的网站中使用一点PHP。我需要它上传. swf文件。但是当我按下“上传”按钮时,它会在浏览器中打开php文件,而不是运行它,或者显示错误(如果有错误的话)。 这是我的超文本标记语言代码: 它应该在图片和表单上方放置一点文本,放在一个普通的网页上。 接下来是PHP,这是我从W3学校得到的。 我完全不知道为什么它不起作用,我只是在5年不使用超文本标记语言后回到它(我上次

  • 我在这里的问题中遇到了同样的问题:Tomcat在eclipse中启动,但无法连接到http://localhost:8085/,这意味着我无法在浏览器上打开http://localhost:8080/: 我使用的是Tomcat 7.0.27、Eclipse Europa和Java1.6.0_32。我看到了Balusc的答案,但问题是我无法选择Tomcat安装(下图)。 这里会出什么问题? PS:似

  • 我试图在Macbook Pro上启动NetBeans 8.2,但它不起作用。 它显示了闪屏,然后过了一会儿,它关闭了,没有启动任何东西。 从命令行运行时,我可以看到以下错误: 看起来Java 9与它捆绑在一起,导致了一个错误。文档暗示NetBeans 8.2使用JDK 8!? 如何使用我自己的java来运行NetBeans,或者如何让NetBeans在没有这个错误的情况下启动?

  • 案例1: 使用时: 获取异常: 看到的超文本标记语言套件异常:java.lang.RuntimeException:java.lang.RuntimeException: GoogleChrome在路径中找不到!请将包含“chrome.exe”或“google-chrome”或“GoogleChrome”的目录添加到您的PATH环境可用,或显式指定GoogleChrome路径,如下所示:*goog