Sunday, December 28, 2014

git svn clone command fails on windows


>PROBLEM

The following command is executed:

    git svn clone file://D:/work/dev/java/lab/junit

It returns:   

    C:\Program Files (x86)\Git\bin\perl.exe: *** unable to remap C:\Program Files (x86)\Git\bin\libsvn_wc-1-0.dll to same address as parent -- 0x6F1C0000






 The same problem happened on Git's bash and Cygwin console.



>SOLUTION

I updated the cygwin´s perl and git libraries to the last one by this time, since It was not possible to update Git, because the last version was already installed (Git-1.9.5-preview20141217.exe),
After the update, a new attempt using Cygwin succeeded.




The clue came from:

https://code.google.com/p/conemu-maximus5/wiki/AppHelp


Sunday, September 14, 2014

Windows Update failure: WindowsUpdate_000000FF WindowsUpdate_dt000

Update failure returning message:
   
    "WindowsUpdate_000000FF" "WindowsUpdate_dt000"
   
I got this message during of of the procedures of windows update when trying to install Microsoft.NET Framework 4.5.1 and 4.

>SOLUTION

Manual installation of each update that failed.
First, to download, identify the hotfix number shown on "windows update".
Usually it is a number like this: KB2894854.
Find and download by this number. Ex.:
search for:
  download KB2894854
or
  download microsoft KB2894854

After download, run the executables to install the hotfix.


>INSTALLED PACKAGES

For example, in my case I had to download and install each hotfix that windows' update refused to.
This is the hotfix list and the respectives URLs:
- Microsoft .NET Framework 4.5.1 = http://www.microsoft.com/pt-br/download/details.aspx?id=40779
http://www.microsoft.com/pt-br/download/details.aspx?id=41378
- KB970892 = http://www.microsoft.com/en-us/download/confirmation.aspx?id=42779
- KB2894854 = http://www.microsoft.com/pt-br/download/details.aspx?id=41378
- KB2898869 = http://www.microsoft.com/pt-br/download/details.aspx?id=41903
- KB2901126 = http://www.google.com.br/url?url=http://www.microsoft.com/pt-br/download/details.aspx%3Fid%3D41918&rct=j&q=&esrc=s&sa=U&ei=utYVVPnoMeOmigLK-4HoCw&ved=0CBQQFjAA&usg=AFQjCNFX685_-qZvmx3_HKq84SxCb_SaWA
- KB2972216 = http://www.microsoft.com/en-ie/download/details.aspx?id=44181





Sunday, June 8, 2014

'Maven Dependencies' references non existing library ... com\sun\tools\1.6\tools-1.6.jar'


>PROBLEM

  'Maven Dependencies' references non existing library ... com\sun\tools\1.6\tools-1.6.jar'    auth        Build path    Build Path Problem
Full Compilation Error Message:

  The container 'Maven Dependencies' references non existing library
    'D:\work\repolib\java\mvn_repo\com\sun\tools\1.6\tools-1.6.jar'    auth        Build path    Build Path Problem


>SOLUTION

This error is caused by this dependency:

        <dependency>
            <groupId>org.jboss.as</groupId>
            <artifactId>jboss-as-jpa-hibernate3</artifactId>
            <version>7.2.0.Final</version>
        </dependency>

It was substituted by another.

>ENV
eclipse, maven, java, hibernate


>DETAILED APPROACH

A build path problem usually indicates that a dependency is missing.
So, this kind of problem may have many reasons.
First check your development tool configuration.
If Eclipse, go to preferences, Build Path. Check also Project Facets.
Go to the pom.xml and check the compilation configuration version.
It must be the same of Eclipse's configuration.

Example:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

If Eclipse configuration is using version java 7, switch to 1.7 where it is 1.6.


After all this check up, if the problem remains, do the following:

1. Remove all dependencies from your pom.xml file and let it as follow:

    <dependencies>
    </dependencies>

2. Then insert the dependencies again using small groups (for instance 3 dependencies) until one of them triggers the target error.
Then isolate the dependency that causes the problem removing and test one by one in that group until the error disappears.


Saturday, May 31, 2014

Eclipse java project and the "The selection did not contain any resources that can run on a server" warn.



>PROBLEM

When you try to run the project on the server using "Run on Server" (SA+X+R) option, eclipse returns the following message:
  The selection did not contain any resources that can run on a server.


>SOLUTION

On the navigation panel, click over the project for pop-up menu, properties, Project Facets, check:
- Dynamic Web Module
- Java




>ENV
eclipse, maven java project.


Wednesday, May 28, 2014

Spring-MVC - WARN [CglibAopProxy] Unable to proxy method


ENVIRONMENT

Spring-MVC using Spring Security.


PROBLEM

Suddenlly, the compiler begins warning:

