Maven 2 build Java web services? Help - java

Has anyone built Java web services using Maven-2. I've read about the jax-ws plugin, but I haven't found any clear documentation or examples on how to use it.
I tried building a few following instructions of some bloggers, but most instructions seem old or incomplete.
Does anyone have any advice on using Maven to build Java web service, or a link to a clean tutorial.
I'm using Maven 2.2.1, and Java 1.6.
Thanks!

Try one of these :
http://blogs.oracle.com/enterprisetechtips/entry/using_jax_ws_with_maven
http://mojo.codehaus.org/jaxws-maven-plugin/wsimport-mojo.html
https://jax-ws-commons.dev.java.net/jaxws-maven-plugin/

Related

Add native library to Neabeans REST project

I am developing a REST service that will work with ACRCloud, and for that I use the native library acrcloud_extr_tool, but when I call the service that will call ACRCloud, I have an error that appears:
(java.lang.UnsatisfiedLinkError) java.lang.UnsatisfiedLinkError: no acrcloud_extr_tool in java.library.path
I am working in the NetBeans IDE 8.2 and the REST service will be deployed on a TomCat server.
I found articles saying to add a link in the options for running the JVM but what I tried does not work ...
Does anyone know how to solve my problem?
Useful links:
How to add native library folder to existing project in Netbeans
giving 'java.library.path' in netbeans for .dll/.so files
I'm not really experienced with ACR but for what I've seen, there is a Java SDK so why not trying to use it instead of the native one?
If you try it, the steps are quiet good described (Eclipse only sorry :/) in the Github Repo (https://github.com/acrcloud/acrcloud_sdk_java).
Pay attention that you will need to install it on your Tomcat Server (as well as the correct version of vcredist) too in order to use it after deploying (unfortunatly I didn't find the package on Maven but maybe I'm wrong)
And maybe the easiest solution, if you don't need to many uncommon features, would be to call the webservice directly through HTTP request ? (https://www.acrcloud.com/docs/acrcloud/demos/web-api/)

Eclipse Jetty appears to be unusable

I have installed the Eclipse Jetty plugin version 3.9.0 into Eclipse Mars. Unfortunately, while it shows as installed, I do not see any Jetty- related functions appearing in my IDE! It is as if the plugin is dead weight!
I have looked through Eclipse and Jetty tutorials trying to find something that tells me how to access the Jetty plugin in Eclipse. I am finding some nice Jetty tutorials, but nothing about how to access and use the actual plugin. In fact, Jetty as a container doesn't even appear in the list of Servlet containers that are available to Eclipse.
Could someone please either tell me how to use this plugin or point me to somewhere where I can learn? Thank you...
If you're talking about Eclipse Jetty Integration, all the documentation you need to use it is right there.

How to install play2War plugin (Play Framework 2.1.1.)

I'd be very grateful if someone could provide me the basic steps to install the Play2War Plugin. Like where to put the plugin files?, and which files?
I'm pretty new with Play Framework (Java, I'm not a Scala developer, ...yet), just created my first application, and want to deploy it on my server, with is a CentOS with Tomcat/ Glassfish installed, but unfortunately I found out that the 2.x version didn't have the built in war command anymore. I scoured the documentation and found the links Configuration, Usage and Deployment, but what I want to know are the steps until get there.
I started looking for sbt building tool ('cause Play2War Plugin uses it), until I realize that Play Framework 2.1.1. already have it installed (at least that is what I believe. See: *PLAY_HOME/framework/sbt/sbt-launch.jar* and *PLAY_HOME/framework/build*). Am I correct?
Thanks in advance,
As Play 2.1.1 already has SBT its as simple as doing the following:
Within plugins.sbt add:
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.0")
Then within the Build.scala file add:
import com.github.play2war.plugin._
...
val main = play.Project(appName, appVersion, appDependencies)
.settings(Play2WarPlugin.play2WarSettings: _*)
.settings(Play2WarKeys.servletVersion := "X.X")
The X.X needs to be changed to the required Java Servlet version (usually 3.0 or 2.5 depending on your container)
If you have a working play application, you are already using SBT tools to build. Yes, SBT comes with play.
The play2war plugin tutorial provides a step-by-step instruction. Simply follow the tutorial, you should be fine.
To answer your question, where to put the plugin file?
As the tutorial suggests, you need to modify files like APP_HOME/project/plugins.sbt, APP_HOME/project/Build.scala. You should already have these files, you simply need to add those lines to these existing files.
If you have a specific problem, please provide the error message.

How to create a Dynamic Web Project with JAX-WS based Web Service in Eclipse?

How can I create and run a JAX-WS web service in a Dynamic Web Project using Eclipse? I'll be using Tomcat 7 as my server. Can you provide a step by step tutorial on how to do it? A hello world web service will do.
I followed this tutorial but I wasn't able to make it run. I did not follow the tutorial's step 4 - 6 because I'm already using Eclipse and the directories are already properly structured on a Dynamic Web Project. Also, my Tomcat is running under JDK 6. Since JAX-WS is already part of JDK 6, there's no need for me to copy it inside Tomcat. When I run the URL indicated in the tutorial, I get a resource not found error.
I think the jax-ws is not part of the JDK. You have to copy the jax-ws implementation into the Tomcat.
Did you find the jax-ws.jar in your JDK folder?
Ok, JDK6+JAXWS often gives problems.
You need to create an endorsed-Folder.
Try to run Tomcat from Eclipse. using these additional VM-Arguments:
-Djava.endorsed.dirs="<your-server>\endorsed" -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.MessageFactoryImpl
-Djavax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.SOAPFactoryImpl
-Djavax.xml.soap.MetaFactory=com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true
now, place the latest saaj-impl and saaj-api to the endorsed folder.
This should work.

Building example code using asant

I'm studying java web services and trying to follow the oracle tutorial but it tells me to build and deploy the example code using asant. I've looked high and low and I can't find it. It doesn't seem to be included with Glassfish any more. I'm using Glassfish version 3, JDK 1.6.
Can anybody tell me where it is or how to get it?
Thanks in advance.
asant shipped with the GlassFish 2 releases. It was a wrapper that included a number of convenience tasks.
As the team that Sun used to develop GlassFish shrank, some 'features' of the releases were pruned from the GlassFish 3 development work. Asant was one of those features.
Your best bet may be to follow the Web Services section of the Java EE 6 Tutorial. It will be more up-to-date with the current state of the art.
asant is a command line using apache ant, it helps you to build your project using ant, you have to write a build.xml file, and then run the command asant
http://download.java.net/general/open-esb/docs/jbi-ant-targets-reference/target-help/usage.html
Yes I know what it is and what it is supposed to do but I can't find it in my distribution
of glassfish, where it is supposed to be. – ac7web
if you have it installed it should be in: glassfish-Install-Folder/bin

Categories

Resources