Jboss 7.1.1 Final Unable to create Web Service Client - spring

I have a ws client created using maven with artifact maven-jaxws-tools-plugin and goal wsconsume.
Once I try to initiate the client I am having below error.
03:25:03,928 ERROR [org.quartz.core.JobRunShell] (quartzScheduler_Worker-1) Job DEFAULT.rcdLogTrackerJobDetail threw an unhandled Exception: : java.lang.NoClassDefFoundError: org/springframework/beans/BeansException
at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.getSpringBusFactory(JBossWSBusFactory.java:120)
at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.createBus(JBossWSBusFactory.java:54)
at org.jboss.wsf.stack.cxf.client.ProviderImpl.setValidThreadDefaultBus(ProviderImpl.java:213)
at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:140)
at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.0.Final.jar:2.0.0.Final]
.....
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) [spring-context-support-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:]
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from [Module "org.apache.cxf:main" from local module loader #4f2c61fe (roots: /opt/extcomp/jboss-as-7.1.1.Final/modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 14 more
03:25:03,949 ERROR [org.quartz.core.ErrorLogger] (quartzScheduler_Worker-1) Job (DEFAULT.rcdLogTrackerJobDetail threw an exception.: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NoClassDefFoundError: org/springframework/beans/BeansException]
at org.quartz.core.JobRunShell.run(JobRunShell.java:234) [quartz-1.8.6.jar:]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:]
Caused by: java.lang.NoClassDefFoundError: org/springframework/beans/BeansException
at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.getSpringBusFactory(JBossWSBusFactory.java:120)
at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.createBus(JBossWSBusFactory.java:54)
at org.jboss.wsf.stack.cxf.client.ProviderImpl.setValidThreadDefaultBus(ProviderImpl.java:213)
at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:140)
at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.0.Final.jar:2.0.0.Final]
.....
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) [spring-context-support-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:]
... 1 more
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from [Module "org.apache.cxf:main" from local module loader #4f2c61fe (roots: /opt/extcomp/jboss-as-7.1.1.Final/modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 14 more
I did some search and see that there is a bug of JBoss 7.1.1 and can be fixed just by doing some manual stuff like; creating a new module and adding it to apache cxf module etc..
I did all these stuff. But couldn't get it working.
Can someone help me, If I am doing something wrong.
by the way; since the client has been created using wsconsume, I also tried to add the module dependency (spring module created by me) to jboss cxf stuff as well. But not worked.

I think I found the issue. It was a typo on my manually-created spring module.
I am not sure if we need to consider this as answer but the issue was a typo.
The solution I followed was.
http://blog.brunoborges.com.br/2012/06/jboss-711-and-cxf-ws-client.html
and of course you need to use correct jar versions while following the above guide.

The post indicated by #Olgum is realy good and help me. But, the link to module.xml is broken. So in order to preserve it for future, I'll post the solution below.
On the jboss-as-7.1.1-Final folder ([JBOSS_HOME]), create this path: modules/org/springframework/spring/main
Create the module.xml file (below) inside the newly created folder
Download and put the jar files into the same folder (the list of jar is inside the module.xml)
Open this file [JBOSS_HOME]/modules/org/apache/cxf/main/module.xml
At the end of this file, make sure you have this module dependency <module name="org.springframework.spring" />
Spring module.xml content:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
<resources>
<resource-root path="spring-aop-3.1.4.RELEASE.jar"/>
<resource-root path="spring-asm-3.1.4.RELEASE.jar"/>
<resource-root path="spring-beans-3.1.4.RELEASE.jar"/>
<resource-root path="spring-context-3.1.4.RELEASE.jar"/>
<resource-root path="spring-context-support-3.1.4.RELEASE.jar"/>
<resource-root path="spring-core-3.1.4.RELEASE.jar"/>
<resource-root path="spring-expression-3.1.4.RELEASE.jar"/>
<resource-root path="spring-jdbc-3.1.4.RELEASE.jar"/>
<resource-root path="spring-orm-3.1.4.RELEASE.jar"/>
<resource-root path="spring-oxm-3.1.4.RELEASE.jar"/>
<resource-root path="spring-tx-3.1.4.RELEASE.jar"/>
<resource-root path="spring-web-3.1.4.RELEASE.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.jms.api"/>
<module name="javax.annotation.api"/>
<module name="javax.servlet.api"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
</module>

I had the same error when instantiating a webservice client, but I couldn't change the JBoss modules (corporate environment). This issue took my day but I finally solved it by adding a dependency to cxf-rt-frontend-jaxws version 2.7.4.
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
Hope it helps.

Julian's solution got me going in the right direction, but there were still missing dependencies which were resolved by looking at this solution:
Apache CXF Exception: java.lang.RuntimeException: Could not find conduit initiator for address
Therefore, I added the following to my pom:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>

Related

Wildfly 8.x ClassNotFoundException: org.jboss.virtual.VFS

I'm trying to deploy an ear application on a wildfly 8.x server.
The problem is when I want to start my server, the log console printed me the following errors:
14:00:09,825 ERROR [org.springframework.core.io.VfsUtils] (MSC service thread 1-7) JBoss VFS packages (for both JBoss AS 5 and 6) were not found - JBoss VFS support disabled
14:00:09,835 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-7) Context initialization failed: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/beans/gardian_beans.xml]; nested exception is java.lang.ExceptionInInitializerError
at
Caused by: java.lang.ExceptionInInitializerError
at org.springframework.core.io.support.PathMatchingResourcePatternResolver$VfsResourceMatchingDelegate.findMatchingResources(PathMatchingResourcePatternResolver.java:652) [spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
... 24 more
Caused by: java.lang.IllegalStateException: Cannot detect JBoss VFS packages
at org.springframework.core.io.VfsUtils.<clinit>(VfsUtils.java:109) [spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
... 39 more
Caused by: java.lang.ClassNotFoundException: org.jboss.virtual.VFS from [Module "org.springframework.spring:main" from local module loader #67117f44 (finder: local module finder #5d3411d (roots: /abb/assetsuite/wildfly-8.2.1.Final.as/modules,/abb/assetsuite/wildfly-8.2.1.Final.as/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
at org.springframework.core.io.VfsUtils.<clinit>(VfsUtils.java:99) [spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
... 39 more
My JBoss does not recognize org.jboss.virtual.VFS class.
Here is my module.xml for my module org.springframework.spring.main :
<module xmlns="urn:jboss:module:1.0" name="org.springframework.spring">
<resources>
<resource-root path="aopalliance-1.0.0.jar"/>
<!--<resource-root path="groovy-all-2.3.4.jar"/>-->
<resource-root path="spring-aop-3.2.9.RELEASE.jar"/>
<resource-root path="spring-beans-3.2.9.RELEASE.jar"/>
<resource-root path="spring-context-3.2.9.RELEASE.jar"/>
<resource-root path="spring-core-3.2.9.RELEASE.jar"/>
<resource-root path="spring-expression-3.2.9.RELEASE.jar"/>
<resource-root path="spring-jdbc-3.2.9.RELEASE.jar"/>
<resource-root path="spring-jms-3.2.9.RELEASE.jar"/>
<resource-root path="spring-tx-3.2.9.RELEASE.jar"/>
<resource-root path="spring-web-3.2.9.RELEASE.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.servlet.api"/>
<module name="javax.jms.api"/>
<module name="javax.annotation.api"/>
<module name="org.apache.commons.logging"/>
</dependencies>
</module>
Of course, I have all jar referenced in the same folder as my module.xml..
It looks like you need a dependency on org.jboss.vfs in it.
You can fix this by
If you have the spring jars under your applications WEB-INF\lib folder then add the following dependency to your "jboss-deployment-structure.xml" file
Or if you are using spring as a separate module then you have to add this as the a dependency to your module.xml in your spring module.
<module name="org.jboss.vfs"></module>
Solution by OP.
Resolved by adding that in my module.xml inside <dependencies>:
<module name="org.jboss.vfs"/>
Don't forget to check if you have the library inside the org.jboss.vfs folder.

wildfly - installing postgres driver jar

I am having difficulty installing the postgres driver. I've tried a bunch of things:
https://docs.jboss.org/author/display/WFLY10/Application+deployment
a. tried "deploying" the JAR (both from CLI and admin console UI)
https://sites.google.com/site/jmdstips/jboss-wildfly/postgresql-on-wildfly---xa-datasource
a. tried putting module definition in modules/org/postgresql ...
b. tried putting module definition in modules/system/layers/base/org/postgresql
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.postgres">
<resources>
<resource-root path="postgresql-9.4.1212.jre7.jar" />
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
And:
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="postgresql" module="org.postgresql">
<datasource-class>org.postgresql.Driver</datasource-class>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
After all of that, I get this error. So, I think wildfly can "see" the module, but something is awry.
23:24:15,889 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "postgresql")
]) - failure description: "WFLYJCA0041: Failed to load module for driver [org.postgresql]"
short answer: put the driver in the /wildfly/standalone/deployments folder, it will deploy the driver automatically
It turns out I used "org.postgres" for the module name in standalone.xml instead of "org.postgresql" which is what I declared it as inside the module.xml
I also encountered this error and it was due to the module.xml not having the correct resource-root

Wildfly 10 Final postgres driver ClassCastException

eventually somebody can help me. Currently I have a really strange problem when starting wildfly 10 Final with a postgres driver but with the same setting wildfly 10 CR4 will start up.
The exception I get is following:
Caused by: javax.resource.ResourceException: IJ031089: Failed to load datasource: org.postgresql.Driver
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getDataSource(LocalManagedConnectionFactory.java:650)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:311)
... 6 more
Caused by: java.lang.ClassCastException: org.postgresql.Driver cannot be cast to javax.sql.DataSource
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getDataSource(LocalManagedConnectionFactory.java:633)
... 7 more
The strange thing is, it works on wildfly 10 CR4 but not on the final version wildfly 10 Final. Any Idea?
For me it looks like a class loader problem but I'm not that an expert with wildfly to track it down.
my modules/org/postgres/main/module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgres">
<resources>
<resource-root path="postgresql-9.4.1208.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
My driver definition in standalone.xml
<driver name="postgres" module="org.postgres">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<datasource-class>org.postgresql.Driver</datasource-class>
</driver>
Java JDK is: jdk1.8.0_73
Would really appreciate any help to fix my problem.
Thx in advance
/david
The class name implementing a DataSource is either:
org.postgresql.ds.PGSimpleDataSource
or
org.postgresql.ds.PGPoolingDataSource
https://jdbc.postgresql.org/documentation/head/ds-ds.html
I assume Wildfly will manage the connections, so you probably don't need the pooling DataSource, only the simple:
So it should be
<driver name="postgres" module="org.postgres">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<datasource-class>org.postgresql.ds.PGSimpleDataSource</datasource-class>
</driver>

