Does the application server JBoss include CXF installation? - eclipse

I'm trying to set the CXF Runtime on Eclipse web services preferences window.
I'm trying to point to JBoss installation in my pc at :
C:\jboss-eap-6.3\modules\system\layers\base\org\apache\cxf
But I'm getting error : Missing CXF jar: Please select the CXF home directory.
Shouldn't JBoss include a working CXF installation ?

Jboss AS 7.x have the dependency for apache CXF, you can use that by loading the module in your web application. There are a lot of way to achieve this on of common is setting apache cfx module as global module which will loaded into memory as the application server will started. Add the following lines in standalone.xml of jboss server-
<subsystem xmlns="urn:jboss:domain:ee:1.0" >
<global-modules>
<module name="org.apache.cxf" slot="main" />
</global-modules>
</subsystem>
If you want to add the module as web application dependent then you can use jboss-deployment-structure.xml-
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.apache.cxf" services="import">
<imports>
<include path="**" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
and if you are using the maven build the you can load the module by manifest entry for the dependency-
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>org.apache.cxf</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

Related

.jar missing in deployed JBoss .war

I know this has been asked a few times in the past, but I'm unable to find a solution (except for the "add the .jar to your project manually in Eclipse"..)
What I have:
A Maven project
A .jar web-service we've created (let's call it kc.ourwebservice)
After a clean install (in Eclipse or via the command line) and Full Publish in Eclipse (and yes, I have done an Update Maven Project - Force Update of Snapshots/Releases before that), this .jar can be found in:
This kc.ourwebservice.jar is present in our Nexus Repository Manager OSS
This kc.ourwebservice.jar is present in our Eclipse project at the Maven dependencies
This kc.ourwebservice.jar is present when I run mvn dependency:tree -Dverbose
This kc.ourwebservice.jar is present in my .m2 folder
However, it's missing from the deployed JBoss .war's lib folder, which is what my question is about.
I know I could manually add the .jar in Eclipse' Deployment Assembly (or org.eclipse.wst.common.component file), but every time I switch git branches or do an "Update Maven Project", it's gone again. And I also don't want to manually add this .jar when the project is put on a server.
I need a permanent solution so the .jar is correctly added to the deployed JBoss .war, using the Maven plugins that were designed for it.
One thing to add. This webservice has both an .aar and .jar. Both of them are necessary. The .jar when we're starting the application, so I gave it a <scope>compile</scope>, and all the .aar we use are only needed at runtime, so I gave it that scope (<scope>runtime</scope>).
Here is the relevant pom.xml code (lots of more dependencies, plugins and code at the ...'s, but those are irrelevant for this problem):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
...
</parent>
<artifactId>...</artifactId>
<packaging>war</packaging>
...
<properties>
...
<ourwebservice.version>1.0.0</ourwebservice.version>
...
</properties>
...
<plugins>
...
<!-- Takes care of copying the aar services to the WEB-INF/services -->
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-repo-maven-plugin</artifactId>
<version>1.7.3</version>
<configuration>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<stripServiceVersion>false</stripServiceVersion>
<services>...,ourwebservice</services>
</configuration>
<executions>
<execution>
<phase>generate-resources</phase>
<id>deploy webservices</id>
<goals>
<goal>create-repository</goal>
</goals>
</execution>
</executions>
</plugin>
...
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<outputDirectory>${warOutputDir}</outputDirectory>
<webappDirectory>${webappDirectory}</webappDirectory>
<warName>${project.artifactId}</warName>
<!-- Tell the maven war plugin to use the merged web.xml -->
<webXml>${warOutputDir}/web.xml</webXml>
<warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
<webResources>
<resource>
<directory>${basedir}/src</directory>
<targetPath>WEB-INF/classes</targetPath>
<excludes>
<exclude>**/*.java</exclude>
<exclude>sample-properties.properties</exclude>
<exclude>sample-log4j.properties</exclude>
</excludes>
</resource>
<!-- Copy the generated services that were extracted from the dependencies to the WEB-INF/services folder of the war archive. -->
<resource>
<directory>${project.build.directory}/generated-resources/services</directory>
<targetPath>/WEB-INF/services</targetPath>
<includes>
<include>**/*.aar</include>
</includes>
</resource>
...
</webResources>
<!-- The axis2 services should not be stored in the WEB-INF/lib -->
<packagingExcludes>WEB-INF/lib/*.aar</packagingExcludes>
</configuration>
</plugin>
<!-- JBoss plugin used to deploy war file - http://mojo.codehaus.org/jboss-maven-plugin/ -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<hostName>${deploymentHostName}</hostName>
<port>${deploymentPort}</port>
<fileName>${deploymentFileName}</fileName>
<serverName>default</serverName>
<jbossHome>
//${deploymentHostName}/${jbossHome}
</jbossHome>
</configuration>
</plugin>
</plugins>
...
<dependencies>
...
<dependency>
<groupId>kc</groupId>
<artifactId>ourwebservice</artifactId>
<version>${ourwebservice.version}</version>
<type>aar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>kc</groupId>
<artifactId>ourwebservice</artifactId>
<version>${ourwebservice.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
...
</dependencies>
...
</project>
Does anyone has any idea why the .jar isn't deployed to the .war? Or better yet, does anyone know a solution so the .jar is always deployed to this .war when doing a clean install and publish?
All other .jar files are present in the .war, this webservice is the only one missing.

Wildfly Postgres JDBC module issue

I have postgres jdbc driver configured as module in Wildfly 10. What I am trying to do, is to use that driver as dependency in application that will be deployed on the server - so in application, I mark this dependency as provided (in pom.xml file) but it seems to be not working.
Current configuration:
Wildfly postgres module is added at wildfly-10.1.0.Final\modules\org\postgresql\main where there is: postgresql-9.4-1206-jdbc4.jar and module.xml with following content:
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
<resources>
<resource-root path="postgresql-9.4-1206-jdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Module is used to define datasource. To this point, everything is working well - with hibernate help tables are happily mapped to entities. Except one thing:
I started to map postgres-jsonb columns with use of javax.persistence.AttributeConverter and following happens:
Scenario 1
When I use postgresql-9.4-1206-jdbc4.jar as a provided (in pom.xml - deployed application), I get following error trying to convert anything:
Caused by: java.lang.ClassNotFoundException: org.postgresql.util.PGobject from [Module "deployment.priject-1.0.1.ear.project.data-1.0.1-SNAPSHOT.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 269 more
Scenario 2
When I use postgresql-9.4-1206-jdbc4.jar with default scope, there is following error:
Caused by: java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast to org.postgresql.util.PGobject
at com.project.entity.util.converters.JSONBTypeConverter.convertToEntityAttribute(JSONBTypeConverter.java:33)
at com.project.entity.util.converters.JSONBTypeConverter.convertToEntityAttribute(JSONBTypeConverter.java:1)
at org.hibernate.type.descriptor.converter.AttributeConverterSqlTypeDescriptorAdapter$2.doConversion(AttributeConverterSqlTypeDescriptorAdapter.java:140)
... 266 more
Which means: class loader load the same jar two times, and can not cast this object to itself.
Question: Why provided scope of the dependency does not work for manually added (to wildfly) postgres driver? (I guess that would be the solution for me)
You need to use a jboss-deployment-structure.xml to add the module dependency to your deployment.
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.postgresql" />
</dependencies>
</deployment>
<sub-deployment name="project.data-1.0.1-SNAPSHOT.jar">
<dependencies>
<module name="org.postgresql" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Note the module dependency on the EAR may not be required. It just depends on how your EAR is setup.
Another option would be to add a Dependencies manifest entry. Since you're using Maven you could just use the maven-jar-plugin (since it appears this is a JAR inside an EAR) to create the entry.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>org.postgresql</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>

GWT 2.5.1 SuperDevMode not enabled

i work on a GWT/GWTPHONEGAP/MGWT project and i need using gwt 2.5.1 with SuperdevMode.
I use maven and the following command "classpath gwt:runcodeServer", when i compile my project no error occur, but when i go to my webBrowser to using superDevMode, it's impossible to recompile, the error message is "this module has doesn't have Super Dev mode enabled" although my *.gwt.xml contains the following line enabled superDevMode.
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-property name="compiler.useSourceMaps" value="true" />
with following entrypoint
<entry-point class="**.**.*.client.MgwtAppEntryPoint" />
When i go to the localhost:9876 the project is present & source are available.
Following my configuration of maven :
jetty :
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.1.2.v20140210</version>
<configuration>
<reload>manual</reload>
<httpConnector>
<port>9090</port><!-- port 8080 already use by tiviz-web -->
</httpConnector>
<webApp>
<baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
<resourcesAsCSV>src/main/webapp,${basedir}/target/tiviz-gwt-0.0.1-SNAPSHOT</resourcesAsCSV>
</baseResource>
<extraClasspath>${basedir}/src/main/webapp/WEB-INF/classes</extraClasspath>
<allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
</webApp>
<systemProperties>
<systemProperty>
<name>gwt.codeserver.port</name>
<value>9876</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
and my configuration of gwt-maven-plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<!-- run params -->
<copyWebapp>false</copyWebapp>
<productionMode>false</productionMode>
</configuration>
</plugin>
problem come from an bad configuration in the path of my webapp ressource in jetty plugin.

Eclipse with Websphere 7.0.0.17: EJB project does not work with resources within the workspace, but works with resources on Server

My application works with Maven and has three modules:
ear-module
web-module
ejb-module
EJB Version is 3.0.
Deployment works in both ways without error messages.
When I try to run the application with the Publishing settings for Websphere "Run server with resources on Server" it works fine.
When I try do the same with "Run server with resources within the workspace" and open the application in my Browser it fails with this error message:
A resource reference binding could not be found for the following resource references [jdbc/nust], defined for the NustService component.
I am new in JEE5, but it seems to me that local the websphere cant find the ejb-jar.xml.
Here the pom for ejb modul:
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>mycomp-nust-frontend-app</artifactId>
<groupId>mycomp.app</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>mycomp-nust-frontend-svc</artifactId>
<name>mycomp-nust-frontend-svc</name>
<packaging>ejb</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mycomp.service</groupId>
<artifactId>mycomp-service-utils</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.0</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<!-- Add classpath container for Websphere Application Server 7 to the
Eclipse project. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<classpathContainers>
<classpathContainer>org.eclipse.jst.server.core.container/com.ibm.ws.ast.st.runtime.runtimeTarget.v70/was.base.v7</classpathContainer>
<classpathContainer>org.eclipse.jst.j2ee.internal.module.container</classpathContainer>
</classpathContainers>
<projectNameTemplate>${project.name}</projectNameTemplate>
</configuration>
</plugin>
</plugins>
</build>
</project>
Any suggestions, more info needed?
thx
The problem is not with your ejb-jar.xml. Remember, the ejb-jar.xml just declares references; the actual binding to a "real" resource is done by application server-specific files. In WebSphere's case, this file is ibm-ejb-jar-bnd.xml, which should be located at the same directory as ejb-jar.xml. Do you happen to have that file there?
I faced a similar situation where my application's defined resources could not be found. The solution was to define the /WEB-INF/ibm-web-bnd.xmi
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.ejs.models.base.bindings.webappbnd:WebAppBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.ejs.models.base.bindings.webappbnd="webappbnd.xmi" xmi:id="WebAppBinding_1348167502046" virtualHostName="default_host">
<webapp href="WEB-INF/web.xml#struts_blank"/>
<resRefBindings jndiName="jms/MyConnectionFactory" xmi:id="cf">
<bindingResourceRef href="WEB-INF/web.xml"/>
</resRefBindings>
<messageDestinationRefBindings jndiName="jms/TopicSpace/Group/Test" xmi:id="myTopic">
<bindingMessageDestinationRef href="WEB-INF/web.xml"/>
</messageDestinationRefBindings>
</com.ibm.ejs.models.base.bindings.webappbnd:WebAppBinding>
A senior developer in the team said that this should be a XML file but then that didn't work. I discovered this by exporting a deployed application from an IBM tutorial. Depending on your application you will have to change the above resource references.
Hope this helps

Unable to see Web Resources folder after running eclipse:eclpise for WTP project using maven

I see that m2e is able to create all the necessary artifacts for building my web application.
However the problem I'm facing is that I don't see the "Web Resources" section in the project explorer.
To navigate to my web resources(jsp, js, css ...) (which happen to be under src/main/webapp), I need to expand the folder structure everytime.
the following is my pom
<?xml version="1.0" encoding="UTF-8"?>
<project>
...
<packaging>war</packaging>
<dependencies>
...
</dependencies>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<wtpversion>2.0</wtpversion>
<wtpmanifest>true</wtpmanifest>
<wtpapplicationxml>true</wtpapplicationxml>
</configuration>
</plugin>
</plugins>
</build>
</project>
How to I change my POM such that Eclipse maps src/main/webapps to "Web Resources"??
I'm using eclipse 3.7.0 and m2e 1.0.100
Any help is appreciated!!!
Have you installed the Maven Integration for WTP (a.k.a m2e-wtp)? It's available from the Eclipse Marketplace, or the m2e marketplace. See http://community.jboss.org/en/tools/blog/2011/08/01/m2eclipse-wtp-0131-back-to-the-m2e-marketplace for more informations on how to install it.
You can also find more informations on the Deployed Resources node (formerly Web Resources) in
http://community.jboss.org/en/tools/blog/2011/06/23/m2eclipse-wtp-0130-new-noteworthy
Just a shot in the dark: Right click on your project, Maven->Update Project configuration...
Or maybe you installed the wrong Eclipse version? Eclipse IDE for Java EE Developers should do the trick.