NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Firstcup JAX-RS shows error Cannot access WADL when I test it with Netbeans 7.0
Goto page Previous  1, 2
 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
kpenrose



Joined: 18 Jan 2012
Posts: 9

PostPosted: Wed Jan 25, 2012 4:19 pm    Post subject: RESTful webservice issue Reply with quote

Jeff, John,

I have tried to run the tutorial, exactly as is, using the derby db, etc. I am attaching a screenshot of what I get when I try to "test RESTful service".

Let me know what other information you (or John) need.



Test RESTful Web Services-110444.png
 Description:
Screenshot of RESTful webservice test
 Filesize:  33.62 KB
 Viewed:  12299 Time(s)

Test RESTful Web Services-110444.png


Back to top
JeffRubinoff



Joined: 03 Dec 2008
Posts: 70
Location: Prague

PostPosted: Wed Jan 25, 2012 4:39 pm    Post subject: Reply with quote

And what does the server output show?
Back to top
kpenrose



Joined: 18 Jan 2012
Posts: 9

PostPosted: Wed Jan 25, 2012 9:20 pm    Post subject: Reply with quote

Jeff,

You mean in the server log? Looks like a normal deployment:

INFO: GlassFish Server Open Source Edition 3.1.1 (12) startup time : Felix (20,707ms), startup services(63,022ms), total(83,729ms)
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://eagle:21096/jndi/rmi://eagle:21096/jmxrmi
INFO: WEB0169: Created HTTP listener [http-listener-1] on host/port [0.0.0.0:21090]
INFO: Grizzly Framework 1.9.36 started in: 16ms - bound to [0.0.0.0:21090]
INFO: WEB0169: Created HTTP listener [http-listener-2] on host/port [0.0.0.0:21091]
INFO: Grizzly Framework 1.9.36 started in: 11ms - bound to [0.0.0.0:21091]
INFO: Portable JNDI names for EJB DiscountCodeFacadeREST : [java:global/CustomerDB/DiscountCodeFacadeREST, java:global/CustomerDB/DiscountCodeFacadeREST!service.DiscountCodeFacadeREST]
INFO: Portable JNDI names for EJB MicroMarketFacadeREST : [java:global/CustomerDB/MicroMarketFacadeREST!service.MicroMarketFacadeREST, java:global/CustomerDB/MicroMarketFacadeREST]
INFO: Portable JNDI names for EJB CustomerFacadeREST : [java:global/CustomerDB/CustomerFacadeREST!service.CustomerFacadeREST, java:global/CustomerDB/CustomerFacadeREST]
INFO: Registering the Jersey servlet application, named org.netbeans.rest.application.config.ApplicationConfig, at the servlet mapping, /resources/*, with the Application class of the same name
INFO: WEB0671: Loading application [CustomerDB] at [/CustomerDB]
INFO: CustomerDB was successfully deployed in 6,089 milliseconds.
INFO: Domain Pinged: stable.glassfish.org
Back to top
kpenrose



Joined: 18 Jan 2012
Posts: 9

PostPosted: Fri Feb 03, 2012 8:09 pm    Post subject: Reply with quote

Where'd everyone go? I was enjoying the personal attention, and just when we were getting to the crux of the issue - poof.
Back to top
TimMc



Joined: 22 Feb 2012
Posts: 1
Location: Australia

PostPosted: Wed Feb 22, 2012 4:38 am    Post subject: Same Issue Reply with quote

@OP: I also used the Your First Cup - Coding the DukesAgeResource Example Application tutorial from Oracle and experienced the same issue.


Here's the step (i.e. 12) in the tutorial that appears to uncover the issue:


  1. Select the dukes-age project in the Projects tab.
  2. From the File menu, choose New File.
  3. In the Categories pane, select Web Services.
  4. In the File Types pane, select RESTful Web Services From Patterns.
  5. Click Next.
  6. Under Select Pattern, select Simple Root Resource and click Next.
  7. In the Resource Package field, type firstcup.webservice.
  8. In the Path field, type dukesAge.
  9. In the Class Name field, type DukesAgeResource.
  10. From the MIME Type menu, select text/plain.
  11. Click Finish.
  12. In the REST Resources Configuration dialog, uncheck Add Jersey Library and click OK.


An exception is thrown when you complete the last step (i.e. Build/Run):

http://localhost:8080/DukesAgeService/resources/dukesAge

Code:
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: PWC1391: Servlet.init() for servlet org.netbeans.rest.application.config.ApplicationConfig threw exception
root cause

com.sun.jersey.spi.inject.Errors$ErrorMessagesException
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.1 logs.


Extract from GlassFish Server Open Source Edition 3.1.1 log:
Code:

...
INFO: Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:17 PM'
INFO: Instantiated the Application class org.netbeans.rest.application.config.ApplicationConfig. The following root resource and provider classes are registered: [class firstcup.webservice.DukesAgeResource, class org.codehaus.jackson.jaxrs.JacksonJsonProvider, class org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider, class org.codehaus.jackson.jaxrs.JsonParseExceptionMapper, class org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper, class com.sun.jersey.oauth.server.api.providers.DefaultOAuthProvider, class com.sun.jersey.oauth.server.api.resources.RequestTokenRequest, class com.sun.jersey.oauth.server.api.resources.AccessTokenRequest]
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.spi.OAuthProvider com.sun.jersey.oauth.server.api.resources.RequestTokenRequest.provider
  SEVERE: Missing dependency for field: private com.sun.jersey.oauth.server.spi.OAuthProvider com.sun.jersey.oauth.server.api.resources.AccessTokenRequest.provider
SEVERE: WebModule[/DukesAgeService]StandardWrapper.Throwable
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
...
WARNING: StandardWrapperValve[org.netbeans.rest.application.config.ApplicationConfig]: PWC1382: Allocate exception for servlet org.netbeans.rest.application.config.ApplicationConfig
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
...
WARNING: StandardWrapperValve[org.netbeans.rest.application.config.ApplicationConfig]: PWC1406: Servlet.service() for servlet org.netbeans.rest.application.config.ApplicationConfig threw exception
java.lang.NullPointerException
...




Workaround
As mentioned by some other users, it appears as though this issue is caused when you generate a subclass of javax.ws.rs.core.Application. The alernative of generating a web.xml will work.

At Step 12 you can simply change your preferences:

Code:
REST Resources Configuration:

[ ] NetBeans will generate a subclass of javax.ws.rs.core.Application, all REST resources will be registered by this class automatically(JavaEE 6).
[ ] User is responsible for REST resource registration, e.g. by implementing a specific subclass of javax.ws.rs.core.Application, or by registering a specific servley adaptor in web.xml.
[x] Create default Jersey REST servlet adaptor in web.xml.

[x] Add Jersey library (JAX-RS referency implementation) to project classpath.



Question: Can anyone else reproduce the issue?


Tim.
Back to top
informatik01



Joined: 24 Feb 2012
Posts: 1
Location: Estonia

PostPosted: Fri Feb 24, 2012 1:52 pm    Post subject: Reply with quote

@TimMc
Thanks for pointing out the workaround Smile

I too encountered the above mentioned issue while following the "First cup" tutorial.

I wonder why this happened at all, and why there was no mentioning about such an issue in the tutorial.
It happens that one just SHOULD LEAVE the "Add Jersey Library" checked and all works just fine, even if you go with the first option "NetBeans will generate a subclass of javax.ws.rs.core.Application, ...".

I am just learning Java EE and such suprises are not pleasant.
I think it would be much better if there were no IDE usage in the tutorial, so you could learn to do all necessary things by hand in the first place, and only then use an IDE.
Back to top
CMUboy



Joined: 31 May 2012
Posts: 1

PostPosted: Thu May 31, 2012 5:57 am    Post subject: Reply with quote

The problem is that the version of Jersey included in the NetBeans IDE is incompatible with the version of Jersey on the GlassFish Server. The classes are compiled with one version, yet deployed to a Server using another version.

The solution is to include the version of Jersey included with the GlassFish Server in the class path so the classes are compiled with the same version as the one on the Server.
Back to top
lexz



Joined: 06 Jun 2012
Posts: 1

PostPosted: Wed Jun 06, 2012 1:46 pm    Post subject: Reply with quote

Ran into the same problem. Actually deselected it, but somehow it still was added.
To get it working i just had to remove the library from the project:

Quote:
Right-Click on Project..
Properties
Choose the Libraries-Category
Remove the Compile-time Library Jersey
Back to top
powertomato



Joined: 10 Jun 2012
Posts: 1

PostPosted: Sun Jun 10, 2012 1:03 am    Post subject: Reply with quote

lexz wrote:
Ran into the same problem. Actually deselected it, but somehow it still was added.
To get it working i just had to remove the library from the project:

Quote:
Right-Click on Project..
Properties
Choose the Libraries-Category
Remove the Compile-time Library Jersey



Thanks so much. It solved my 500 problem.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo