troubles whan executing uploadApplication() operation

147 views
Skip to first unread message

glac...@gmail.com

unread,
Oct 5, 2012, 1:48:22 PM10/5/12
to vcap...@cloudfoundry.org

Hi all,
Im already using the REST java client (https://github.com/cloudfoundry/vcap-java-client/
) to communicate with my local Cloud Foundry instance. I had no problems with almost all the operations except the creation of applications operation (createAndUploadApp(appName, filePath, serviceNames, appType, appMemory)) that causes the following Exception:

org.springframework.web.client.RestTemplate handleResponseError
ATTENTION: PUT request for "http://api.vcap.me/apps/helloServletnewM/application" resulted in 405 (Not Allowed); invoking error handler
Exception in thread "main" org.cloudfoundry.client.lib.CloudFoundryException: 405 Not Allowed (Client error)
at org.cloudfoundry.client.lib.rest.AbstractCloudControllerClient$ErrorHandler.handleError(AbstractCloudControllerClient.java:224)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:486)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:443)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401)
at org.springframework.web.client.RestTemplate.put(RestTemplate.java:327)
at org.cloudfoundry.client.lib.rest.CloudControllerClientV1.uploadApplication(CloudControllerClientV1.java:313)
at org.cloudfoundry.client.lib.rest.CloudControllerClientV1.doUploadApplicationFolder(CloudControllerClientV1.java:486)
at org.cloudfoundry.client.lib.rest.CloudControllerClientV1.uploadApplication(CloudControllerClientV1.java:290)
at org.cloudfoundry.client.lib.CloudFoundryClient.uploadApplication(CloudFoundryClient.java:181)
at tests.samir.ClientTestWithoutJunit.createAndUploadApp(ClientTestWithoutJunit.java:159)
at tests.samir.Main.main(Main.java:33)

I tried to execute this on cloudfoundry.com and it works perfectly.

Does any one have an idea how to bypass this problem?

Thanking you in advance for your response.

Best,

Pieter Noordhuis

unread,
Oct 5, 2012, 3:00:27 PM10/5/12
to vcap...@cloudfoundry.org
Hi,

Can you verify that the API endpoint on api.vcap.me is functional?

You can test this using VMC. For instance:

```
vmc target http://api.vcap.me/
vmc info
```

If this works, we know the endpoint should be work and we can
investigate further.

Cheers,
Pieter

Mohamed Mohamed

unread,
Oct 5, 2012, 4:18:29 PM10/5/12
to vcap...@cloudfoundry.org
thank you for your answer,
yes, all functions are working well when i use vmc (including upload), i can target api.vcap.me and i can uplad application using vmc push.

Best

Thomas Risberg

unread,
Oct 6, 2012, 9:09:15 AM10/6/12
to vcap...@cloudfoundry.org
Hi,

What vcap installation do you see this problem for? Is it a recent install using the dev_setup scripts or something else?

-Thomas

Mohamed Mohamed

unread,
Oct 12, 2012, 10:58:59 AM10/12/12
to vcap...@cloudfoundry.org
we are using a recent install using dev_setup scripts,
in the server side i tailed some logs files, i found in nginx_cc_main.log:
"PUT /apps/test3767/application HTTP/1.1" 405 340 "-" "Jakarta Commons-HttpClient/3.1"

in ~/cloudfoundry/.deployment/devbox/deploy/uaa-tomcat/logs/uaa.log i found the followinfg exception:

[2012-10-12 05:01:26.135] uaa - 31459 [http-bio-8080-exec-1] .... DEBUG --- ExceptionTranslationFilter: Access is denied (user is anonymous); redirecting to authentication entry point
org.springframework.security.access.AccessDeniedException: Access is denied
        at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:83)
        at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:206)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)

is there any special config for tomcat to allow this kind of http methods?
thanx for your coordination;
best;


Le samedi 6 octobre 2012 15:09:16 UTC+2, Thomas Risberg a écrit :
Hi,
vi

oriol.co...@gmail.com

unread,
Nov 2, 2012, 11:44:31 AM11/2/12
to vcap...@cloudfoundry.org
I am having the same issue here. Everything works fine except of the upload that gives a 405 (Not Allowed) error. I installed a single instance CF from the dev_setup scripts.

Anyone know how to solve it?

Thanks!

Mohamed Mohamed

unread,
Nov 2, 2012, 11:50:54 AM11/2/12
to vcap...@cloudfoundry.org, oriol.co...@gmail.com
You can change the CloudControllerClientV1.java file but the one i attached.
Or directly change the uploadapplication method by adding
    getRestTemplate().postForLocation(url, entity, appName);
instead of
             getRestTemplate().put(url, entity, appName);
Best;
CloudControllerClientV1.java

Thomas Risberg

unread,
Nov 2, 2012, 11:53:06 AM11/2/12
to vcap...@cloudfoundry.org
Hi,

There is a fix for this [1] and it will be included in the next release - probably about a week away from that release.

-Thomas

Mohamed Mohamed

unread,
Nov 2, 2012, 5:48:47 PM11/2/12
to vcap...@cloudfoundry.org
There is another issue that i encountred, its when the size of the application ( a war file for example) is big. The timeout is reached before completing the upload. And even if the upload is completed the staging encounter some problems.
could you help in this issue?
Regards;
Reply all
Reply to author
Forward
0 new messages