Tag Archives: java

CXF Webservice 部署到Wildfly服务器

部署的过程中一直报这个错误

16:01:18,127 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015960: Class Path entry jaxb-api.jar in /content/MavenDeployTest-0.0.1-SNAPSHOT.war/WEB-INF/lib/jaxb-impl-2.2.6.jar  does not point to a valid jar for a Class-Path reference.
16:01:18,201 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."MavenDeployTest-0.0.1-SNAPSHOT.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MavenDeployTest-0.0.1-SNAPSHOT.war".PARSE: JBAS018733: Failed to process phase PARSE of deployment "MavenDeployTest-0.0.1-SNAPSHOT.war"
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS015599: Apache CXF library (cxf-rt-bindings-soap-2.7.6.jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled.
	at org.jboss.as.webservices.deployers.WSLibraryFilterProcessor.deploy(WSLibraryFilterProcessor.java:71)
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
	... 5 more

16:01:18,207 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 4) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "MavenDeployTest-0.0.1-SNAPSHOT.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"MavenDeployTest-0.0.1-SNAPSHOT.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MavenDeployTest-0.0.1-SNAPSHOT.war\".PARSE: JBAS018733: Failed to process phase PARSE of deployment \"MavenDeployTest-0.0.1-SNAPSHOT.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS015599: Apache CXF library (cxf-rt-bindings-soap-2.7.6.jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled."}}
16:01:18,210 ERROR [org.jboss.as.server] (management-handler-thread - 4) JBAS015870: Deploy of deployment "MavenDeployTest-0.0.1-SNAPSHOT.war" was rolled back with the following failure message: 
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"MavenDeployTest-0.0.1-SNAPSHOT.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MavenDeployTest-0.0.1-SNAPSHOT.war\".PARSE: JBAS018733: Failed to process phase PARSE of deployment \"MavenDeployTest-0.0.1-SNAPSHOT.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS015599: Apache CXF library (cxf-rt-bindings-soap-2.7.6.jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled."}}

 

在tomcat 7中运行是正常的,就是在wildfly中部署不了。 搜索之后发现解决方案很简单。在你的应用里面WEB-INF文件夹加入_jboss-deployment-structure.xml

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
	<deployment>
		<exclude-subsystems>
	        <subsystem name="webservices" />
	    </exclude-subsystems>
	</deployment>
</jboss-deployment-structure>

Wildfly Deploy Test

原因: wildfly 为了高效的运行在本身集成了cxf,所以导致了冲突。

 

 

在github查看项目源码:
https://github.com/yhjhoo/WildflyDeployTest

或者在本站WildflyDeployTest下载

使用java来测试TCP和UDP端口

刚刚写了一篇用linux测试TCP和UDP端口的文章,但是这个例子有个缺点呀:

  1. 服务器端不能够一直监听
  2. 只适用于linux环境

咱们都是追求完美的人,怎么能够让这种不完美的情况发生呢? 于是乎下面的例子诞生了。

服务器端:

$ java -cp TCP_UDP.jar pd.jexxus.ServerTest 9003
Listening on port: 9003
Client Connected: 127.0.0.1
Received UDP from 127.0.0.1:49292
Received message: Hello TCP
Connection lost: jexxus.server.ServerConnection@9f293df

客户端:

$ java -cp TCP_UDP.jar pd.jexxus.ClientTest localhost 9003
Connecting using port: 9003
Connection lost: jexxus.client.ClientConnection@1dea34f3

源代码下载src.tar ,

TCP_UDP.jar 下载:TCP_UDP.jar

javafx 在netbeans中 打包

打包就是生成和在相关系统下的安装包。比如说生成ubuntu下的deb安装包,redhat/centos下的rpm安装包,windows下的安装程序。 系统要求:

  1. jdk > 1.7.40或者需要有javafx 环境
  2. netbeans

大概步骤如下:

  1. 创建javafxFXML 程序或者普通的javafx程序
  2. 右键属性选择,Build -> Deployment, Enable Native Packaging

完整的步骤看下面的截图:

1. 创建完项目之后的目录

2. 文件目录
3. 选中项目之后右键
4. 启用 native packaging
5. 打包
6. 打包的程序:
7. 如果的程序想要自己的项目图标,可以在这个目录设置。 关于这个目录的更多详情,请参考命令javafxpackager。这个命令会生成一些默认的打包设置。参考文章http://php-yhjhoo.rhcloud.com/archives/1141.html , 查看一些输出你就会明白的差不多了

在Mac上设置JAVA_HOME

这篇文章将会介绍在Mac中配置 $JAVA_HOME

1. 在Mac OSX 10.5 及之后,apple建议如下设置。 .bash_profile 只是对你自己有效,如果想要对所有的用户有效,使用/etc/profile 来代替~/.bash_profile

$ vim ~/.bash_profile 

export JAVA_HOME=$(/usr/libexec/java_home)

$ source .bash_profile

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

使用 /usr/libexec/java_home -V 可以列出你当前安装的jdk,如下所示:

$/usr/libexec/java_home -V

Matching Java Virtual Machines (2):
    1.7.0_45, x86_64:	"Java SE 7"	/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
    1.7.0_40, x86_64:	"Java SE 7"	/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home

 2. 之前的Mac OSX的版本用如下设置

$ vim .bash_profile 

export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

$ source .bash_profile

$ echo $JAVA_HOME
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home