Tuesday, June 30, 2020

Copy and paste not working (Ctrl + C Ctrl + V) in Chrome (Google Sheets)

Problem

It did not work when you try to copy a cell on Google Sheets.

Reason

Some incompatibility with installed extension.

Solution

Disable the extensions one by one until you found the problematic one.

Copiar e colar (Ctrl + C Ctrl + V) não funciona no Chrome (GSheets)

Problema

Ao tentar copiar uma célula da planilha do  Google não funcionava.

Motivo

Uma extensão que estava instalada passou a conflitar com essa funcionalidade.

Solução

Ir desabilitando as extensões até encontrar a problemática. 

Wednesday, May 20, 2015

Invalid byte 2 of 3-byte UTF-8 sequence


Problem


When try to execute some roo command (ex: roo hint) show the following message error: "Invalid byte 2 of 3-byte UTF-8 sequence".

Reason


The pom.xml file had special characters (ç, ã etc.).

Solution


Remove the special characters.



Byte inválido 2 da sequência UTF-8 do byte 3


Problema


Ao tentar executar algum comando do spring roo (ex: roo hint), apresenta a seguinte mensagem de erro:
Byte inválido 2 da sequência UTF-8 do byte 3


Motivo


O projeto do spring roo utiliza o maven. O arquivo pom.xml possuia caracteres com acentos e cedilha e o roo não estava conseguindo tratar.


Solução

Retirar os caracteres com acento e cedilha.

Thursday, August 8, 2013

Problem

When you try to execute the maven comand mvn clean install shows the following message error: 
...
Exception in thread "main" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"

Reason

There is not enough memory to execute all the steps necessary to the build (integration tests, start the jetty server etc.).

Solution

Creation of a environment variable MAVEN_OPTS with the value -Xmx1024m -XX:MaxPermSize=512m

Related Links

Maven throws “java.lang.OutOfMemoryError”

Setting Java heap space under Maven 2 on Windows

Problema

Ao tentar executar o comando mvn clean install apresentava o seguinte mensagem de erro (de forma reduzida):
...
Exception in thread "main" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"

Motivo

Não existia memória suficiente para execução de todos os passos da construção (execução dos teste de integração, do servidor jetty etc.).

Solução

Criação da variável de ambiente MAVEN_OPTS com o valor -Xmx1024m -XX:MaxPermSize=512m

Links Relacionados

Maven throws “java.lang.OutOfMemoryError”

Setting Java heap space under Maven 2 on Windows


Thursday, September 27, 2012

No RequestContext for operation GWT

Problem

When trying to execute a Spring Roo Application that uses GWT it shows the following message error in console: No RequestContext for operation.


Attention 

This error also occurs  when using RequestFactory and the methods from the client side are not compatibles with the server side. Before trying what is explained here, make sure that the methods were created properly. More information about how to create the methods see this GWT documentation: https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory

Reason

Changes made in a subclass of RequestContext. Apparently it is related to compilation/build problems.

Solution

Recompile/rebuild the project. A simple rebuild did not work to me. Follow the steps that I think I did to resolve the problem. I am not sure because I do not simulated the error again. In the command line:


 mvn clean
 mvn compile
 mvn gwt:run

If not work, try in eclipse:

plugin do google->GWT Compile Projet

If not work try to recompile/rebuild in other ways.

No RequestContext for operation GWT





Problema

Ao tentar executar uma aplicação Spring Roo que utiliza o GWT apresenta a seguinte mensagem de erro no console: No RequestContext for operation.



Observação:

Este erro também acontece ao se utilizar RequestFactory e os métodos no lado cliente e no lado servidor não estejam compatíveis. Antes de tentar o explicado aqui certifique-se que os métodos foram criados corretamente. Maiores informações de como os métodos devem ser criados, ver a seguinte documentação do GWT: https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory?hl=pt-BR


Motivo

Modificações feita em classe filha de RequestContext. Aparentemente o projeto ficou inconsistente após modificações em classe filha de RequestContext. Está relacionado a problemas de build/compilação do projeto

Solução

Reconstruir o projeto. Uma simples rebuild não funcionou. Segue os passos que provavelmente efetuei para solucionar o problema. Não simulei o erro novamente. Na linha de comando execute:


 mvn clean
 mvn compile
 mvn gwt:run

Não tenho certeza se o passo seguinte também é necessário. No eclipse:

plugin do google->GWT Compile Projet

Se não funcionar tente recompilar/reconstruir de com outras sequências/formas.




