Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Erro 404 ao fazer o deploy usando o beanstalk

Ao fazer deploy de uma aplicacao java web, ao terminar, a aplição fica verde, e ao clicar na url, abre a aplicacao no browser, mas se clicar na segunda vez, da erro 404. Se esperar um templo e clicar no link novamente, a aplicacao abre novamente, se clicar pela segunda vez, erro 404 denovo. Ou seja, a aplicacao funciona como deveria funcionar, so no primeiro clic no link, a partir do segundo, da erro.

Outra caracteristica do problema, é que se inserir /index.xhtml, apos o link, abre normalmente todas as vezes, conforme exemplo abaixo.

environment.mf6j6us2wp.sa-east-1.elasticbeanstalk.com /index.xhtm

Segue o log:

[2017-10-27T12:10:13.490Z] DEBUG [1782]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||ManifestFileS3Key..
[2017-10-27T12:10:13.859Z] INFO  [1782]  : Finding latest manifest from bucket 'elasticbeanstalk-sa-east-1-102555464856' with prefix 'resources/environments/e-wv9krgyjpr/_runtime/versions/manifest_'.
[2017-10-27T12:10:14.072Z] INFO  [1782]  : Found manifest with key 'resources/environments/e-wv9krgyjpr/_runtime/versions/manifest_1509106134330'.
[2017-10-27T12:10:14.094Z] INFO  [1782]  : Updated manifest cache: deployment ID 1 and serial 1.
[2017-10-27T12:10:14.094Z] DEBUG [1782]  : Loaded definition of Command CMD-PreInit.
[2017-10-27T12:10:14.095Z] INFO  [1782]  : Executing Initialization
[2017-10-27T12:10:14.095Z] INFO  [1782]  : Executing command: CMD-PreInit...
[2017-10-27T12:10:14.095Z] INFO  [1782]  : Executing command CMD-PreInit activities...
[2017-10-27T12:10:14.095Z] DEBUG [1782]  : Setting environment variables..
[2017-10-27T12:10:14.096Z] INFO  [1782]  : Running AddonsBefore for command CMD-PreInit...
[2017-10-27T12:10:20.388Z] DEBUG [1782]  : Running stages of Command CMD-PreInit from stage 0 to stage 0...
[2017-10-27T12:10:20.388Z] INFO  [1782]  : Running stage 0 of command CMD-PreInit...
[2017-10-27T12:10:20.388Z] DEBUG [1782]  : Loaded 2 actions for stage 0.
[2017-10-27T12:10:20.388Z] INFO  [1782]  : Running 1 of 2 actions: DownloadSourceBundle...
[2017-10-27T12:10:27.567Z] INFO  [1782]  : Running 2 of 2 actions: PreInitHook...
[2017-10-27T12:10:29.526Z] INFO  [1782]  : Running AddonsAfter for command CMD-PreInit...
[2017-10-27T12:10:29.527Z] INFO  [1782]  : Command CMD-PreInit succeeded!
[2017-10-27T12:10:29.527Z] INFO  [1782]  : Command processor returning results: 
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
[2017-10-27T12:10:50.477Z] DEBUG [2021]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-10-27T12:10:50.477Z] DEBUG [2021]  : Checking if the command processor should execute...
[2017-10-27T12:10:50.481Z] DEBUG [2021]  : Checking whether the command is applicable to instance (i-00a4deef63bbba0e4)..
[2017-10-27T12:10:50.481Z] INFO  [2021]  : Command is applicable to this instance (i-00a4deef63bbba0e4)..
[2017-10-27T12:10:50.481Z] DEBUG [2021]  : Checking if the received command stage is valid..
[2017-10-27T12:10:50.481Z] INFO  [2021]  : No stage_num in command. Valid stage..
CMD-Startup: {"execution_data":"{\"leader_election\":\"true\"}","instance_ids":["i-00a4deef63bbba0e4"],"command_name":"CMD-Startup","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"2f36a1a0-98c6-4690-aecd-99c15fedd01e"}
[2017-10-27T12:10:50.482Z] INFO  [2021]  : Command processor should execute command.
[2017-10-27T12:10:50.482Z] DEBUG [2021]  : Storing current stage..
[2017-10-27T12:10:50.482Z] DEBUG [2021]  : Stage_num does not exist. Not saving null stage. Returning..
[2017-10-27T12:10:50.482Z] DEBUG [2021]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2017-10-27T12:10:50.482Z] DEBUG [2021]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2017-10-27T12:10:50.483Z] DEBUG [2021]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2017-10-27T12:10:50.484Z] INFO  [2021]  : Found enabled addons: ["logstreaming", "logpublish"].
[2017-10-27T12:10:50.486Z] INFO  [2021]  : Updating Command definition of addon logstreaming.
[2017-10-27T12:10:50.486Z] INFO  [2021]  : Updating Command definition of addon logpublish.
[2017-10-27T12:10:50.487Z] DEBUG [2021]  : Refreshing metadata...
[2017-10-27T12:10:50.964Z] DEBUG [2021]  : Refreshed environment metadata.
[2017-10-27T12:10:50.965Z] INFO  [2021]  : Recreated directory /opt/elasticbeanstalk/deploy/configuration/.
[2017-10-27T12:10:50.965Z] DEBUG [2021]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_AppSourceUrlFileContent||url..
[2017-10-27T12:10:50.967Z] INFO  [2021]  : Created appsource url file at /opt/elasticbeanstalk/deploy/configuration/appsourceurl.
[2017-10-27T12:10:50.967Z] DEBUG [2021]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent..
[2017-10-27T12

O que será que está acontecendo?

2 respostas

Problema solucionado, estava faltando essa configuracao no web.xml:

 <welcome-file-list>
   <welcome-file>login.xhtml</welcome-file>
 </welcome-file-list>
solução!

Boa Jonas :D