Dúvidas do ANT - BUILD FAILED: java.lang.NoClassDefFoundError

1 resposta
ivanmc

Alguém tem uma dica ?

Buildfile: C:\java\eclipse\workspace\FTU\build.xml

createtables:

[schemaexport] (cfg.Environment 478 ) Hibernate 2.1.7

[schemaexport] (cfg.Environment 512 ) loaded properties from resource hibernate.properties: {hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.query.substitutions=true 1, false 0, yes Y, no N, hibernate.cache.region_prefix=hibernate.test, hibernate.c3p0.idle_test_period=3000, hibernate.show_sql=true, hibernate.proxool.pool_alias=pool1, hibernate.c3p0.max_statements=50, hibernate.jdbc.batch_size=0, hibernate.c3p0.timeout=300, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.jdbc.use_streams_for_binary=true, hibernate.c3p0.min_size=5, hibernate.connection.pool_size=1, hibernate.connection.username=root, hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cache.provider_class=net.sf.hibernate.cache.EhCacheProvider, hibernate.c3p0.max_size=20, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql:///ftu}

[schemaexport] (cfg.Environment 537 ) using <a href="http://java.io">java.io</a> streams to persist binary types

[schemaexport] (cfg.Environment 538 ) using CGLIB reflection optimizer

[schemaexport] (cfg.Environment 567 ) using JDK 1.4 java.sql.Timestamp handling

[schemaexport] (cfg.Configuration 169 ) Mapping file: C:\java\eclipse\workspace\FTU\WEB-INF\classes\br\edu\ftu\modelo\Email.hbm.xml

[schemaexport] (cfg.Binder 230 ) Mapping class: br.edu.ftu.modelo.Email -> email

[schemaexport] (cfg.Configuration 169 ) Mapping file: C:\java\eclipse\workspace\FTU\WEB-INF\classes\br\edu\ftu\modelo\Usuario.hbm.xml

[schemaexport] (cfg.Binder 230 ) Mapping class: br.edu.ftu.modelo.Usuario -> usuario

BUILD FAILED: java.lang.NoClassDefFoundError: br/edu/ftu/modelo/email (wrong name: br/edu/ftu/modelo/Email)

Total time: 1 second

Meu classpath está assim: .;%JAVA_HOME%\lib
java_home = C:\Arquivos de programas\Java\jre1.5.0_02\

A classe é essa:

public class Email {

private long id;

private String conta;

private String provedor;

private Integer ativo;

private Integer principal;

private Date timestamp;

private Usuario usuario;

/**

  • @return Returns the id.
  • @hibernate.id
  • generator-class = “sequence”
  • column = “id”
  • @hibernate.generator-param
  • name=“sequence”
  • value=“id_email”
    /
    public long getId() {
    return id;
    }
    /
    *
  • @return Returns the ativo.
  • @hibernate.property
  • column=“ativo”
  • not-null=“true”
    /
    public Integer isAtivo() {
    return ativo;
    }
    /
    *
  • @return Returns the principal.
  • @return Returns the ativo.
  • @hibernate.property
  • column=“principal”
  • not-null=“true”
    /
    public Integer isPrincipal() {
    return principal;
    }
    /
    *
  • @return Returns the provedor.
  • @hibernate.property
  • column=“provedor”
  • not-null=“true”
  • type=“string”
  • length=“50”
    /
    public String getProvedor() {
    return provedor;
    }
    /
    *
  • @return Returns the conta de usuario.
  • @hibernate.property
  • column=“conta”
  • not-null=“true”
  • type=“string”
  • length=“50”
    /
    public String getConta() {
    return conta;
    }
    /
    *
  • @return Returns the timestamp.
  • @hibernate.timestamp
  • name=“timestamp”
  • column=“TIMESTAMP”
  • not-null=“false”
    /
    public Date getTimestamp() {
    return timestamp;
    }
    /
    *
  • @param ativo The ativo to set.
    */
public void setAtivo(Integer ativo) {

this.ativo = ativo;

}

/**
  • @param id The id to set.
    /
    public void setId(long id) {
    this.id = id;
    }
    /
    *
  • @param principal The principal to set.
    /
    public void setPrincipal(Integer principal) {
    this.principal = principal;
    }
    /
    *
  • @return Returns the usuario.
    /
    public Usuario getUsuario() {
    return usuario;
    }
    /
    *
  • @param provedor The provedor to set.
    /
    public void setProvedor(String provedor) {
    this.provedor = provedor;
    }
    /
    *
  • @param usuario The usuario to set.
    /
    public void setConta(String conta) {
    this.conta = conta;
    }
    /
    *
  • @param usuario The usuario to set.
    /
    public void setUsuario(Usuario usuario) {
    this.usuario = usuario;
    }
    /
    *
  • @param timestamp The timestamp to set.
    /
    public void setTimestamp(Date timestamp) {
    this.timestamp = timestamp;
    }
    /
    *
  • @param ponteiroDeArquivoXML
  • envia email para a conta de email
    */
    public void enviaEmail(String ponteiroDeArquivoXML){
    // pega configuração de sendmail em sendmail.xml
    // pega arquivo XML com mensagem
    // recolhe titulo da mensagem
    // recolhe corpo da mensagem
    // recolhe endereço para reply
    // monta mensagem
    // envia mensagem para [email removido]
    }
    }

o propertie.hibernate esta assim:

MySQL

hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
#hibernate.connection.driver_class org.gjt.mm.mysql.Driver
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql:///ftu
hibernate.connection.username root
hibernate.connection.password *****

meu hbx: C:\java\eclipse\workspace\ftu\WEB-INF\classes\br\edu\ftu\modelo

<?xml version="1.0" ?>
id_email - <!-- To add non XDoclet property mappings, create a file named hibernate-properties-Email.xml containing the additional properties and place it in your merge dir.

–>

O build :

value

1 Resposta

keller

NoClassDefFoundError se dá pelo caminho errado da classe hbm xml ou seilá o que… verifique-o.

*O %JAVA_HOME% deve apontar para o diretorio de instalação da JDK e nao da JRE!

Criado 14 de maio de 2005
Ultima resposta 15 de mai. de 2005
Respostas 1
Participantes 2