Hi All,

It's a couple of days I'm hitting my head against a wall!
why do I get this message when invoking PCEnhancer both from
command line and as an ant task?

Exception in thread "main"
java.lang.IllegalArgumentException:
java.lang.ClassNotFoundException: model.Visitor
        at serp.util.Strings.toClass(Strings.java:164)
        at serp.util.Strings.toClass(Strings.java:108)
        at
org.apache.openjpa.lib.meta.ClassArgParser.parseTypes(ClassArgParser.java:164)
        at
org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4328)
        at
org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4291)
        at
org.apache.openjpa.enhance.PCEnhancer.main(PCEnhancer.java:4263)
..... ......

>From what I can see the class model.Visitor is found, so I
can't understand what SERP complains for.

I build some other web apps using Springframework 2.5, the
Tomcat load time weaver and they work. Now I wanted to use
enhanced classes but I'm still.

Anyone can help me?

Thanks,

AM

Here follows my command line

export
CLASSPATH=./openjpa-1.0.1.jar:./lib/geronimo-jpa_3.0_spec-1.0.jar:./lib/geronimo-jta_1.1_spec-1.1.jar:./lib/geronimo-jms_1.1_spec-
1.0.1.jar:./lib/serp-1.13.1.jar:./lib/commons-collections-3.2.jar:./lib/commons-lang-2.1.jar:./lib/commons-logging-1.0.4.jar:./lib/common
s-pool-1.3.jar:$HOME/NetBeansProjects/TestApp2Model/src


java org.apache.openjpa.enhance.PCEnhancer \
-p
/home/java/NetBeansProjects/TestApp2Model/src/META-INF/persistence.xml
\
-d /home/java/NetBeansProjects/TestApp2Model/src/enhanced \
/home/java/NetBeansProjects/TestApp2Model/src/**/*.java

........................................................................

this is my ant target used inNetBeans 6.0

<target name="-pre-compile">
        
    <property name="jpa-home"
value="${user.home}/NetBeansProjects/java-libraries/apache-openjpa-1.0.1"/>
    
    <path id="jpa.classpath">
        <pathelement path="${jpa-home}/openjpa-1.0.1.jar"/>
        <fileset dir="${jpa-home}/lib">
            <include name="*.jar"/>
        </fileset>
    </path>
    
    <taskdef name="openjpac"
classname="org.apache.openjpa.ant.PCEnhancerTask">
        <classpath refid="jpa.classpath"/>
    </taskdef>
    
    <openjpac directory="${basedir}/src/enhanced">
        
        <config
propertiesFile="${basedir}/src/META-INF/persistence.xml"/>
        <fileset dir="${basedir}/src">
            <include name="model/*.java"/>
        </fileset>
    </openjpac>
    
    </target>
..................................................

this is the class source

package model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Andrea Martano
 */
@Entity
@Table(name = "visitors")
@NamedQueries({
@NamedQuery(name = "findAllVisitors", query = "SELECT v FROM
Visitor v ORDER BY v.id")
})
public class Visitor implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "firstname")
    private String firstname;
    @Column(name = "lastname")
    private String lastname;
    @Column(name = "email")
    private String email;
    
    public Visitor() {}
    
    public Visitor(String firstname, String lastname, String
email) {
        setFirstname(firstname);
        setLastname(lastname);
        setEmail(email);
    }
    
    public void setId(Long id) {
        this.id = id;
    }

    
    public Long getId() {
        return id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the
case the id fields are not set
        if (!(object instanceof Visitor)) {
            return false;
        }
        Visitor other = (Visitor) object;
        if ((this.getId() == null && other.getId() != null)
|| (this.getId() != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Visitor[id=" + getId() + "]";
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

}


Reply via email to