Hi Jeff,
1.0.2 is the version of the plug-in. The plug-in only supports Jersey
1.0.
Note that Jersey 1.0.2 has not been released yet :-) which is why you
get the error you are observing.
Incidentally I need to remove the @Provider declarations on the
multipart providers so they do not get picked up by the application
(i need to fix another bug before such infrastructure providers can
have @Provider on them).
Paul.
On Jan 26, 2009, at 7:58 PM, Jeff Schmidt wrote:
> Paul, Jakub:
>
> Before I submit an issue, I did a little more digging into Netbeans
> and saw a couple of interesting things. First, in Tools->Plugins-
> >Installed, for "RESTful Web Services" it says Version 1.0.2:
>
>
> <Picture 5.png>
>
> Does this indicate the version of the plug-in itself, or the
> version of Jersey it provides? If the latter, then I guess 1.0.2
> will work for me. When I remove the 1.0.1 based library I created
> and simply add the plugin's Jersey 1.0 library, it does not give
> any indication these are 1.0.2 libraries. I guess Netbeans shows
> only the major.minor revision numbers. Do I in realty have the
> 1.0.2 jars? I'm not sure what changed from 1.0.1 to easily verify.
>
> <Picture 8.png>
>
> Note the separate jersey-multipart-1.0.2-SNAPSHOT.jar. When I had
> all of the 1.0.1 files associated with this project, I had also
> added jersey-multippart-1.0.1.jar and things seemed fine. When I
> removed the 1.0.1 libraries and went with the REST plugins
> libraries, I got the following exception when starting up GlassFish
> V2. I thought that if plugin does provide 1.0.2 libraries, then
> perhaps I need jersey-multipart-1.0.2 as well. But, that did not help.
>
> Scanning for root resource and provider classes in the paths:
> /Users/jas/netbeans/jax-rs-1.0.1-test/Jersey-1.0.1-test/build/web/
> WEB-INF/lib
> /Users/jas/netbeans/jax-rs-1.0.1-test/Jersey-1.0.1-test/build/web/
> WEB-INF/classes
> Root resource classes found:
> class com.ingenuity.ipaws.rest.resource.AnalysesResource
> Provider classes found:
> class com.sun.jersey.multipart.impl.MultiPartWriter
> class com.sun.jersey.multipart.impl.MultiPartReader
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0
> (Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance
> (NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
> (DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance
> (Constructor.java:494)
> at com.sun.jersey.impl.application.WebApplicationImpl
> $DefaultComponentProvider.getInstance(WebApplicationImpl.java:437)
> at
> com.sun.jersey.impl.application.ComponentProviderCache.getComponent
> (ComponentProviderCache.java:187)
> at
> com.sun.jersey.impl.application.ComponentProviderCache.getProvidersAnd
> Services(ComponentProviderCache.java:122)
> at
> com.sun.jersey.impl.application.MessageBodyFactory.getProviderMap
> (MessageBodyFactory.java:133)
> at
> com.sun.jersey.impl.application.MessageBodyFactory.initReaders
> (MessageBodyFactory.java:107)
> at com.sun.jersey.impl.application.MessageBodyFactory.init
> (MessageBodyFactory.java:102)
> at
> com.sun.jersey.impl.application.WebApplicationImpl.initiate
> (WebApplicationImpl.java:642)
> at
> com.sun.jersey.impl.application.WebApplicationImpl.initiate
> (WebApplicationImpl.java:487)
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.initiate
> (ServletContainer.java:622)
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.load
> (ServletContainer.java:538)
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.init
> (ServletContainer.java:197)
> at org.apache.catalina.core.StandardWrapper.loadServlet
> (StandardWrapper.java:1178)
> at org.apache.catalina.core.StandardWrapper.load
> (StandardWrapper.java:1007)
> at org.apache.catalina.core.StandardContext.loadOnStartup
> (StandardContext.java:4808)
> at org.apache.catalina.core.StandardContext.start
> (StandardContext.java:5196)
> at com.sun.enterprise.web.WebModule.start(WebModule.java:326)
> at com.sun.enterprise.web.LifecycleStarter.doRun
> (LifecycleStarter.java:58)
> at com.sun.appserv.management.util.misc.RunnableBase.runSync
> (RunnableBase.java:304)
> at com.sun.appserv.management.util.misc.RunnableBase.run
> (RunnableBase.java:341)
> at java.util.concurrent.Executors$RunnableAdapter.call
> (Executors.java:417)
> at java.util.concurrent.FutureTask$Sync.innerRun
> (FutureTask.java:269)
> at java.util.concurrent.FutureTask.run(FutureTask.java:123)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:650)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:675)
> at java.lang.Thread.run(Thread.java:613)
> Caused by: java.lang.IllegalArgumentException: The MultiPartConfig
> instance we expected is not present. Have you registered the
> MultiPartConfigProvider class?
> at com.sun.jersey.multipart.impl.MultiPartReader.<init>
> (MultiPartReader.java:83)
> ... 29 more
> null
> SMGT0007: Self Management Rules service is enabled
>
> I'll keep looking into that. But, if I'm mistaken about the proper
> Jersey version in the current Netbeans plugin, please let me know.
>
> Cheers,
>
> Jeff
>
> On Jan 26, 2009, at 2:49 AM, Paul Sandoz wrote:
>
>>
>> On Jan 26, 2009, at 10:32 AM, Jakub Podlesak wrote:
>>
>>>
>>> Hi Jeff,
>>>
>>> would you be so kind and enter an issue at netbeans issuezilla [1],
>>> with [rest] as a subcomponent. If netbeans plugin adds the other
>>> jersey
>>> jars, it definitely seems as a bug to me.
>>>
>>
>> Yes, i agree.
>>
>> Paul.
>>
>>> ~Jakub
>>>
>>> [1]http://www.netbeans.org/issues/enter_bug.cgi?component=websvc
>>>
>>> On Fri, Jan 23, 2009 at 09:15:30AM -0700, Jeff Schmidt wrote:
>>>> Hi Paul:
>>>>
>>>> Thanks a lot for your suggestions. Trying this process yet again
>>>> from
>>>> scratch, I was able to create the Netbeans library with the
>>>> 1.0.1 jars and
>>>> actually got the project to run. :) Yeah. Unfortunately, this only
>>>> partially works with the Netbeans/JAX-RS integration. That is,
>>>> if I go and
>>>> create a new resource using the Container/Item pattern, then all
>>>> the 1.0
>>>> jars get added to the project. Then I end up with both 1.0 and
>>>> 1.0.1.
>>>> Perhaps I did not delete all of those 1.0 jars last time?
>>>>
>>>> If I remove all of the 1.0 jars, then the project will run
>>>> again. So, I
>>>> guess if I make use of the Netbeans 6.5 JAX-RS integration
>>>> features, if I
>>>> then go and delete the added 1.0 libraries, this might work out
>>>> fine,
>>>> though kind of clumsily.
>>>>
>>>> I realize this is not a Netbeans forum, but I figure there are a
>>>> lot of
>>>> Netbeans users out there working with JAX-RS/Jersey projects,
>>>> encountering
>>>> the same issues. I can live with the current arrangement, but
>>>> I'm just
>>>> curious how Netbeans will adopt new Jersey releases in the
>>>> future. Will
>>>> this be via the Netbeans update process? I won't need to
>>>> typically be on
>>>> the bleeding edge of Jersey releases, but even then it does not
>>>> look like
>>>> official Netbeans will be keeping up.
>>>>
>>>> Thanks!
>>>>
>>>> Jeff
>>>>
>>>> On Jan 23, 2009, at 6:00 AM, Paul Sandoz wrote:
>>>>
>>>>>
>>>>> On Jan 23, 2009, at 1:55 PM, Paul Sandoz wrote:
>>>>>
>>>>>>
>>>>>> On Jan 22, 2009, at 3:35 PM, Jeff Schmidt wrote:
>>>>>>
>>>>>>> Hi Jakub:
>>>>>>>
>>>>>>> I too am having the problem with the InstantiationException and
>>>>>>> JSONListElementProvider when I try to use the Jersey 1.0.1
>>>>>>> jars in
>>>>>>> Netbeans 6.5. I really need to start working with Craig's
>>>>>>> multipart API
>>>>>>> and I see it is included in 1.0.1. Jersey 1.0 is what is
>>>>>>> available in
>>>>>>> Netbeans 6.5. I tried to update Jersey by creating a new
>>>>>>> library in
>>>>>>> Netbeans and included the following jar files, which I
>>>>>>> basically got
>>>>>>> from the Jersey 1.0.1 dependencies page.
>>>>>>>
>>>>>>> ./asm-3.1.jar
>>>>>>> ./grizzly-servlet-webserver-1.8.6.3.jar
>>>>>>> ./http-20070405.jar
>>>>>>> ./jaxb-api-2.1.jar
>>>>>>> ./jaxb-impl-2.1.jar
>>>>>>> ./jaxb-xjc.jar
>>>>>>> ./jdom-1.0.jar
>>>>>>> ./jersey-atom-1.0.1.jar
>>>>>>> ./jersey-core-1.0.1.jar
>>>>>>> ./jersey-fastinfoset-1.0.1.jar
>>>>>>> ./jersey-json-1.0.1.jar
>>>>>>> ./jersey-server-1.0.1-javadoc.jar
>>>>>>> ./jersey-server-1.0.1.jar
>>>>>>> ./jettison-1.0.1.jar
>>>>>>> ./jsr173-api-1.0.jar
>>>>>>> ./jsr311-api-1.0.jar
>>>>>>> ./rome-0.9.jar
>>>>>>> ./stax-api-1.0-2.jar
>>>>>>>
>>>>>>> When starting up the app server (Tomcat or Glassfish) I get
>>>>>>> several:
>>>>>>>
>>>>>>> The provider class, class
>>>>>>> com.sun.jersey.impl.provider.entity.JSONListElementProvider,
>>>>>>> could not
>>>>>>> be instantiated
>>>>>>
>>>>>> ^
>>>>>>
>>>>>> |
>>>>>> This is definitely a 1.0 class
>>>>>> because we
>>>>>> changed the package name to include
>>>>>> json after jersey.
>>>>>>
>>>>>> So, this confirms what i thought in my previous email: for
>>>>>> some reason
>>>>>> there are still Jersey 1.0 jars hanging around in the class path.
>>>>>>
>>>>>
>>>>> Grrr... sigh... tired today... what i wrote above is not
>>>>> correct (that
>>>>> package name changed in 1.0.2), but there is still some issue
>>>>> related to
>>>>> this in the difference between 1.0 and 1.0.1, namely Jersey 1.0
>>>>> seems to
>>>>> be still around and is trying to use jersey 1.0.1.
>>>>>
>>>>> Paul.
>>>>>
>>>>>
>>>>>> Paul.
>>>>>>
>>>>>>>
>>>>>>> java.lang.InstantiationException:
>>>>>>> com.sun.jersey.impl.provider.entity.JSONListElementProvider
>>>>>>>
>>>>>>> Browsing jersey-json-1.0.1.jar within Netbeans, I can see
>>>>>>> that class is
>>>>>>> abstract.
>>>>>>>
>>>>>>> When I tried the sample customer DB app as you suggested
>>>>>>> below, it
>>>>>>> worked just fine using the stock Jersey 1.0 library.
>>>>>>>
>>>>>>> What is the proper combination of jar files one uses to
>>>>>>> create a library
>>>>>>> in Netbeans 6.5 that will allow me to use the IDE to develop
>>>>>>> using
>>>>>>> Jersey 1.0.1?
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> Jeff
>>>>>>>
>>>>>>>
>>>>>>> On Jan 19, 2009, at 8:38 AM, Jakub Podlesak wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> Hello Eric,
>>>>>>>>
>>>>>>>> On Sun, Jan 18, 2009 at 10:12:55AM -0600, Marsh Eric wrote:
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I'm developing an iPhone application that needs to pass
>>>>>>>>> information
>>>>>>>>> between
>>>>>>>>> the iPhone and a remote database. Using web services seemed
>>>>>>>>> to be a
>>>>>>>>> good
>>>>>>>>> strategy so I downloaded the latest version of Netbeans,
>>>>>>>>> spent a day
>>>>>>>>> or two
>>>>>>>>> reading and working through the web services examples.
>>>>>>>>> Doing some web
>>>>>>>>> searches I found that most iPhone developers are using JSON
>>>>>>>>> so I
>>>>>>>>> downloaded
>>>>>>>>> an iPhone JSON library and went to work at developing a
>>>>>>>>> communications
>>>>>>>>> channel between the remote device and the database.
>>>>>>>>>
>>>>>>>>> I don't know if it makes any difference but I'm developing
>>>>>>>>> on a Mac.
>>>>>>>>>
>>>>>>>>> First of all, when I tried to deploy I was getting some
>>>>>>>>> errors related
>>>>>>>>> to
>>>>>>>>> JSON. They are:
>>>>>>>>>
>>>>>>>>> SEVERE: The provider class, class
>>>>>>>>> com.sun.jersey.impl.provider.entity.JSONJAXBElementProvider, c
>>>>>>>>> ould not
>>>>>>>>> be
>>>>>>>>> instantiated
>>>>>>>>> SEVERE: The provider class, class
>>>>>>>>> com.sun.jersey.impl.provider.entity.JSONListElementProvider, c
>>>>>>>>> ould not
>>>>>>>>> be
>>>>>>>>> instantiated
>>>>>>>>> SEVERE: The provider class, class
>>>>>>>>> com.sun.jersey.impl.provider.entity.JSONRootElementProvider, c
>>>>>>>>> ould not
>>>>>>>>> be
>>>>>>>>> instantiated
>>>>>>>>>
>>>>>>>>> I thought that I'd go back and look at those problems later
>>>>>>>>> as the app
>>>>>>>>> did
>>>>>>>>> seem to deploy even with the errors.
>>>>>>>>
>>>>>>>> I would recommend you to try resolve the above errors in the
>>>>>>>> first
>>>>>>>> place
>>>>>>>> as it seems something is wrong with your configuration.
>>>>>>>> Are you using the latest NetBeans 6.5? If so,
>>>>>>>> could you try to create a new project with:
>>>>>>>> [New Project]->[Samples]->[WebServices]->[Customer Database
>>>>>>>> (RESTful)]
>>>>>>>> then try to deploy. Same errors?
>>>>>>>> Then please try to submit a new bug report against NetBeans
>>>>>>>> RESTful WS
>>>>>>>> plugin at [1]
>>>>>>>> Another thing you may try is to run your NetBeans with a
>>>>>>>> fresh userdir.
>>>>>>>> Then you need to use --userdir rest-app-nbdir command line
>>>>>>>> option.
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> It wasn't too tough getting the database to talk to the
>>>>>>>>> iPhone.
>>>>>>>>> However
>>>>>>>>> I've spent something like a week and a half trying to get the
>>>>>>>>> communications to work going the other way. Initially when
>>>>>>>>> I was
>>>>>>>>> getting
>>>>>>>>> errors and exceptions I thought that my problem was that I
>>>>>>>>> simply
>>>>>>>>> didn't
>>>>>>>>> understand the JSON protocol. Consequently I stopped trying
>>>>>>>>> to get the
>>>>>>>>> iPhone to talk to the web services and started to
>>>>>>>>> experiment with the
>>>>>>>>> netbeans "Test RESTful web services" web interface. I would
>>>>>>>>> do a get
>>>>>>>>> to
>>>>>>>>> grab some data from my database, tweak the results and try
>>>>>>>>> to POST
>>>>>>>>> them
>>>>>>>>> back to the database. I could never get this to work. I had
>>>>>>>>> a number
>>>>>>>>> of
>>>>>>>>
>>>>>>>> The simplest test scenario to try out here is to
>>>>>>>>
>>>>>>>> - GET some data from a particular containee resource
>>>>>>>> - POST the very same *unchanged* data to the corresponding
>>>>>>>> container
>>>>>>>> resource
>>>>>>>>
>>>>>>>> Then, you should get something like
>>>>>>>> Entity already exists exception (coming from db layer)
>>>>>>>> Which in fact means, you entity gets unmarshalled all right.
>>>>>>>> Could you please try out something similar (without touching
>>>>>>>> the data)
>>>>>>>> at your application?
>>>>>>>>
>>>>>>>>
>>>>>>>>> returned error codes depending on what I would try to POST
>>>>>>>>> but I
>>>>>>>>> finally
>>>>>>>>> focused on the fact that I was getting messages similar to the
>>>>>>>>> following:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> javax.ws.rs.WebApplicationException:
>>>>>>>>> javax.xml.bind.UnmarshalException
>>>>>>>>> -
>>>>>>>>> with linked exception: [org.xml.sax.SAXParseException:
>>>>>>>>> Content is not
>>>>>>>>> allowed in prolog.] at
>>>>>>>>> converter.UriResolver.resolve(UriResolver.java:81)
>>>>>>>>>
>>>>>>>>> I've been doing some reading and it appears that in Jersey
>>>>>>>>> JSON is
>>>>>>>>> layered
>>>>>>>>> over XML. Since this exception appears to be coming from
>>>>>>>>> the XML layer
>>>>>>>>> it
>>>>>>>>> looks like I would have to step through the Jersey source
>>>>>>>>> to figure
>>>>>>>>> out
>>>>>>>>> what's going on. I suspect that the problem is related to the
>>>>>>>>> exceptions
>>>>>>>>> that were happening on deployment that I cited earlier.
>>>>>>>>>
>>>>>>>>
>>>>>>>> I suspect that is the case. If the customer db application
>>>>>>>> works for
>>>>>>>> you,
>>>>>>>> you might want to check, you web app uses the same jersey
>>>>>>>> related
>>>>>>>> libraries.
>>>>>>>> (Please make sure you do not mix jersey jar versions)
>>>>>>>>
>>>>>>>> If none of the above helps, would you be able to send out
>>>>>>>> your project
>>>>>>>> files so that i could have a closer look?
>>>>>>>>
>>>>>>>> ~Jakub
>>>>>>>>
>>>>>>>> [1]http://www.netbeans.org/community/issues.html
>>>>>>>>
>>>>>>>>> I downloaded the source so that I could build and debug in
>>>>>>>>> the Jersey
>>>>>>>>> and
>>>>>>>>> Grizzly layers. This took a couple of hours. To my surprise
>>>>>>>>> there was
>>>>>>>>> a
>>>>>>>>> couple of places where the source wouldn't build as
>>>>>>>>> downloaded. One is
>>>>>>>>> in
>>>>>>>>> ContainerResponse.java where the compiler complained that
>>>>>>>>> at line 216
>>>>>>>>> it
>>>>>>>>> couldn't find getMessageBodyWriterMediaTypes. Another
>>>>>>>>> problem is at
>>>>>>>>> line
>>>>>>>>> 292 in BasicVali dator.java where it couldn't find
>>>>>>>>> ERROR_SUBRES_LOC_HAS_ENTITY_PARAM. I did some quick hacks
>>>>>>>>> just to get
>>>>>>>>> the
>>>>>>>>> application to build. However it wouldn't deploy and at
>>>>>>>>> that point I
>>>>>>>>> decided that I'd just spent too much time on this and
>>>>>>>>> decided to yell
>>>>>>>>> for
>>>>>>>>> help.
>>>>>>>>>
>>>>>>>>> I'd really like to be able to use Glassfish, Netbeans and
>>>>>>>>> Jersey but I
>>>>>>>>> really seem to be stuck. If I can't get this to fly I may
>>>>>>>>> have to
>>>>>>>>> backtrack
>>>>>>>>> and do something entirely different. It doesn't appear that
>>>>>>>>> I can do a
>>>>>>>>> remote database connection from the iPhone so web services
>>>>>>>>> looks like
>>>>>>>>> the
>>>>>>>>> best solution. The problem appears to be at the server end,
>>>>>>>>> not the
>>>>>>>>> iPhone
>>>>>>>>> end anyway. I'm really kind of surprised that I've had so much
>>>>>>>>> trouble.
>>>>>>>>> Regardless, I need to break through this roadblock and get
>>>>>>>>> this app
>>>>>>>>> done.
>>>>>>>>>
>>>>>>>>> Suggestions or help anyone?
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------
>>>>>>>> ------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Jeff Schmidt
>>>>>>> 535 Consulting
>>>>>>> jas_at_535consulting.com
>>>>>>> (408) 205-7697
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
>
> --
> Jeff Schmidt
> 535 Consulting
> jas_at_535consulting.com
> (408) 205-7697
>
>
>
>