Hello and thanks for your time!
I have been looking for solution long enough, but didn't find how to connect glassfish with built-in Jersey via Rest. Actually, it's not a point make it via Rest, but I found out that I can't do that anyway else, if I plan using not-embedded neo4j.
http://docs.neo4j.org/chunked/milestone/server-java-rest-client-example.html
In the manual I need to install Jersey, but that Jersey is different than Glassfish's one, there's no needed classes inside.
I cant just replace Jersey files in Glassfish because of GF incompability. So, do I need to use another Jersey client, foreing to Glassfish, for Rest queries?
I found also framework neo4j-rest-graphdb, but I'm not sure it will work and probably is what I need. http://m2.neo4j.org/content/repositories/releases/org/neo4j/neo4j-rest-graphdb/2.0.0-M06/
I found JDBC driver for Neo4j - is this a better for these purposes?
Thank you!
Neo4j uses jersey version 1.* while glassfish uses version 2.*
The API has been changed as you can check in their respective docs :
https://jersey.java.net/documentation/1.17/client-api.html
https://jersey.java.net/documentation/latest/client.html
You basically need to create a client in both cases, and then define a webresource in 1.*, and a webtarget in 2.*
The import paths were also modified.
For instance, the client in 1.* is :
import com.sun.jersey.api.client.Client;
while in 2.* it is :
import javax.ws.rs.client.Client;
You should check the API for more details.
I assume you are using Glassfish 4. You can use the Jersey client APIs bundled with it you don't need to install one. Some of the client class names in the Jersey2 client are different then Jersey 1
Related
We were working on creating a RESTful service. We have thought of using frameworks like jersey or cxf. But apparently we found that just using the javax.ws.rs-api-2.0.jar and the related annotations, we can get the service working.
Question is:
How does it work? Is it dependent on the application servers?
What if we application server does not support or have the implementation of the API?
If it is dependent on application servers, can I find out the library which the server is using especially tomcat?
EDIT 1
This question is invalid. javax.ws.rs-api-2.0.jar is just an API. Using this jar does not suffice. It will not give compilation errors.
But at run-time, you need providers which will implement the rs-api. And thus we need the frameworks like jersey or cxf.
In our application, these jars were added to the war during ant-build from external location and that is why it confused us.
I am closing this question.
I am new to SQL Server Reporting Services and web services in general. I am trying to follow this tutorial for integrating java with SSRS web services: http://www.craigsprogramming.com/2011/03/how-to-integrate-java-with-microsoft_4178.html.
I have generated the proxy classes from the server's ReportExecution2005 wsdl file, using the wsimport utility. I get most classes such as the ReportExecutionService and the ReportExecutionServiceSoap. However, I seem to be missing the ReportExecutionServiceSoapStub class which is utilized in the tutorial(and among other tutorials/examples). I have the same version of ReportExecutionService.
"import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.*;" doesn't contain ReportExecutionServiceSoapStub class
Would anyone have any idea why this is happening? This is very new to me, so any help would be appreciated. Thanks!
So I figured out the Stub class is generated by Apache Axis when the wsdl is converted to the proxy classes by Axis. I generated them with wsimport.
I'm trying to deploy a Java EE web application with RESTful web services and an EJB connexion to another Java EE application.
I'm experiencing several problems and I fail to write down every specific question, so I have no choice but tell you all in a row.
1) First, I am using Tomcat to run the app and I cannot get EJB connexion to work. No matter what, I get a JNDI error : NamingContextFactory class not found. Why ?
My JNDI connexion is as follows :
String hostname = "localhost";
String port = "1099";
String url = "jnp://" + hostname + ":" + port + "/";
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
h.put(Context.PROVIDER_URL, url);
h.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
initialContext = new InitialContext(h);
2) Therefore, as the server used is not relevant, and as the app I'm trying to connect to is using JBoss (4.4.2.GA), I tried to deploy my app under the same JBoss. I cannot get it to deploy, I have a REST problem: ClassNotFoundException: javax.ws.rs.core.ApplicationConfig at deploy time.
2.1) I am compiling with Netbeans and the ApplicationConfig.class is not part of the 1.1 version of the JAX-RS api jsr311-api-1.1.jar I'm using at compile time. The implementation of the library was changed since 0.8 version, which I was using before, but I had to upgrade the jar because it didn't include #FormParam. Until now, I had found a workaround using com.sun.jersey.api.representation.FormParam instead but Jersey is not compatible with JBoss as far as I understand.
Why is the server looking for ApplicationConfig while it's not used in the war?
2.2) I understood I had to use RESTEasy, and JBoss 4 does not include it, so have to install it manually. But the RESTEasy doc suggest that I thoroughly modify my project my adding a lot of jars, servlets etc. From my point of view, I simply need a RESTful implementation on the server libs to which my JAX-RS API, which is only an interface, will refer once the app is deployed. I may have some serious misconceptions about how Java EE libraries linking work. Please help.
So I know there are several different problems here but I couldn't manage to separate them. I have lost so much time on this that I'm worried for my project. Thanks in advance.
I am using Jersey 1.9 and it is generating my WADL perfectly except I need to redefine the resources base URI.
I'm running Jetty 7 sitting behind Apache using mod_proxy as a reverse proxy to route REST requests back to Jetty / Jersey. So Jersey generates the resources base URI as
http://localhost:8080/testRestAPI/rest/
when I need something like
http://mydomain.com/rest/
I found this from Google but it is not working: http://jersey.576304.n2.nabble.com/Changing-baseURI-when-generating-WADL-td6169703.html
unfortunately, you've found a bug in Jersey implementation. Please file a new issue as stated on mailing list - jira link: http://java.net/jira/browse/JERSEY
What you can do for now is downgrade to Jersey 1.8, which should not be affected by latest changes in this area. Thanks and sorry for inconvenience!
EDIT: issue link: http://java.net/jira/browse/JERSEY-773
it is already fixed, so you should be able to use this feature in Jersey 1.10-b02 and newer.
We're using Oracle 10g application server and deployed the Web service and trying to deploy the web service client. Server is working fine i.e.; marshalling is working fine. We're getting the output from the service properly but the search client is not unmarshalling (parsing) the response received. We're using all the tags under same name space so there is no name space problem. Different collections would exists in the XSD. Has anyone faced similar kind of issue? Is there any solution for this?
Thanks
Santhosh
Well... the issue was due to the library which was not running as expected in Java 1.5. We've developed the web service client with JAX-WS 2.2 which was running properly when running with Netbeans IDE 6.8 but not on the standalone server. We've downgraded the Netbeans and modified the libraries to JAX-WS 2.1. It worked...
Good to know. JAX-WS 2.2 is not compatible with Java 1.5