Wildfly Failed to Load Module for Oracle Driver

I'm attempting to add an Oracle DB datasource to Wildfly 10. Here's what I have:
<wildfly-home>\modules\com\oracle\ojdbc6\main\
module.xml
ojdbc6.jar
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:Wildfly:module:1.0" name="com.oracle.ojdbc6">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="javax.transaction.api"/> <!-- See * below -->
</dependencies>
</module>
* I have tried both with and without the line <module name="javax.transaction.api/>. Some examples I've found online include it. Some do not. It seems to make no difference with whether the error occurs or not.
ojdbc6.jar was copied from <oracle-home>\jdbc\lib\ojdbc6.jar.
I have modified <wildfly-home>\standalone\configuration\standalone.xml to include this within the <drivers> tag:
<driver name="oraclethin" module="com.oracle.ojdbc6">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
This error message is being spat out when I cd into <wildfly-home>\bin and run .\standalone.bat:
15:17:13,415 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "oraclethin")
]) - failure description: "WFLYJCA0041: Failed to load module for driver [com.oracle.ojdbc6]"
I've triple checked the spelling on everything. I've tried taking out some lines (and putting them back when nothing changes). Is anyone seeing what I'm missing?
Use xmlns="urn:jboss:module:1.0"
As described in https://docs.jboss.org/author/display/MODULES/Module+descriptors
what solve the issue for me was to enlarge the timeout connection on the standalone.xml file on jboss
<system-properties>
...
<property name="jboss.as.management.blocking.timeout" value="6000"/>
</system-properties>

