Monday, July 23, 2012

Access denied to http://repository.jboss.org


I have an error,

Failure to transfer javax.servlet:servlet-api/maven-metadata.xml from http://repository.jboss.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of jboss-repo has elapsed or updates are forced. Original error: Could not transfer metadata javax.servlet:servlet-api/maven-metadata.xml from/to jboss-repo (http://repository.jboss.org/maven2): Access denied to http://repository.jboss.org/maven2/javax/servlet/servlet-api/maven-metadata.xml. Error code 403, Forbidden

I find this entry
http://stackoverflow.com/questions/1979957/maven-dependency-for-servlet-3-0-api

The proyect maven org.bricked socialauth-spring  have this entry in pom.xml
      <repository>
            <id>jboss-repo</id>
            <url>http://repository.jboss.org/maven2</url>
      </repository>

but I cant solver.

to solver this error

Make this in settings.xml we should add something like:

<mirrors>
    <mirror>
    <id>my-internal-repository</id>
    <name>Mirror of jboss-repo /</name>
    <url>http://repo2.maven.org/maven2/</url>
    <mirrorOf>jboss-repo</mirrorOf>
    </mirror>

</mirrors>



Wednesday, July 18, 2012

Eclipse+ Maven

Control de la configuración de los proyectos es una de las prácticas de CMMI. Y ¿Que significa esto? Pues saber que librerias usas en tu proyecto y como debes instalar estas librerias y configuara todo para compilarlo correctamente. ¿y como configuramos esto? Pues con un subversion + ant + eclipse , te bajas las librerias de los repositorios vas actualizado los script de ant. Pero ¿No hay algo mas fácil que andar actualizardo los script de ant y bajando la libreria adecuada del repositorio de java que sea? Pues sí, la solucion a esto es maven.

Instalamos maven. y después de meses intentando usarlo ... he decidido pasarme al plugin de maven para  eclipse.
Tambien usa la configuración de maven, en maven hay un fichero de configuracion llamado settings.xml en el cual se debe configurar para pasar el proxy empresarial. Tambien debe añadir dos repositorios uno donde estan las libreiras y otro donde estan los plugin de maven.
que es esto de plugins de maven. Son un conjunto de extensiones de maven para hacer mas tareas.

Para intergrar maven en eclipse hay que instalar m2e se añade el pluging al eclipse J2EE en el siguiente URL
http://download.eclipse.org/technology/m2e/releases

Una vez instalado simplemente tiene que crear un proyecto maven, en este proyecto configurar tus repositorios y propiedades globales del proyecto.
Creamos un modulo dependiente del proyecto.
Para depurar un proyecto maven debes elegir el ciclo de vida de un proyecto maven. los mas importantes son install (instala el artefacto en tu repositorio local ) deploy (despliega en un repositorio remoto definido) test (lanza los test que has definido en tu proyecto) clear (limpia todo )






Wednesday, July 11, 2012

Open ID simple-openid error

Hace tiempo quisimos probar OpenID. Si te bajas el codigo fuente de OpenID de 
http://code.google.com/p/openid4java/ y quieres ejecutar el ejemplo de simple-openid te dice que ejecutes este comando
 
mvn jetty:run en el directorio de simple-openid 
 
pero sale este maravilloso error 
 
[ERROR] Failed to execute goal on project simple-openid: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project simple-openid: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:196)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure 
Caused by: org.sonatype.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in 
 
Esto te dice que no encuentra las dependencias de los jar. 
Según leo por los blog esto se resuelve diciendo en el fichero de pom.xml que no ataque a los jar sino a los pom.
 
Según pone en esta entrada  
http://stackoverflow.com/questions/6542235/maven-could-not-resolve-dependencies-for-openid4java
 
Pero me sigue diciendo que no encuentra las librerias.
Así que si las quieres instalar en tu repositorio local solo tiene que ejecutar en la carpeta maven2 
 
mvn install
 
pero esto no te instalará las librerias ya que estan configurados como POM.
 
Así que en cada una de las carpetas maven2/ puedes cambiar los fichero pom.xml  el <type>pom</type> por   <type>jar</type>  menos de la principal 
No cambies  el fichero maven2/pom.xml
 
Esto si que te instalará las librerias en tu repositorio local y podrás volver a ejecutar 
 
mvn jetty:run en el directorio de simple-openid 

 

Friday, June 1, 2012

PHP wamp error to load dynamic library


I have an error when I try add extension in PHP with  library in WAMP or XAMPP.
PHP warning PHP status: unable to load dynamic library
No se puede encontrar el módulo especificador

Put enviroment path in windows the path to library but this not works. You must reboot the PC to load the service Wamp the path. 


All work fine.

the library are wsf.dll 

Tuesday, October 4, 2011

create a web service in java without server

Sometimes when create a Web service in java dont return data but there are not any error. This happenig because the classs interface and the implementation dont have the same annotations. Solution: copy exactily the same funtion interface.


Monday, October 3, 2011

Create a Web Service in java without tomcat or glassfish

It`s posible create a Web service without a server. With java JSE 6 it's easy.

Create a interface with a method
package mycountry.entreprise.myservice;

import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

@WebService(name = "MyService",
        targetNamespace = "http://MyService.entreprise.country/",
        serviceName = "MyMethod")
public interface MyService {
   
    @WebResult(name="returnValue")
    public abstract String[] oneMethod(
            @WebParam(name="param1") String param1);

}


Create a implementation of interface


import javax.jws.WebMethod;
import javax.jws.WebService;

import javax.xml.ws.Endpoint;

@WebService(name = "MyService",
        targetNamespace = "http://MyService.entreprise.country/",
        serviceName = "MyServiceService")
public class MyServiceImpl implements MyService{
   public String[] oneMethod(String param1) {
String []data=  {"1","AA","1","01};
return data;
}

 @WebMethod(exclude = true)
    public static void main(String[] args) {

          Endpoint.publish(
             "http://localhost:8080/service/myservice",
             new MyServiceImpl ());

    }

}


and create a client for the web service

import javax.xml.namespace.QName;
import javax.xml.ws.Service;


public class Client {
  
    static QName serviceQName = new QName("http://MyService.entreprise.country/","MyServiceService");
    static Service myServiceService;
   
    public static void main(String[] args) {
      try {
          URL wsdlLocation= new URL("http://localhost:8080/service/myservice?WSDL");
          myServiceService=Service.create(wsdlLocation, serviceQName);
         
          Cliente client = new Cliente();
          client.doTest(args);
       
      } catch(Exception e) {
         
        e.printStackTrace();
      }
   }
  
   public void doTest(String[] args) {
       System.out.println(    " Data recieve ... " + myServiceService);
      
       MyService myService=myServiceService.getPort(MyService.class);
      
       String[] listofdatas=  myService.oneMethod("send datas");

       System.out.println(" incoming data .. :"+ listofdatas.length);
   }
}


it's to easy...

Friday, September 9, 2011

javax.wsdl.WSDLException: no content-type: java.net.UnknownServiceException

Whe you read a WSDL from local disc, no error, but if you read a wsdl from a URL throw a exception that: 

Retrieving document at  WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://localhost:8080/mifichero.wsdl'
no content-type: java.net.UnknownServiceException: no content-type

This error is fixed if change the  plugin reference javax.wsdl_1.5 by 
 javax.wsdl_1.6.2.v200806030405