NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
kpenrose
Joined: 18 Jan 2012 Posts: 9
|
Posted: Wed Jan 25, 2012 4:19 pm Post subject: RESTful webservice issue |
|
|
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.
| Description: |
| Screenshot of RESTful webservice test |
|
| Filesize: |
33.62 KB |
| Viewed: |
8118 Time(s) |

|
|
|
| Back to top |
|
 |
JeffRubinoff
Joined: 03 Dec 2008 Posts: 70 Location: Prague
|
Posted: Wed Jan 25, 2012 4:39 pm Post subject: |
|
|
| And what does the server output show?
|
|
| Back to top |
|
 |
kpenrose
Joined: 18 Jan 2012 Posts: 9
|
Posted: Wed Jan 25, 2012 9:20 pm Post subject: |
|
|
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
|
Posted: Fri Feb 03, 2012 8:09 pm Post subject: |
|
|
| 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
|
Posted: Wed Feb 22, 2012 4:38 am Post subject: Same Issue |
|
|
@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:
- Select the dukes-age project in the Projects tab.
- From the File menu, choose New File.
- In the Categories pane, select Web Services.
- In the File Types pane, select RESTful Web Services From Patterns.
- Click Next.
- Under Select Pattern, select Simple Root Resource and click Next.
- In the Resource Package field, type firstcup.webservice.
- In the Path field, type dukesAge.
- In the Class Name field, type DukesAgeResource.
- From the MIME Type menu, select text/plain.
- Click Finish.
- 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
|
Posted: Fri Feb 24, 2012 1:52 pm Post subject: |
|
|
@TimMc
Thanks for pointing out the workaround
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
|
Posted: Thu May 31, 2012 5:57 am Post subject: |
|
|
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
|
Posted: Wed Jun 06, 2012 1:46 pm Post subject: |
|
|
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
|
Posted: Sun Jun 10, 2012 1:03 am Post subject: |
|
|
| 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 |
|
 |
|
|
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 can attach files in this forum You can download files in this forum
|
|