jawann jefferson

Greenhorn
+ Follow
since Mar 06, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jawann jefferson

Ok Update:

I think something is happening. I commented out pretty much all my web.xml file only leaving "displayname" active.
I created a wrapper class for the service:

RestEasyWrapper



Now the server will start but I'm still getting a 404 error.
Now, when I add /service to the Url a different window pops up (looks like ie) and i get another 404 error. But i get an error in the console now

[http-bio-8080-exec-8] ERROR org.jboss.resteasy.core.ExceptionHandler - failed to execute
javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/HibEx1/service
at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73)
at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444)
at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
[http-bio-8080-exec-10] ERROR org.jboss.resteasy.core.ExceptionHandler - failed to execute


and this after i add /getEmployees

javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/HibEx1/service/getEmployees
at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73)
at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444)
at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)



9 years ago
This are all of my Maven dependecies



This is my redone web.xml


Here is a snapshot of all my dependencies



I checked and for the restful project i do have all the dependencies that he has in his file. As for the my old REST project I was not using RESTeasy like he his. So i believe they would be different.
Also Maven has all of the dependencies and there is nothing in my WebInf/lib file. Should there be?
For my old project i was using Jersey. I could post those if it would help.
9 years ago
I've only developed them through other REST tutorials. Which I got to work so i figured, hey, why not try to connect the two ya know?

Thank you for helping me with this. I really appreciate your time.
9 years ago
Here's the link for the original Hibernate tutorial i followed which worked.
hibernate


This is the youtube link i am using to try to connect it with RESTful services
youtube link
9 years ago
Also, I was able to check the server location but there wasn't any radio button that would allow me to customize the setting.
9 years ago
this is my web.xml


hibernate.cgf.xml


employee.hbm.xml



9 years ago
In my catalina log i have this:

INFO: Deploying web application archive C:\ApacheTomcat\apache-tomcat-7.0.59\webapps\HibEx1.war
Mar 24, 2015 8:17:18 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive C:\ApacheTomcat\apache-tomcat-7.0.59\webapps\HibEx1.war has finished in 427 ms
Mar 24, 2015 8:17:18 AM org.apache.catalina.startup.HostConfig deployDirectory

During startup in eclipse i do not see anything with where the words "bind" is used or anything that says starting service.
9 years ago
Thank you for your reply,

Yes I tried both of those links and they did not work. I am not sure what you mean by publish. I have deployed the project to the Tomcat server through eclipse Luna and also through creating a WAR file and copying it to the Webapps folder in Tomcat. Is there something i missed?
9 years ago
Hi ya'll,

I hope this is any easy one. I don't seem to be hitting my RESTful webservices. I am using Hibernate and checked and all my entity classes are working. I've even retrieved data from the database but I cannot hit the web service. I am using Tomcat 7 and Eclipse IDE.

here's my pom


here's my service


I have a web xml but there is really nothing in it. The url i am wanting to hit is http://localhost:8080/HibEx1/service/getEmployees. Is th a correct URL?
Any help would be appreciated. I also tried changing my Path to "/service" and that did not work either. I am getting a Http Status 404 "The requested resource is not available.
Thanks

9 years ago
Thanks Tim for your reply. These are the only 2 classes that are in the web app.

UserServices.java:
package com.service.user;

import javax.ws.rs.*;

//Resource class because the class is annotated with "PATH"
@Path("/user/service")
public class UserServices {
@PUT
@Path("/create")
public void createUser(){
System.out.println("Inside createUser method");

}
//Normal resource methods
@GET
public void getUser(){
System.out.println("Inside getUser method");
}


@POST
public void updateUser(){

}
@DELETE
public void deleteUser(){

}

//Sub resource locator method
//No annotations but can have direct path annotation
//Returns instance of another resource class
@Path("/special")
public SpecialUser getSpecialUser(){
return new SpecialUser();
}
}


and SpeciaUser.java:
package com.service.user;

import javax.ws.rs.GET;
import javax.ws.rs.PUT;

public class SpecialUser {

@PUT
public void createSepcialUser()
{

}

@GET
public void getSpecialUser() {

}

}


I am trying to run it in Eclipse Luna from a Dynamic Web Application project. Should I maybe change it to a different type of project?
9 years ago
Hi,

I am trying to run a pretty simple web service and i keep getting this error:

SEVERE: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"]
java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:307)
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:482)
at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:795)
at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:532)
at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:859)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)

Does anyone know what this means and how i can fix it? I tried launching through Eclipse Luna and got the error. Then i tried just deploying it to Tomcat then running it from there and got the same error.

thanks
9 years ago
Hi all,

I am currently trying to make an app. All I want it to do is query a database for information and display that information. Seems pretty simple right? Not if you are new to web services. :-/. What I am trying to do is use RetroFit to make that call since it does all the json parsing and puts it in a nice POJO for you. What i can't figure out is how to query the database using the Retrofit library.

Retrofit has a Query command but i am not sure if thats what i am looking for. I've looked at ton of tutorials on youtube and read online but i can't seem to get a straight answer. It could also be my lack of knowledge on the subject as well.

I've created the interface:
public interface LanIscAPI {

@GET("/feed/lanisc.json")
public void getFeed(Callback<List<DataObjects>> response);

Here is my implementation
private void requestData(String uri)
{

//RestAdapter is included in the RetroFit Lib
//We are goin to instantiate the object and pass in ENDPOINT constant then call the build method
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(ENDPOINT).build();
LanIscAPI api = adapter.create(LanIscAPI.class); //Passing in class property of API interface
//defines where my web service is and how i want to call it. Bring in API interface you defined

api.getFeed(new Callback<List<DataObjects>>() { //Callback saying it is going to return a list of our dataobjects


//Retrofit does everything. Handles Async processing, Retrieves content from webservice which starts as a string
//It parses it as JSON and transforms it to list of objects (arg0)


@Override
public void success(List<DataObjects> arg0, Response arg1) {
// TODO Auto-generated method stub

dataList = arg0; //Since retrofit transforms our data all we need to do it place it in the list
updateDisplay();

}

@Override
public void failure(RetrofitError arg0) {
// TODO Auto-generated method stub

}
});


}

I ask that you please be patient with me as i am learning all of this for the first time. Sorry for all the comments. i use the comments to help me understand what is going on.

thanks
9 years ago
Thanks for the great help. I did have to take another look at my condition logic. Instead of || i had to use &&. My conditions were constantly showing as true for the OR statement.
thanks a lot
11 years ago
I'm having an issue with the equals.IgnoreCase() method in comparing strings. Heres the code:

System.out.println("\nPlease enter gender. 'M' for male and 'F' for female: ");
gender = input.next();

while(!gender.equalsIgnoreCase("M") || !gender.equalsIgnoreCase("F"))
{
System.out.println("\nInvalid gender. Please re-enter: ");
gender = input.next();

}

Its supposed to compare the the gender input to M or F and while it is neither of them ask the user to re-enter. It seems like it should work with the ! operator out front saying if gender is not equal to M or not equal to F then check. Problem i am getting is no matter what i enter it says it is invalid and stays in the loop forever.
11 years ago
Ok here's my new code. I deleted all that onCreate stuff cause i didn't need it but now i'm getting a new error


for GenderSpinner(this); i'm getting "Syntax error on token "this", ( expected after this token". Not sure why. I tried R.layout.patientformfragment (name of fragment it is in) and got the same error. I also tried admissionshome (name of activity it is in) and still got the same error
12 years ago