WildFly 8.1.0最终Windows Server 2012 R2
我有两个子域指向此服务器,我希望每个子域的请求触发不同的war文件: -
webapp.domain1.com -> WildFly Server -> myapp1.war
test.domain2.net -> WildFly Server -> myapp2.war
Run Code Online (Sandbox Code Playgroud)
我的standalone.xml文件目前根据JBoss开发人员站点上收到的建议配置如下: -
<subsystem xmlns="urn:jboss:domain:undertow:1.1">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" default-web-module="myapp1.war" alias="webapp.domain1.com"/>
<host name="other-host" default-web-module="myapp2.war" alias="test.domain2.net"/>
</server>
<servlet-container name="default">
<jsp-config/>
</servlet-container>
<filters>
<response-header name="server-header" header-value="WildFly/8" header-name="Server"/>
<response-header name="x-powered-by-header" header-value="Undertow/1" header-name="X-Powered-By"/>
</filters>
</subsystem>
Run Code Online (Sandbox Code Playgroud)
将浏览器指向webapp.domain1.com或test.domain2.net会导致请求按预期发送到WildFly服务器,但在这两种情况下都会触发相同的war文件(myapp1.war).
按如下方式切换<host ... />元素的'name'值会导致myapp2.war被调用,无论使用哪个URL: -
<host name="other-host" default-web-module="myapp1.war" alias="webapp.domain1.com"/>
<host name="default-host" default-web-module="myapp2.war" alias="test.domain2.net"/>
Run Code Online (Sandbox Code Playgroud)
看起来Undertow只处理"default-host"条目的细节.
这里有人可以帮忙吗?
如果不这样做,是否有人知道WildFly是否(以及如何)与Apache Web Server一起使用?
在单机/配置/独立-full.xml,我已经声明了以下主机,该作品
<host name="webhost" alias="gateway.example.com" />
Run Code Online (Sandbox Code Playgroud)
当我尝试添加另一个别名时,出现错误404。
<host name="webhost" alias="gateway.example.com www.gateway.example.com"/>
Run Code Online (Sandbox Code Playgroud)
该文档称别名名单空格隔开。
出于开发目的,并不是每个人都可以在其计算机上安装nginx(例如Windows环境中的开发人员),但是我们希望能够做一个行为类似于nginx的反向代理。
这是我们非常具体的情况:
我们希望从http://0.0.0.0:8080提供这两种服务
所以我们想这样映射它:
这样,它的工作方式类似于带有URL重写反向代理的Nginx。
我签出了Undertow源代码和示例,甚至查看了这个特定示例:Reverse Proxy Example,但这是一个负载均衡器示例,但没有找到任何满足我需要的示例。
另外,我知道Undertow可以做到这一点,因为我们知道可以通过Undertow组件配置来配置WildFly来涵盖此特定情况,而不会出现问题,但是我们希望自己将其实现为本地开发的轻量级解决方案。
有人知道这样做的例子吗?或任何具有足够信息来实现此目的的文档?因为我也阅读了Undertow的有关反向代理的文档,但这对您毫无帮助。
谢谢
我需要在 Docker 容器中运行 HTTP REST API(带有嵌入式 Undertow 服务器的 Spring Boot 应用程序),但是当我运行容器并使用基准加载它时,我的响应时间太长(<1000ms),但是当我运行我的刚刚从 IDE 运行的应用程序我在(<10ms)内收到响应,为什么我有这么大的差异?我的泊坞窗文件:
FROM openjdk:8-jdk-alpine
ADD run.sh run.sh
RUN chmod +x run.sh
ADD tmp/data/data.zip tmp/data/data.zip
ADD travels-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 80
CMD ["sh", "run.sh"]
Run Code Online (Sandbox Code Playgroud)
和 run.sh 从我运行应用程序的地方:
#!/bin/sh
echo "Unzipping data..."
mkdir -p /opt/
unzip -o /tmp/data/data.zip -d /opt/
echo "Starting server..."
java -Xmx3G -Xms3G -XX:+AggressiveOpts -server -Djava.security.egd=file:/dev/./urandom -jar app.jar --data.path=/opt/
Run Code Online (Sandbox Code Playgroud)
预先感谢您的帮助!
当使用Undertow 1.4.20(作为嵌入式Servlet引擎)时,在Java 9下运行我们的应用程序时会出现此异常.=: java.lang.ClassNotFoundException: sun.misc.Cleaner
原因是这一行io.undertow.server.DirectByteBufferDeallocator:
tmpCleanerClean = Class.forName("sun.misc.Cleaner").getMethod("clean");
Run Code Online (Sandbox Code Playgroud)
这个类确实不再存在于Java 9中.但可以使用替换: java.lang.ref.Cleaner
我现在可以忽略这个例外吗?是否有解决此问题的时间表(即使Java 9兼容)?
Encountered redirect_uri error in keycloak. Found same issue logged at JIRA KEYCLOAK-7237, just want to check any work around? Anyone can help? Thank you in advance.
2018-06-30 11:34:13,996 WARN [org.keycloak.events] (default task-8) type=LOGIN_ERROR, realmId=Victz, clientId=portal, userId=null, ipAddress=, error=invalid_redirect_uri, redirect_uri=https://www.example.com:0/home
I am using apache http reverse proxy running on centos7, wildly 10, keycloak 3.4.3. has also tried in below environment but same error.
Tried in wildly 10, wildly 11, jboss 7.1, Keycloak 3.4.3 as well as keycloak 4.0
Also …
我在几天前制作并投入生产的一个小网络应用程序中遇到了一些问题。当您访问应用程序并与其交互时,几分钟后就会立即崩溃(等待 SSL 握手的时间太长)。我使用 LetsEncrypt 证书。
问题似乎是 Undertow 在尝试使用SSLConduit.java类时阻塞了一些线程,这导致服务器的某些核心处于 100% 使用率。
服务器中的Java版本是:
openjdk version "11.0.2" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.2+7)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+7, mixed mode)
Run Code Online (Sandbox Code Playgroud)
SpringBoot版本是:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Run Code Online (Sandbox Code Playgroud)
application.properties 文件:
server.port=9002
server.ssl.key-store=keystore.jks
server.ssl.key-store-password=password
server.ssl.key-password=password
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/example_db
spring.datasource.username=example_user
spring.datasource.password=password_db
Run Code Online (Sandbox Code Playgroud)
下流版本是:
yourkit 正在告诉我们:
我尝试放置另一个证书,但问题仍然存在。我不想更改为另一个网络服务器(但如果问题仍然存在,我会的)。有可能解决这个问题吗?或者我必须更改应用程序服务器?
编辑:github中的相关PR: https: //github.com/undertow-io/undertow/pull/721和JIRA中的问题:https://issues.jboss.org/browse/UNDERTOW-1493
我们将 Spring Boot 2.1.8 与 Undertow 一起使用,并使用 Keycloak 进行身份验证。每个请求都需要身份验证,但 servlet 在 Servlet 管道或过滤器中的不同点调用 Keycloak 进行身份验证三次。
我已经通过 Postman 在 Basic Auth 和 Bearer 令牌的日志中看到了这种行为。
关于为什么会发生这种情况的任何想法?它损害了我们的表现。
钥匙披风配置
@KeycloakConfiguration
public class KeycloakSecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
private static final String READ_WRITE = "WRITE_USER";
private static final String READ = "READ_USER";
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
KeycloakAuthenticationProvider keycloakAuthenticationProvider = keycloakAuthenticationProvider();
keycloakAuthenticationProvider.setGrantedAuthoritiesMapper(new SimpleAuthorityMapper());
auth.authenticationProvider(keycloakAuthenticationProvider);
}
@Bean
@Override
protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
}
@Override
protected void configure(HttpSecurity http) throws Exception …Run Code Online (Sandbox Code Playgroud) 我的主要目标是设置 Undertow 的最大并发请求连接限制。
我尝试通过属性进行配置来设置它。但这不起作用。
我研究了如何限制每个请求的最大连接数,并发现以下内容:
为了限制 undertow 中的连接,有必要实现 RequestLimitHandler 和 RequestLimit。
“Request Limiting Handler 限制并发请求数量的处理程序。如果数量超过限制,请求将排队。如果队列已满,则请求将被拒绝。”
http://undertow.io/undertow-docs/undertow-docs-1.2.0/#built-in-handlers
Run Code Online (Sandbox Code Playgroud)
我已经尝试了下一个实现,但此处理程序不会限制请求,因为它不会返回错误 503 响应,而且我无法与 MVC 方法绑定。
1. Test case:
@Bean
public UndertowServletWebServerFactory myUndertowServletWebServerFactory() {
final UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory();
final HandlerWrapper handlerWrapperLimit = new HandlerWrapper() {
@Override
public HttpHandler wrap(final HttpHandler handler) {
final int maximumConcurrentRequests = 1;
final int queueSize = 100;
final RequestLimit requestLimit = new RequestLimit(maximumConcurrentRequests,
queueSize);
final RequestLimitingHandler limitHandler = new RequestLimitingHandler(requestLimit,
new ResponseCodeHandler(
StatusCodes.OK));
return limitHandler; …Run Code Online (Sandbox Code Playgroud) 将环境从 更新到 后,Wildfly 13我们Wildfly 18.0.1经历了
A channel event listener threw an exception: java.lang.OutOfMemoryError: Direct buffer memory
at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
at org.jboss.xnio@3.7.3.Final//org.xnio.BufferAllocator$2.allocate(BufferAllocator.java:57)
at org.jboss.xnio@3.7.3.Final//org.xnio.BufferAllocator$2.allocate(BufferAllocator.java:55)
at org.jboss.xnio@3.7.3.Final//org.xnio.ByteBufferSlicePool.allocateSlices(ByteBufferSlicePool.java:162)
at org.jboss.xnio@3.7.3.Final//org.xnio.ByteBufferSlicePool.allocate(ByteBufferSlicePool.java:149)
at io.undertow.core@2.0.27.Final//io.undertow.server.XnioByteBufferPool.allocate(XnioByteBufferPool.java:53)
at io.undertow.core@2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:147)
at io.undertow.core@2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
at io.undertow.core@2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:59)
at org.jboss.xnio@3.7.3.Final//org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.jboss.xnio@3.7.3.Final//org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.jboss.xnio.nio@3.7.3.Final//org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.jboss.xnio.nio@3.7.3.Final//org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Run Code Online (Sandbox Code Playgroud)
应用程序方面没有任何改变。我查看了缓冲池,似乎有些资源没有释放。我触发了几次手动 GC,但几乎什么也没发生。(正常运行时间2小时)
之前在旧配置中它看起来像这样(正常运行时间> 250小时):
现在我做了很多研究,我能找到的最接近的就是这篇关于 SO 的文章。然而,这是与 websockets 结合使用的,但没有使用websockets。我读了几篇(好)文章(1、2、3、4、5、6 )并观看了有关该主题的视频。我尝试了以下方法,但没有任何效果:
undertow ×10
java ×7
spring-boot ×4
wildfly ×3
keycloak ×2
apache ×1
docker ×1
java-11 ×1
java-9 ×1
java-ee ×1
jboss ×1
spring ×1
ssl ×1
subdomain ×1
virtualhost ×1
wildfly-10 ×1
wildfly-11 ×1