On Sep 1, 2010, at 2:01 PM, Morten wrote:
> Hi Poul
>
> Thanks for the response. My collegue tried Jersey's own build-in
> tests using mvn from the repository you pointed to and got a similar
> error.
All the time or only some of the time?
> Strangely, the service can be accessed from a browser without
> problems and even from jersey client in a non-test. Is it even
> remotely possible that this could be caused by a rare race condition
> in Jersey client or Java
The tests are not run in parallel. And the stack trace shows an issue
at socket creation so it is rather low-level.
> or do you think it is definitely a problem with the machine ?
>
What maven options are being used? it might be that the VM is running
out of memory.
Does the machine have a virus checker running that limits connections?
Paul.
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> 13.705 sec <<< FAILURE!
> testWebResources [felix]
> (com.sun.jersey.samples.helloworld.test.WebAppFelixTest) Time
> elapsed: 13.671 sec <<< ERROR!
> org.ops4j.pax.exam.spi.container.TestContainerException: Cannot get
> the remote bundle context
> at
> org
> .ops4j
> .pax
> .exam
> .rbc
> .client
> .RemoteBundleContextClient
> .getRemoteBundleContext(RemoteBundleContextClient.java:324)
> at
> org
> .ops4j
> .pax
> .exam
> .rbc
> .client
> .RemoteBundleContextClient
> .waitForState(RemoteBundleContextClient.java:265)
> at
> org
> .ops4j
> .pax
> .exam
> .container
> .def
> .internal
> .PaxRunnerTestContainer.waitForState(PaxRunnerTestContainer.java:317)
> at
> org
> .ops4j
> .pax
> .exam
> .container
> .def
> .internal.PaxRunnerTestContainer.start(PaxRunnerTestContainer.java:
> 272)
> at
> org
> .ops4j
> .pax
> .exam.junit.internal.JUnit4TestMethod.invoke(JUnit4TestMethod.java:
> 142)
> at
> org
> .junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:
> 105)
> at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:
> 86)
> at
> org
> .ops4j
> .pax
> .exam
> .junit
> .internal
> .JUnit4MethodRoadie
> .runBeforesThenTestThenAfters(JUnit4MethodRoadie.java:60)
> at
> org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
> at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
> at
> org
> .ops4j
> .pax
> .exam.junit.JUnit4TestRunner.invokeTestMethod(JUnit4TestRunner.java:
> 246)
> at
> org
> .ops4j
> .pax.exam.junit.JUnit4TestRunner.runMethods(JUnit4TestRunner.java:196)
> at org.ops4j.pax.exam.junit.JUnit4TestRunner
> $2.run(JUnit4TestRunner.java:186)
> at
> org
> .junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:
> 34)
> at
> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:
> 44)
> at
> org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:
> 182)
> at
> org
> .apache
> .maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> at
> org
> .apache
> .maven
> .surefire
> .suite
> .AbstractDirectoryTestSuite
> .executeTestSet(AbstractDirectoryTestSuite.java:140)
> at
> org
> .apache
> .maven
> .surefire
> .suite
> .AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:
> 165)
> at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org
> .apache
> .maven
> .surefire
> .booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
> at
> org
> .apache
> .maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1005)
> Caused by: java.rmi.ConnectIOException: Exception creating
> connection to: 192.168.2.1; nested exception is:
> java.net.SocketException: Cannot allocate memory
> at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:614)
> at
> sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
> at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:
> 184)
> at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
> at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
> at
> org
> .ops4j
> .pax
> .exam
> .rbc
> .client
> .RemoteBundleContextClient
> .getRemoteBundleContext(RemoteBundleContextClient.java:302)
> ... 25 more
> Caused by: java.net.SocketException: Cannot allocate memory
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
> 195)
> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
> at java.net.Socket.connect(Socket.java:529)
> at java.net.Socket.connect(Socket.java:478)
> at java.net.Socket.<init>(Socket.java:375)
> at java.net.Socket.<init>(Socket.java:189)
> at
> sun
> .rmi
> .transport
> .proxy
> .RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
> at
> sun
> .rmi
> .transport
> .proxy
> .RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
> at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
> ... 30 more
>
> --- Den man 30/8/10 skrev Paul Sandoz <Paul.Sandoz_at_oracle.com>:
>
>> Fra: Paul Sandoz <Paul.Sandoz_at_oracle.com>
>> Emne: Re: [Jersey] Help with strange jersey client "Cannot allocate
>> memory" exception?
>> Til: users_at_jersey.dev.java.net
>> Dato: mandag 30. august 2010 14.43
>>
>> On Aug 30, 2010, at 2:23 PM, Morten wrote:
>>
>>> Hi,
>>>
>>> I am using Jersey 1.3 on the server and jersey client
>> for tests and I am experiencing a strange unit test
>> exception on one computer out of six (fails on one, works
>> fine on 5 computer, fails on just one). We are using newest
>> release versions of Java + JDK 1.6_20 on Macs, Windows
>> and Linux.
>>>
>>> Everything works on my Mac but one team member (also
>> on a Mac) gets exceptions like the one below for ALL our
>> webservice calls in tests. It seems to be client
>> related as manual requests using a browser works just fine
>> also for him. At first we used Jersey 1.2 but upgrading to
>> newest version of Jersey and newest embedded grizzly did not
>> change anything. I also have removed all authentication
>> without any improvement.
>>>
>>> Any ideas for what could cause this ? A bug in jersey
>> ? Machine configuration ? Any suggestions for how to find
>> out more ?
>>>
>>
>> This seems to be a resource issue with the machine. The
>> stack trace goes all the way to socket creation so i doubt
>> it is directly a Jersey issue. Perhaps check the maven/JVM
>> options being used?
>>
>> I suspect you might be able to reproduce by writing a
>> simple Java app using HttpURLConnection directly.
>>
>>
>>> P.S: Maybe I should ask him to run the build in tests
>> for the jersey project? What is the easiest way to do that
>> (what to download?)
>>>
>>
>> You will need to check out Jersey do to that:
>>
>> https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html
>> #d4e1772
>>
>> Paul.
>>
>>> [junit]
>> com.sun.jersey.api.client.ClientHandlerException:
>> java.net.ConnectException: Cannot allocate memory
>>> [junit] at
>> com
>> .sun
>> .jersey
>> .client
>> .urlconnection
>> .URLConnectionClientHandler.handle(URLConnectionClientHandler.java:
>> 128)
>>> [junit] at
>> com.sun.jersey.api.client.Client.handle(Client.java:569)
>>> [junit] at
>> com.sun.jersey.api.client.WebResource.handle(WebResource.java:556)
>>> [junit] at
>> com.sun.jersey.api.client.WebResource.post(WebResource.java:219)
>>> [junit] at
>> com.myapp.api.control.remote.WebServiceApiImpl
>> $
>> AsynchronousBackupServiceInvokerAdaptor
>> .clear(WebServiceApiImpl.java:84)
>>> [junit] at
>> com
>> .myapp
>> .ws
>> .controller
>> .activities.ActivitiesTest.remoteInvoke(ActivitiesTest.java:387)
>>> [junit] at
>> com
>> .myapp
>> .ws
>> .controller
>> .activities.ActivitiesTest.getActivities(ActivitiesTest.java:164)
>>> [junit] Caused by:
>> java.net.ConnectException: Cannot allocate memory
>>> [junit] at
>> java.net.PlainSocketImpl.socketConnect(Native Method)
>>> [junit] at
>> java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
>>> [junit] at
>> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
>>> [junit] at
>> java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
>>> [junit] at
>> java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
>>> [junit] at
>> java.net.Socket.connect(Socket.java:529)
>>> [junit] at
>> sun.net.NetworkClient.doConnect(NetworkClient.java:158)
>>> [junit] at
>> sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
>>> [junit] at
>> sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
>>> [junit] at
>> sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
>>> [junit] at
>> sun.net.www.http.HttpClient.New(HttpClient.java:306)
>>> [junit] at
>> sun.net.www.http.HttpClient.New(HttpClient.java:323)
>>> [junit] at
>> sun
>> .net
>> .www
>> .protocol
>> .http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
>>> [junit] at
>> sun
>> .net
>> .www
>> .protocol
>> .http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
>>> [junit] at
>> sun
>> .net
>> .www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:
>> 726)
>>> [junit] at
>> sun
>> .net
>> .www
>> .protocol
>> .http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
>>> [junit] at
>> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:
>> 373)
>>> [junit] at
>> com
>> .sun
>> .jersey
>> .client
>> .urlconnection
>> .URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:
>> 215)
>>> [junit] at
>> com
>> .sun
>> .jersey
>> .client
>> .urlconnection
>> .URLConnectionClientHandler.handle(URLConnectionClientHandler.java:
>> 126)
>>> [junit]
>>>
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>