Thursday, September 15, 2011

Spring Roo - Error: One or more exceptions caught, see full set in UmbrellaException#getCauses

Problem

When trying to save a entity in spring roo (using in the web tier gwt) it showed the following error message:

Error: One or more exceptions caught, see full set in UmbrellaException#getCauses

Reason

The declaration of an empty constructor was causing the problem. The roo cause was not identified.

Solution

Remove the constructor. In my case the code was changed from:

public class A {
transient B b;

A(){
this.b = getStub();
}
...
}

to:

public class A {
transient B b= getStub();
...
}



Spring Roo - Error: One or more exceptions caught, see full set in UmbrellaException#getCauses

Problema

Ao tentar salvar uma entidade no spring roo (usando na camada de visão o gwt) apresentou o seguinte problema.

Error: One or more exceptions caught, see full set in UmbrellaException#getCauses

Motivo

A declaração de um construtor vazio estava ocasionando o problema. Mas a causa raiz não foi identificada.

Solução

Remover o construtor vazio. No meu caso foi modificado o código de:

public class A {
transient B b;

A(){
this.b = getStub();
}
...
}

para:

public class A {
transient B b= getStub();
...
}

Wednesday, September 14, 2011

Mock/Stub EntityManager in Spring Roo

Problem

Trying to create unit test to the method persist from a class created in Spring Roo using a stub do the EntityManger that is passed in the constructor as follows:


public class ClassATest {
    @Test
    public void whenPersistShoulCallClassB() throws Exception {
        
        Mockery contexto = new Mockery();
        final ClassB classB = contexto.mock(ClassB.class);
        
        final ClassA classA = 
            new ClassA(getEntityManagerStub(), classB);

        contexto.checking(new Expectations() {{
            one(classB).doSomething(classA);

        }
    });
        classA.persist();
        
        contexto.assertIsSatisfied();
    }

    private EntityManager getEntityManagerStub() {
        return new EntityManager() {
            ...
        }
    }
}
Source from ClassA

public class ClassA {
...

    public ClassA(EntityManager entityManager, ClassB classB) {
        this.entityManager = entityManager;
        this.classB = classB;
    }



    @Transactional
    public void persist() {
        if (this.entityManager == null) this.entityManager = entityManager();
     
        this.entityManager.persist(this);
     
        classB.doSomething(this);
     
    }

...
 }


This test works inside Eclipse, but doesn´t when called by maven, as a result of  mvn jetty:run-exploded.

Reason

Probably Spring Roo is injecting the EntityManager just before the call to the constructor.

Solution

Use of setter injection, as follows:

public class ClassATest {
    @Test
    public void whenPersistShoulCallClassB() throws Exception {
        
        Mockery contexto = new Mockery();
        final ClassB classB = contexto.mock(ClassB.class);
        
        final ClassA classA =
            new ClassA(classB);
        classeA.setEntityManager(getEntityManagerStub());
        
        contexto.checking(new Expectations() {{
            one(classB).doSomething(classeA);

        }
    });
        classeA.persist();
        
        contexto.assertIsSatisfied();
    }

    private EntityManager getEntityManagerStub() {

        return new EntityManager() {
            ...
        }

    }
}


Código da ClasseA


public class ClasseA {
...

    public ClasseA(ClasseB classeB) {
        this.classeB = classeB;
    }


    public void setEntityManager(EntityManager entityManager) {
        this.entityManager = entityManager;
    }




    @Transactional
    public void persist() {
        if (this.entityManager == null) this.entityManager = entityManager();
      
        this.entityManager.persist(this);
      
        classeB.doSomething(this);
      
    }

...
 }


There must be a more elegant solution that enables the utilization of construction injection. When I have time to research, I will post it.






Mock/Stub do EntityManager no Spring Roo

Problema

Ao tentar criar testes de unidade para o método persist de uma classe criada pelo Spring Roo, tentei utilizar um Stub para o EntityManager da seguinte forma:



public class ClasseATest {
    @Test
    public void aoPersistirDeveriaChamarClasseB() throws Exception {
        
        Mockery contexto = new Mockery();
        final ClasseB classeB = contexto.mock(ClasseB.class);
        
        final ClasseA classeA = 
            new ClasseA(getEntityManagerStub(), classeB);

        contexto.checking(new Expectations() {{
            one(classeB).fazerAlgo(classeA);

        }
    });
        classeA.persist();
        
        contexto.assertIsSatisfied();
    }

