| View previous topic :: View next topic |
| Author |
Message |
egivler
Joined: 06 May 2011 Posts: 1
|
Posted: Fri May 06, 2011 4:33 pm Post subject: Firstcup JAX-RS shows error Cannot access WADL when I test it with Netbeans 7.0 |
|
|
I'm trying to follow along with the firstcup java tutorial that I downloaded from Oracle's site with the latest Netbeans 7.0 (which I downloaded with a bundled Glassfish 3.1)
When I test it, I get:
Cannot access WADL: Please restart your REST application, and refresh this page.
If you still see this error and if you are accessing this page using Firefox with Firebug plugin, then
you need to disable firebug for local files. That is from Firefox menubar, check
Tools > Firebug > Disable Firebug for Local Files
If I go to the RESTful Web Services node in Netbeans, and select REST Resources Configuration and switch it from the top selection (Netbeans will generate a subclass of javax.ws.rs.core.Applicaiton, all REST resources will be registered by this class automatically (Java EE 6)) to the last one (Create default REST servlet adapter in web.xml), then the test works fine.
I'm VERY new to all this, so it's probably a user error. If I try to hit the URL (http://localhost:8080/DukesAgeService/resources/dukesAge), directly, I get a 404 error. If I try to hit it with configuration #2 (the web.xml entry is there), it works fine.
I know something is deployed, since I see "Hello World!" when I go to: http://localhost:8080/DukesAgeService/.
The only thing that seemed out of place in the tutorial up to that point was a missing library (restlib-gfv3ee6.) on the project libraries tab.
Any help will be greatly appreciated. |
|
| Back to top |
|
 |
toto
Joined: 12 Jul 2011 Posts: 6
|
Posted: Mon Sep 19, 2011 4:57 pm Post subject: |
|
|
I had the same 404 problem. I don't understand much more than you, but I think that NetBeans "forgets" to create one configuration file. I got my web service working by copying from a sample project a file WEB-INF/web.xml as follows:
| Code: |
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>ServletAdaptor</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ServletAdaptor</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
</web-app>
|
|
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
Posted: Tue Sep 20, 2011 8:52 am Post subject: |
|
|
There is a known issue with GlassFish, see http://java.net/jira/browse/GLASSFISH-16118. It should be fixed in 3.1.1. Until it is fixed, you have to deploy EE6 RESTful WS to GlassFish with a deployment descriptor (web.xml) instead of a subclass of Application.
NetBeans does not "forget" to create the deployment descriptor. For EE6 services, NetBeans either creates a subclass of Application or creates web.xml, as you choose during service creation and as egivler noted. For EE5 services, web.xml is created automatically.[/url]
Last edited by JeffRubinoff on Tue Sep 20, 2011 9:04 am; edited 2 times in total |
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
Posted: Tue Sep 20, 2011 9:03 am Post subject: |
|
|
| I have tested this with a development build of NetBeans on GlassFish 3.1.1 final release and the bug is fixed. I successfully tested a RESTful service registered with a subclass of Application. |
|
| Back to top |
|
 |
kpenrose
Joined: 18 Jan 2012 Posts: 9
|
Posted: Wed Jan 18, 2012 8:19 pm Post subject: WADL not found |
|
|
| JeffRubinoff wrote: | | I have tested this with a development build of NetBeans on GlassFish 3.1.1 final release and the bug is fixed. I successfully tested a RESTful service registered with a subclass of Application. |
I have a new NB 7.1 install with glassfish 3.1.1, and I am still having the exact same problem. It doesn't appear to be fixed at all. I'm running everything on a Solaris 10 platform, and I am following the tutorial about create RESTful webservices with NB7.0. I am following the directions completely. The only difference is that I am using a Sybase ASE 15 database server. I have loaded the jconn3.jar file into my domain/lib. I can use the connection pool successfully, and I can create the RESTful entities from the database without any problem. When I then try to test the RESTful service I get the WADL not found, restart your web application and try again message.
To verify, I have created the same project on a Windows-based host and I get the same results. Brand new NB 7.1 install and GF 3.1.1. Cannot access WADL - restart application and try again.
It seems to be impossible to build a RESTful webservice with netbeans and glassfish.
Is the problem in NB or in glassfish? Even though I believe that I have the most recent versions of NB and glassfish, is there a way to check on this. |
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
Posted: Thu Jan 19, 2012 6:40 pm Post subject: |
|
|
kpenrose,
You are not the only person who builds RESTful web services in NetBeans 7.1 with GlassFish. I did not experience your problem when running the NetBeans Getting Started with RESTful Web Services tutorial, and we have not heard from anyone else with your problem.
Did you create a fresh userdir when you installed NB 7.1 or did you import settings from an earlier installation? If you imported settings, that may be your problem.
There might be a problem with the First Cup tutorial. I don't own this tutorial, Java EE guys do, so I have never tested it. I will go through it and report to that team if I find any problems. |
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
|
| Back to top |
|
 |
kpenrose
Joined: 18 Jan 2012 Posts: 9
|
Posted: Fri Jan 20, 2012 7:13 pm Post subject: |
|
|
JeffRubinoff-
I did import the 7.0.1 settings to 7.1. I've looked through the links on setting a new userdir - my problem is I'm on a unix system at work where I can't create a new user directory. Can I point userdir at any directory? |
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
Posted: Fri Jan 20, 2012 7:21 pm Post subject: |
|
|
| I'm not sure, I have no experience with alternate userdirs. I just delete or rename the old one and let NB generate a new one in the same folder. You can try. If NB doesn't remember which files or projects you had open, and you need to reinstall all plugins, you're using a fresh userdir. |
|
| Back to top |
|
 |
kpenrose
Joined: 18 Jan 2012 Posts: 9
|
Posted: Fri Jan 20, 2012 8:22 pm Post subject: |
|
|
JeffRubinoff,
I read a little further and found I could point the userdir anywhere, so I created a new userdir, built a brand new web project, created RESTful webservices from database, built, tried to test the RESTful service and I STILL get "Cannot access WADL" Please restart your RESTful application and refresh this page.
Do I need to do something on the glassfish side also? |
|
| Back to top |
|
 |
kpenrose
Joined: 18 Jan 2012 Posts: 9
|
Posted: Fri Jan 20, 2012 9:07 pm Post subject: |
|
|
Hi JeffRubinoff,
A couple of new developments. I tried creating a project pointing to different tables in the same database, and that did create the webservices correctly, to a point. In looking at the tutorial, where you are actually interacting with the CRUD aspect of the webservices - I don't have anything showing in the panel on the left to choose from. This is a fairly simple db schema with 3 tables - 2 of which contain foreign keys from the third. I can explicitly enter the entities.tablename in the URL and get the data back in XML format in the browser.
In the original project that I was trying to do, I still get the WADL missing message. But I noticed that right before that message is displayed, I see this error in the NB Glassfish server output window:
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for method public entities.TransCondRuleMap service.TransCondRuleMapFacadeREST.find(entities.TransCondRuleMapPK) at parameter at index 0
SEVERE: Method, public entities.TransCondRuleMap service.TransCondRuleMapFacadeREST.find(entities.TransCondRuleMapPK), annotated with GET of resource, class service.TransCondRuleMapFacadeREST, is not recognized as valid resource method.
SEVERE: Missing dependency for method public void service.TransCondRuleMapFacadeREST.remove(entities.TransCondRuleMapPK) at parameter at index 0
SEVERE: Method, public void service.TransCondRuleMapFacadeREST.remove(entities.TransCondRuleMapPK), annotated with DELETE of resource, class service.TransCondRuleMapFacadeREST, is not recognized as valid resource method.
SEVERE: WebModule[/TransformViewer]StandardWrapper.Throwable
So, it looks like something in the generation phase failed, but I don't know enough about what I'm doing (yet) to decipher this error message.
So, do you know where I should be looking to figure out why I don't get the web-based CRUD functionality that I'm looking for in the project that does work (sorta) and what might be wrong in the second project?
Thanks. |
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
Posted: Sat Jan 21, 2012 3:04 am Post subject: |
|
|
| You are outside of my expertise now. Looks like an entities issue and that might have to do with NB-Sybase communication. I'll try to alert some people who might help. |
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
Posted: Sat Jan 21, 2012 3:08 am Post subject: |
|
|
| Also, what is a TransCondRuleMap? You said you were following the tutorial and there are certainly no classes with that name in the tutorial. So is this something peculiar to the database you are using? |
|
| Back to top |
|
 |
kpenrose
Joined: 18 Jan 2012 Posts: 9
|
Posted: Tue Jan 24, 2012 2:36 pm Post subject: |
|
|
Jeff,
Sorry for the confusion; I'm following the steps in the tutorial, but replacing the database stuff with my database/tables. The TransCondRuleMap is a JPA mapping to a transform table I have in the db.
I've tried a couple of new things, but the results are always the same.
Just FYI: I am using a Sybase ASE 15 database, and using the jconn4.jar from the jConnect 7 libraries. |
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
Posted: Tue Jan 24, 2012 6:32 pm Post subject: |
|
|
John Yeary posted a reply but it seems to have been lost somehow, so I'm reposting.
| Quote: | Hello Kevin,
Jeff asked me to look at your messages. The exception snippet does not seem to contain enough information to determine what the issue could be. I use NB 7.0.1 and 7.1 to develop REST based services which connect to multiple data store types without any issue. In fact most of my code for performing REST based operations don't consist of more than 5-6 lines so they are really light methods. That is the way it should work.
The original post indicated that you were trying to do the tutorial that Jeff wrote and tested with some significant changes like the DB type (Sybase), and tables. Have you in fact tried to do the tutorial as shown and does it work? If the entities are JPA based entities, have you tried to perform CRUD operations from a basic Java application? I am sure that there is a simple explanation for the issue. What is the default media type you are returning?
We will get you on track.
John |
|
|
| Back to top |
|
 |
|