What's the difference between jaxws-ri and jaxws-rt? - java

See the JAX-WS Maven repository from java.net - http://download.java.net/maven/2/com/sun/xml/ws/
There are two similar folders - jaxws-rt and jaxws-ri. Currently, I'm using the jaxws-rt and it's working fine.
Here are my questions:
What's the difference between ri and rt?
Does ri stand for reference implementation and rt stand for runtime?
Please advice.
Thanks.

As an answer to your second question: Yes, you are right.
Below is the proof.
RI stands for Reference Implementation.
Quote from the official JAX-WS project home page (an old site, see the UPDATE section below):
Welcome to the JAX-WS Reference Implementation (RI) Project.
Plus in the POM file for the jaxws-ri (version 2.2.8 at the time of writing) we can find the following:
<name>JAX-WS RI Standalone Zipped Bundle</name>
<description>Open source Reference Implementation of JSR-224: Java API for XML Web Services Distribution Bundle</description>
RT stands for Runtime.
In the POM file for the jaxws-rt (version 2.2.8 at the time of writing) we can find the following:
<name>JAX-WS RI Runtime Bundle</name>
(The word Runtime gives us a hint :-))
UPDATE (April 2019)
The were quite a few changes in the Java EE world recently. Java EE was moved to Eclipse Enterprise for Java (EE4J). Read EE4J FAQ for more information.
And JAX-WS project, which is now part of the EE4J, has also moved to another place:
JAX-WS project's home page: https://javaee.github.io/metro-jax-ws/
JAX-WS project's code is hosted on GitHub:
https://github.com/eclipse-ee4j/metro-jax-ws

Looks like -ri generates the zip file for distribution (e.g. for use on the java.net web site), whereas -rt is for use as a Maven dependency. So you should keep using it.
EDIT: The other answer is more accurate and should be accepted

Related

JAX-WS 2.2 and JDK6 with maven

I have a web service and I'm using the Endpoint.publish("http://0.0.0.0:8080")
Thing is that JAX-WS 2.0 and 2.1 is affected by an issue that throw a NullPointerException when executing endpoint.stop().
The issue is fixed in 2.2 but when adding the dependency in the pom.xml publishing fails due to a java.lang.NoSuchMethodError: javax.xml.ws.WebFault.messageName()Ljava/lang/String; since I'm using java 1.6.
The workaround is to add to the endorsed folder some libs. But I want to pack it all in jar-with-dependencies. An executable java jar.
Said this, I would be thankful if you help me:
Publishing the endpoint in 2.0 or 2.1 listening to all addresses (0.0.0.0)
or
Configuring dependencies in maven to pack everything using 2.2.x
but executable with JDK6
EDIT:
Requirements are a deliverable jar. A single jar that pack all of the dependencies (2 so far, about a 400k jar).
But if you think that the only way to make it work is to add an external shell script please let me know too.
Thank you!
The executable jar format does not allow for endorsed folders required for JAX-WS replacement (and neither does the Java WebStart launcher apparently).
You need to use something that can construct and execute a new "java" command on the fly. The best way from here is most likely to look for an installer which can run the program directly without needing to install.
What exactly do you need to happen?
EDIT: As the requirement is a runnable jar you simply cannot do this with JAX-WS 2.2 Find a workaround with the JAX-WS present in the latest release of the Java version you are targetting.
It is very nice that the JAX-WS stack ship with core Java allowign for very small deployments, but a pain that you cannot easily provide your own.
Note that you can provide your own with Java 5 but then you need to bring your own Endpoint implementation.
Do you need to use the JAX-WS RI? You could use CXF instead which is a fine JAX-WS implementation and doesn't suffer the same collision problems as the RI.
Edit: You could try to generate the classes with the RI, but use CXF in the deployment. JAX-WS is a spec after all so it should work...

Patching Jersey to use asm-4