    private EntityManager getEntityManagerStub() {
        return new EntityManager() {
            ...
        }
    }
}
Código da ClasseA

public class ClasseA {
...

    public ClasseA(EntityManager entityManager, ClasseB classeB) {
        this.entityManager = entityManager;
        this.classeB = classeB;
    }



    @Transactional
    public void persist() {
        if (this.entityManager == null) this.entityManager = entityManager();
     
        this.entityManager.persist(this);
     
        classeB.fazerAlgo(this);
     
    }

...
 }


O teste funcionava quando era executado dentro de Eclipse, mas falhava quando era executado via maven, no momento da execução do mvn jetty:run-exploded.


Motivo

Provavelmente o spring roo está injetando o EntityManager logo após a chamada ao constructor.

Solução

Utilizar setter injection, como mostrado abaixo:


public class ClasseATest {
    @Test
    public void aoPersistirDeveriaChamarClasseB() throws Exception {
        
        Mockery contexto = new Mockery();
        final ClasseB classeB = contexto.mock(ClasseB.class);
        
        final ClasseA classeA =
            new ClasseA(classeB);
        classeA.setEntityManager(getEntityManagerStub());
        
        contexto.checking(new Expectations() {{
            one(classeB).fazerAlgo(classeA);

        }
    });
        classeA.persist();
        
        contexto.assertIsSatisfied();
    }

    private EntityManager getEntityManagerStub() {

        return new EntityManager() {
            ...
        }

    }
}


Código da ClasseA


public class ClasseA {
...

    public ClasseA(ClasseB classeB) {
        this.classeB = classeB;
    }


    public void setEntityManager(EntityManager entityManager) {
        this.entityManager = entityManager;
    }




    @Transactional
    public void persist() {
        if (this.entityManager == null) this.entityManager = entityManager();
      
        this.entityManager.persist(this);
      
        classeB.fazerAlgo(this);
      
    }

...
 }


Provavelmente deve existir uma solução mais elegante, que permita a utilização da injeção da dependência no construtor. Quando tiver tempo vou pesquisar e bloggar a solução.






Wednesday, June 15, 2011

Keep CMD Open

Problem

The cmd window close after finish the execution of a bat file. The desired behavior is that the cmd stay opened to the input of new comands.

Reason

It is the default behavior.

Solution

  • Create a bat file that will call another bat. Ex: keppCmdOpen.bat
  • In the file put the line: start "" fileWithCommands.bat /k
  • Create the file fileWithCommands.bat and add the desired commands.

Others

If the need is just to see the window, and not to input commands, there is no need to two bats. Just put the pause command at the end of the file.

More info:

http://answers.yahoo.com/question/index?qid=20090306121738AAkg8Ij
http://pt.w3support.net/index.php?db=so&id=905352

Manter cmd aberto

Problema

A janela do cmd se fecha ao final da execução das instruções em um arquivo bat. O comportamento desejado é que o cmd permaneça aberto para a entrada de novos comandos.

Motivo

Este é o comportamento padrão.

Solução

  • Crie um arquivo bat que irá chamar outro. Por exemplo: manterCmdAberto.bat
  • No arquivo criado adicione a seguinte linha: start "" arquivoComComandos.bat /k
  • Crie o arquivo arquivoComComandos.bat e adicione os comando desejados.
Outros

Se o que se deseja é apenas visualizar o conteúdo da janela cmd, e não entrar com comandos, não precisa dos dois arquivos. Simplesmente no segundo arquivo (arquivoComComandos.bat) adicione a linha: pause

Mais informações nos seguinte links:



Saturday, June 11, 2011

Spring Roo GWT application works in dev mode but not in production

Problem

A spring roo gwt application works in dev mode (mvn gwt:run) but not works in production mode (mvn tomcat:run or mvn jetty:run). When trying the late it shows a page with a rectangle with the message loading inside.

Reason

Solution

Assuming that the project is the sample that comes with roo expenses.roo. In STS (Spring Source Tool Suite):

  • Edit the project properties
  • Select Deployment Assembly
  • Click Add
  • Select Folder
  • Select target/extrack-0.1.0.BUILD-SNAPSHOT (or whatever your version is)
  • Click Finish
  • Right click on the project or the pom.xml
  • Select Run As -> Maven assembly:assembly
  • App should re-deploy to the server

This solution was originally posted here: http://forum.springsource.org/showthread.php?106292-Problem-with-expenses.roo-sample-and-STS-2.6.0

Aplicação Spring Roo GWT funciona em modo de desenvolvimento, mas não em produção