WARN [CglibAopProxy] (CglibAopProxy.java:...) - Unable to proxy method [public final void org.springframework.web.servlet.mvc.AbstractController.setSynchronizeOnSession(boolean)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.

SOLUTION

First it was commented the annotation:
  @PreAuthorize("permitAll")
on the Controller class.

Recompiled and the warns disappeared.
So, the problem comes from the procedure triggered by this annotation.

To fix, it was taken off the following attribute from "security:global-method-security" element:
  proxy-target-class="true"
on the spring-security.xml configuration.



- spring-security.xml configuration setup:

BEFORE:
    <security:global-method-security pre-post-annotations="enabled" secured-annotations="enabled"
        jsr250-annotations="enabled" proxy-target-class="true">
    </security:global-method-security>
AFTER:
    <security:global-method-security pre-post-annotations="enabled" secured-annotations="enabled"
        jsr250-annotations="enabled" >
    </security:global-method-security>

COMMENT

The proxy-target-class attribute enabled (proxy-target-class="true") forces the use of CGLIB proxying (for example, to proxy every method defined for the target object, not just those implemented by its interfaces).
However, there are some issues to consider, like the final methods that cannot be advised, as they cannot be overriden.
See more at Spring AOP documentation .



FULL WARN MESSAGES:
  2014-05-28 14:18:26,148  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.web.servlet.mvc.AbstractController.setSynchronizeOnSession(boolean)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,150  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final boolean org.springframework.web.servlet.mvc.AbstractController.isSynchronizeOnSession()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,150  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.web.servlet.support.WebContentGenerator.setSupportedMethods(java.lang.String[])] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,151  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final java.lang.String[] org.springframework.web.servlet.support.WebContentGenerator.getSupportedMethods()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,151  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.web.servlet.support.WebContentGenerator.setRequireSession(boolean)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,152  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final boolean org.springframework.web.servlet.support.WebContentGenerator.isRequireSession()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,152  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.web.servlet.support.WebContentGenerator.setUseExpiresHeader(boolean)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,152  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final boolean org.springframework.web.servlet.support.WebContentGenerator.isUseExpiresHeader()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,153  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.web.servlet.support.WebContentGenerator.setUseCacheControlHeader(boolean)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,153  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final boolean org.springframework.web.servlet.support.WebContentGenerator.isUseCacheControlHeader()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,153  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.web.servlet.support.WebContentGenerator.setUseCacheControlNoStore(boolean)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,154  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final boolean org.springframework.web.servlet.support.WebContentGenerator.isUseCacheControlNoStore()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,154  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.web.servlet.support.WebContentGenerator.setCacheSeconds(int)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,154  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final int org.springframework.web.servlet.support.WebContentGenerator.getCacheSeconds()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,155  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.web.context.support.WebApplicationObjectSupport.setServletContext(javax.servlet.ServletContext)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,155  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final void org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext) throws org.springframework.beans.BeansException] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
  2014-05-28 14:18:26,155  WARN [CglibAopProxy] (CglibAopProxy.java:263) - Unable to proxy method [public final org.springframework.context.ApplicationContext org.springframework.context.support.ApplicationObjectSupport.getApplicationContext() throws java.lang.IllegalStateException] because it is final: All calls to this method via a proxy will be routed directly to the proxy.



Monday, April 14, 2014

spring "java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet"


Problem
Running the application using eclipse's server you get the following exception:

 spring java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet  

Solution

Check if you have the spring-mvc jar in the project's classpath.
If using maven, you must have something like this in your pom.xml:

<!-- Spring 3 MVC depends on spring-core, spring-beans, spring-context, spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>

</dependency>

If you respective reference is verified and correct, just remove the project from your server.
Perform a project clean, building everything from scratch.
Deploy the project again.

Sometimes, the eclipse's server may fail requiring a new deploy.




Tuesday, March 4, 2014

Jboss-characters' and URLs strange behavior



>PROBLEM

Jboss-characters' and URLs strange behavior, compromising navigation.



>SOLUTION

Set the proper encoding.
Edit the file:
  $JBOSS_INTALL_DIR/standalone/configuration/standalone.xml

If using UTF-8, insert the following after  </extensions> tag:

    <system-properties>
        <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
        <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>
    </system-properties>



>ENV
JBoss server

Eclipse using AspectJ Plugin



If  you are using Eclipse with aspectJ plugin, you may get this exception below, because it is necessary to convert the project before running it.
See details below.


PROBLEM

Exception thrown:


SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logAspecto' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: No matching factory method found: factory method 'aspectOf()'. 

Check that a method with the specified name exists and that it is static.
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:528)


SOLUTION


After AspectJ plugin installation it is necessary to convert the project.
Right click the project > configure > convert to aspect project


 
INTALLING AspectJ plugin in Kepler

To install aspectJ plugin in Eclipse Kepler, go to menu, help, Install new software.
Point to http://download.eclipse.org/tools/ajdt/43/update .
Wait a minute to update, check all then install.


eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...