this is a follow-up post to the twitter discussion i had on Google App Engine (Twitter Conversation)
The Problem is that Jersey and GAE won't work together with datanuceleus 2.0, since GAE needs ASM 4.0 but Jersey needs 3.1. A detailed description and easy solution on that is available here: GAE and Jersey Problem description
There are several posts on questions here on Stackoverflow, so I opened this thread to collaborate with Google's Teams to solve this issue.
I simply switched from Datanuceleus 2.0 to 1.0 and Jersey was working again. Do you have any other suggestions? Especially since 2.0 would be great to use.
Greetings,
Mario
Another solution is to use version 1.18.1 of Jersey, which is no more dependent on asm 3.0 and contains a repackaged version of asm, you can check it here: http://mvnrepository.com/artifact/com.sun.jersey/jersey-bundle/1.18.1
This will work in GAE.
You should try jarjar, which embeds a jar into another jar and fixes code references on bytecode level.
See this excellent blogpost: http://blog.harrywye.com/post/30160964741/running-java-jersey-with-jdo-3-0-on-google-app-engine
As #peter-knego said, with jarjar is really easy, and you can still use JDO/JPA > 1.0
Download jarjar
Create a text file: testrules.txt with the following content:
rule org.objectweb.asm.** org.objectweb.asm3.#1
With asm-3.1.jar and jersey-server-1.1.5-ea-SNAPSHOT.jar (or whatever you have) execute the following commands:
java -jar jarjar-1.4.jar process testrules.txt asm-3.1.jar asm-3.1r.jar
java -jar jarjar-1.4.jar process testrules.txt jersey-server-1.1.5-ea-SNAPSHOT.jar jjersey-server-1.1.5r-ea-SNAPSHOT.jar
And finally just replace the asm-3.1.jar and jersey-server-1.1.5-ea-SNAPSHOT.jar with the repackaged libraries.
I am using it with the 1.8.3 SDK and it worked to me.
Reference here

javax.ws.rs package

I am learning RESTful Web Services and all the tutorials use javax.ws.rs.* package. But with JDK 6 and JDK 7, my Eclipse doesn't seem to recognize javax.ws package. What am I missing here?
javax.ws.rs is not a JDK package; it is a server-side API that forms part of the Java EE specification. You would need to include a Java EE runtime on your classpath or source an implementation from a 3rd party if you're going the self-assembly route (e.g. using Tomcat.)
You're may be missing Jersey installation, or something in your environment configuration. Try also installing Eclipse WPT. You can follow this tutorial, it covers prerequisites and basic installation procedures as well.

How to handle missing ExpressionFactory#newInstance() method in api downloaded by maven?

According to java ee 5 api ExpressionFactory provides a method #newInstance.
I'm using the official javaee-api available in maven: Java EE 5 APIs now in a Maven repository...
But this jar does not provide this method. So I get compiler errors.
How can I get a compilable version without using javaee implementations like e.g. glassfish, openejb?
The official Java EE 6.0 jar provided by maven (java.dev.net) contains this method.
According to java ee 5 api ExpressionFactory provides a method #newInstance.
Well, javadoc is not a proof and, actually, this is very likely an error in the Java EE 5 javadoc. The two newInstance() factory methods have been added in the Maintenance Review 1 of the JSR-245 (to make EL standalone and take it out of JSP 2.1, have a look at the JSR-245 MR1 Change Log for the details) but that review has never been released.
So it's not surprising that you don't find this method in the java-ee bundle available in the java.net repo.
But this jar does not provide this method. So I get compiler errors.
As expected. This method is not in Java EE 5 (at least this is my understanding). So you need to use:
ExpressionFactory factory = new ExpressionFactoryImpl();
The official Java EE 6.0 jar provided by maven (java.dev.net) contains this method.
Yes, because this is Java EE 6, because EL is now standalone, with its own specification (technically, EL is still in JSR-245, sorry if this is confusing). So Java EE 6 includes EL 2.2 (yes, the version jumped from 1.1 to 2.1.2 and then 2.2 for a better alignment with the JSP version). And this version does expose the newInstance() methods on ExpressionFactory.
Why don't you want to use the libs from a Java EE server ? You'll eventually have to test in one, even if locally. You could use Tomcat, it's easy to install and to use.
In Tomcat for example, all the jars providing the Java EE api are available in the lib folder. If you compile using those libs, and stick to the standard Java EE API, your code will be compatible with all servers that implement the Java EE API.
If you use Maven and don't want to have these libs in your arborescence, and have a server installed, you can use the system dependency type (see here for more informations)

Where can I download common-annotations.jar

Have a Spring 2.5 webapp which runs fine under 1.6, but under 1.5 it can't find PostConstruct class.
Found the following which suggests I need common-annotations.jar (JSR-250) but cannot find anywhere to download it
The reference implementation is available here:
http://jcp.org/aboutJava/communityprocess/final/jsr250/index.html
Reference Implementation (RI) and Technology Compatibility Kit is part of glassfish.
In other words, you might end up having to download the GlassFish Application Server just to get the single jar file.

Categories

Resources