Problema

Uma aplicação spring roo configurada para utilizar o gwt funciona em modo de desenvolvimento (mvn gwt:run), mas não funciona quando se faz o deploy em produção (mvn tomcat:run ou mvn jetty:run). Quando se tenta o último mostra uma página com um quadrado e dentro a mensagem loading.

Motivo

Solução

Assumindo que o projeto é o sample que vem com o spring roo (expenses.roo). No STS (Spring Source Tool Suite):
  • Vá nas propriedades do projeto.
  • Selecione Deployment Assembly.
  • Clique em adicionar.
  • Selecione folder.
  • Selecione target/extrack-0.1.0.BUILD-SNAPSHOT.
  • Clique em finalizar.
  • Selecione Run As -> Maven assembly:assembly.


Atualização em 25 ago 2011

Por algum motivo os passos acima não estavam funcionando. Talvez tenha sido pela atualização do STS. Os passos abaixo resolveram o problema:

  • Retire o diretório target/extrack-0.1.0.BUILD-SNAPSHOT do Deployment Assembly como tinha feito acima.
  • Execute o comando mvn jetty:run-exploded.

Compilation error without editing source files in spring roo project

Problem

With no editing of source files from a spring roo project compilation errors appears. This errors are in the source controlled by roo (the aspects).


Sem que se tenha editado o código fonte de um projeto spring roo, problemas de compilação apareceram. Este problemas são na parte que o o roo controla e não devemos editar (Os aspectos).

Reason

Using a different version (older) of roo to work with the project that was created with a newer version of roo. I think it is a problem of roo. It should not allow to open a new projet with an old version of roo.

Solution

Revert the sources to the previous version. It is trivial if you are using a version control.

Erro de compilação em projeto spring roo sem ter editado arquivos

Problema

Sem que se tenha editado o código fonte de um projeto spring roo, problemas de compilação apareceram. Este problemas são na parte que o o roo controla e não devemos editar (Os aspectos).

Motivo

Utilizar o roo numa versão diferente (no caso mais antiga) da versão que foi utilizada para a criação do projeto. O próprio roo deveria verificar isto e nãom permitir abrir o projeto.

Solução

Voltar o código fonte a versão anterior. Trivial com a utilização de controle de versão.

Wednesday, June 8, 2011

Why insn´t Firefox picking up the GWT Developer Plugin when started from Junit using Webdriver?

Problem

When trying to access the GWT Development Environment (http://127.0.0.1:8888/ApplicationScaffold.html?gwt.codesvr=127.0.0.1:9997) using Wedriver inside Junit a page requesting the installation of GWT Development Plugin. Even with the plugin already installed.

Reason

By default, the Wedriver driver to Firefox use a clean profile( new FirefoxDriver()) without any extensions.

O driver para o Firefox que o Webdriver utiliza está com um perfil limpo (new FirefoxDriver()), sem nenhuma extensão.

Solution

To configure the profile to use the GWT Development Plugin as follows:

Download the plugin from https://dl-ssl.google.com/gwt/plugins/firefox/gwt-dev-plugin.xpi and put in some place in your computer.

Configure the driver to use the plugin:

FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(new File("path to gwt-dev-plugin.xpi"));
WebDriver driver = new FirefoxDriver(profile);

More informationhere: http://groups.google.com/group/webdriver/browse_thread/thread/c4f0ee7529c0c70a?pli=1

Porque o Firefox não utiliza o GWT Developer Plugin quando iniciado do Junit utilizando o Webdriver?

Problema

Ao tentar acessar a URL para o ambiente do desenvolvimento do GWT (http://127.0.0.1:8888/ApplicationScaffold.html?gwt.codesvr=127.0.0.1:9997) utilizando o Webdriver dentro do Junit, é exibida página solicitando a instalação do plugin de desenvolvimento do GWT. Mesmo este plugin já tendo sido instalado.

Motivo

O driver para o Firefox que o Webdriver utiliza está com um perfil limpo (new FirefoxDriver()), sem nenhuma extensão.

Solução

Configurar para que o perfil utilizado possua o plugin de desenvolvimento do GWT. Segue roteiro:

Baixe o plugin a partir deste link: https://dl-ssl.google.com/gwt/plugins/firefox/gwt-dev-plugin.xpi e salve em algum local no computador

Configure o Firefox para utilizar o plugin:
FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(new File("path to gwt-dev-plugin.xpi"));
WebDriver driver = new FirefoxDriver(profile);