Spring module in JBoss 7

I'm trying to set up Spring 3.0.6 libraries as a module in JBoss 7.
I have all of the jars in modules/org/springframework/main along with the following module.xml
<module xmlns:"urn:jboss:module:1.0" name="org.springframework">
<resources>
<resource-root path="org.springframework.beans-3.0.6.RELEASE.jar"/>
...
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.servlet.api"/>
<module name="org.apache.commons.logging"/>
</dependencies>
</module>
I added org.springframework to the Dependencies line in my MANIFEST.MF
When I deploy the app the following exception is thrown while parsing my spring-servlet.xml file (sorry, this is from a system that is not networked)
SAXParseException: ... Cannot find the declaration of element 'beans'
My first thought was that the module is not being used but if I remove org.springframework from my Dependencies line it fails to find org.springframework.web.context.ContextLoaderListener
Everything works fine if I put the jars in WEB-INF/lib instead of using the module.
spring-servlet.xml contains the following schema reference
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
so I put spring-beans-3.0.xsd in the same directory as spring-servlet.xml and modified the xml to
http://www.springframework.org/schema/beans spring-beans-3.0.xsd
but still no luck.
Anybody have an idea of why the class files are found but the xsd files are not?
Just in case the link that was given in the comments goes away, the problem is that
Problem:
The namespace configuration files are in META-INF, but that directory
is not visible (nor is it configurable via
jboss-deployment-structure.xml)
Solution:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<dependencies>
<module name="org.apache.commons.logging"/>
<module name="org.springframework" >
<imports>
<include path="META-INF**"/>
<include path="org**"/>
</imports>
</module>
</dependencies>
</jboss-deployment-structure>
Was facing the exact same issue. Had set up a spring module on JBoss 7 and then when deploying my application, was facing the below warning:
Failed to read schema document
'http://www.springframework.org/schema/beans/spring-beans-3.2.xsd'
I understood the spring context file was unable to access the schema definitions from the spring jars, after reading the link in the comments above. And hence, the application was not getting deployed. But the solution given there did not work for me. But the below code in the jboss-deployment-structure.xml resolved the issue.
Solution
<module name="org.springframework.spring" meta-inf="export" export="true" />
Added meta-inf="export" attribute.

Resources