JBoss学习
来源:互联网 发布:求数组平均值 编辑:程序博客网 时间:2024/06/05 19:30
最近项目要开发一个基于H5的点对点聊天界面,通过websocket技术实现。但是服务器使用Jboss eap 6.3, 网上资料不多,jboss也是第一次学习遇到很多困难,现针对遇到的问题进行整理。
环境:需要jdk1.7+
jboss 下载:Jboss下载地址
修改配置支持websocket: 修改文件jboss_home/standalone/configuration/standalone.xml
<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false"> <connector name="http" protocol="<span style="color:#FF0000;"><strong>org.apache.coyote.http11.Http11NioProtocol</strong></span>" scheme="http" socket-binding="http"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost"/> <alias name="example.com"/> </virtual-server></subsystem>
添加websocket支持jar包:
<dependency> <groupId>javax.websocket</groupId> <artifactId>javax.websocket-api</artifactId> <version>1.1</version></dependency>
或
<dependency> <groupId>org.jboss.spec.javax.websocket</groupId> <artifactId>jboss-websocket-api_1.0_spec</artifactId> <version>1.0.0.Final</version></dependency>
应用程序添加jboss-web.xml:
在WEB-INF目录创建jboss-web.xml,内容如下:
<?xml version="1.0" encoding="UTF-8"?><!-- JBoss, Home of Professional Open Source Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual contributors by the @authors tag. See the copyright.txt in the distribution for a full listing of individual contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--><!DOCTYPE jboss-web><jboss-web xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.org/schema/jbossas http://www.jboss.org/schema/jbossas/jboss-web_7_2.xsd"> <!-- Configure to enable WebSockets --> <enable-websockets>true</enable-websockets></jboss-web>
部署应用程序: 将war包放到jboss_home/standalone/deployments目录下即可
启动服务: jboss_home/bin/standalone.bat
访问应用:http://localhost:8080/websocket
项目示例源代码:
示例应用源代码
项目示例war包:
1 0
- JBOSS 学习
- JBoss学习
- JBOSS学习-初识JBOSS
- JBoss-MySql学习笔记
- Jboss JBPM 学习点滴
- JBoss学习笔记
- Jboss JBPM 学习点滴
- jboss学习笔记
- JBoss配置学习
- JBOSS JBPM 学习笔记
- jboss 学习笔记1
- jboss学习笔记2
- Jboss Portal学习
- JBoss学习文档
- JBoss MicroContainer 学习笔记
- JBoss jBPM 学习
- 学习jboss目录结构
- jboss standalone.xml学习
- android -调用系统相机录像
- Vue.js实现表格渲染
- 第四周项目5--多项式求和
- 1020 月饼
- 【机器学习】机器学习泛泛之谈
- JBoss学习
- mac mysql5.7版本密码忘记,无法登录
- hdu2586(LCA)
- 绿之缘,生态行
- Apache Hive2.0的新特性介绍
- 复合数据类型
- HDU-5879-Cure-打表模拟(水)
- 简单电话系统的电话数量分析
- win7&GItblit&Git