有MetaData但是找不到类

时间:2012-09-26 23:37:05

标签: maven jpa many-to-many datanucleus

Employee.java

@Entity
@Table(name="EMPLOYEE", 
uniqueConstraints = { @UniqueConstraint(columnNames={"EMPNO"}) })
public class Employee implements Serializable {
@Id
@Column(name="EMPNO")
private String empNo;
@Column(name="FIRSTNAME")
private String firstName;
@Column(name="midInit")
private char midInit;
@Column(name="LASTNAME")
private String lastName;
@OneToMany(fetch=FetchType.LAZY, mappedBy = "id.employee")
Set<EmployeeSchedule> schedules;
.....

Schedule.java

@Entity
@Table(name="SCHEDULE_SLOT", uniqueConstraints = { @UniqueConstraint      
  (columnNames=        {"SLOTNO"})})
public class ScheduleSlot implements Serializable{
@Id @Column(name="SLOTNO")
private String slotNo;
@Column(name="SLOTSTART")
private Date slotStart;
@Column(name="SLOTEND")
private Date slotEnd;
@OneToMany(fetch=FetchType.LAZY, mappedBy="id.schedule")
private Set<Employee> employees ;//= new HashSet<Employee>() ;
....

EmployeeSchedule.java

@Entity
@Table(name="EMPLOYEE_SCHEDULE")
@AssociationOverrides(
    { @AssociationOverride 
        (   name = "id.employee", 
            joinColumns = @JoinColumn(name = "empNo")), 
      @AssociationOverride
        (   name = "id.schedule", 
            joinColumns = @JoinColumn(name = "slotNo"))     
    }) 
public class EmployeeSchedule {
@EmbeddedId 
EmployeeSchedulePK id;
@Column(name="available")
private boolean available;
@Column(name="UPDATEDON")
private Date updatedOn;
@Column(name="UPDATEDBY")
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="updatedBy")
private String updatedBy;

public EmployeeSchedule() {}

public EmployeeSchedule(EmployeeSchedulePK id) {
    this.id = id;
}
......

EmployeeSchedulePK .java

@Embeddable
public class EmployeeSchedulePK implements Serializable {
@ManyToOne 
private Employee employee;
@ManyToOne 
private ScheduleSlot schedule;
public EmployeeSchedulePK() {
}

...

在进行maven安装时,我收到以下错误。请指教..谢谢

DataNucleus Enhancer(版本3.1.0.release):增强类 Class&#34; com.co.dsp.iwork.entity.EmployeeSchedule&#34;有MetaData但是找不到类。请检查您的CLASSPATH规范。 DataNucleus Enhancer已完成,但出现错误。请查看增强器日志以获取完整详细信息。某些类可能已得到增强,但有些类会导致错误 dataneucleaus日志显示: - Class&#34; com.co.dsp.iwork.entity.EmployeeSchedule&#34; :填充元数据 13:22:59,059(主要)DEBUG [DataNucleus.MetaData] - Class&#34; com.co.dsp.iwork.entity.EmployeeSchedule&#34;领域&#34;员工&#34; :为类中包含的字段添加元数据&#34; com.co.dsp.iwork.entity.EmployeeSchedulePK&#34;因为它没有出现在元数据定义中。 13:22:59,059(主要)DEBUG [DataNucleus.MetaData] - Class&#34; com.co.dsp.iwork.entity.EmployeeSchedule&#34;字段&#34; schedule&#34; :为类中包含的字段添加元数据&#34; com.co.dsp.iwork.entity.EmployeeSchedulePK&#34;因为它没有出现在元数据定义中。 13:22:59,060(主要)ERROR [DataNucleus.MetaData] - * Class&#34; com.co.dsp.iwork.entity。#UNKNOWN.id&#34;有MetaData但是找不到类。 请检查您的CLASSPATH规范。 * 13:22:59,061(主要)DEBUG [DataNucleus.MetaData] - org.datanucleus.metadata.InvalidClassMetaDataException:Class&#34; com.co.dsp.iwork.entity.EmployeeSchedule&#34;有MetaData但是找不到类。请检查您的CLASSPATH规范。 13:22:59,063(主要)ERROR [DataNucleus.Enhancer] - DataNucleus Enhancer已完成,但出现错误。请查看增强器日志以获取完整详细信息。某些类可能已得到增强,但有些类会导致错误 Class&#34; com.co.dsp.iwork.entity.EmployeeSchedule&#34;有MetaData但是找不到类。请检查您的CLASSPATH规范。 org.datanucleus.metadata.InvalidClassMetaDataException:Class&#34; com.co.dsp.iwork.entity.EmployeeSchedule&#34;有MetaData但是找不到类。请检查您的CLASSPATH规范。     at org.datanucleus.metadata.ClassMetaData.populateMemberMetaData(ClassMetaData.java:464)     在org.datanucleus.metadata.ClassMetaData.populate(ClassMetaData.java:210)     在org.datanucleus.metadata.MetaDataManager $ 1.run(MetaDataManager.java:2699)     at java.security.AccessController.doPrivileged(Native Method)     at org.datanucleus.metadata.MetaDataManager.populateAbstractClassMetaData(MetaDataManager.java:2693)     at org.datanucleus.metadata.MetaDataManager.populateFileMetaData(MetaDataManager.java:2516)     在org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:1123)     在org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:986)     at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:793)     在org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:525)     在org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1258)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     在java.lang.reflect.Method.invoke(Method.java:597)     at org.datanucleus.maven.AbstractDataNucleusMojo.executeInJvm(AbstractDataNucleusMojo.java:333)     at org.datanucleus.maven.AbstractEnhancerMojo.enhance(AbstractEnhancerMojo.java:249)     at org.datanucleus.maven.AbstractEnhancerMojo.executeDataNucleusTool(AbstractEnhancerMojo.java:72)     at org.datanucleus.maven.AbstractDataNucleusMojo.execute(AbstractDataNucleusMojo.java:126)     在org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)     在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)     在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)     在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)     在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)     在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)     在org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)     在org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)     在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)     在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)     在org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)     在org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)     在org.apache.maven.cli.MavenCli.main(MavenCli.java:141)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     在java.lang.reflect.Method.invoke(Method.java:597)     在org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)     在org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)     在org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)     在org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

POM.xml: -

 <?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0   
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.co.dsp</groupId>
<artifactId>dsp.dsp-iwork</artifactId>
<version>0.6.0-SNAPSHOT</version>
<name>DSP-iWork</name>
<packaging>jar</packaging>
<properties>
    <maven.test.skip>true</maven.test.skip>
    <dsp.version>0.6.0-SNAPSHOT</dsp.version>
    <equinox.ver>3.7.0.v20110613</equinox.ver>
<spring.maven.artifact.version>3.0.5.RELEASE</spring.maven.artifact.version>
    <slf4j.version>1.6.1</slf4j.version>
    <spring.osgi.version>1.2.1</spring.osgi.version>
</properties>
<dependencies>
    <dependency><groupId>com.co.dsp</groupId>
        <artifactId>dsp.kernel</artifactId>
        <version>${dsp.version}</version>
    </dependency>
<dependency><groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-core</artifactId>
        <version>3.1.1</version>
        <scope>runtime</scope>
    </dependency><dependency><groupId>com.co.dsp</groupId>
        <artifactId>dsp.dsi.das.dbconnection</artifactId>
        <version>${dsp.version}</version>
    </dependency><dependency>
        <groupId>com.co.dsp</groupId>
        <artifactId>dsp.dsi.das.core</artifactId>
        <version>${dsp.version}</version>
    </dependency>
    <dependency><groupId>com.co.dsp</groupId>
        <artifactId>dsp.dsi.das.api</artifactId>
        <version>${dsp.version}</version>
    </dependency>
    <dependency><groupId>com.co.dsp</groupId>
        <artifactId>dsp.dsi.dups.core</artifactId>
        <version>${dsp.version}</version>
    </dependency><dependency>
        <groupId>com.co.dsp</groupId>
        <artifactId>dsp.dsi.dups.api</artifactId>
        <version>${dsp.version}</version>
    </dependency><dependency>
        <groupId>com.co.dsp</groupId>
        <artifactId>dsp.dsi.scheduler</artifactId>
        <version>${dsp.version}</version>
    </dependency><dependency>
        <groupId>com.co.dsp</groupId>
        <artifactId>das-maven-plugin</artifactId>
        <version>${dsp.version}</version>
    </dependency>
</dependencies>
<repositories>
    <repository><id>nexus</id>
<url>http://sjc1ssadsp01.crd.co.com:8081/nexus/content/groups/public</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>nexus</id>
<url>http://sjc1ssadsp01.crd.co.com:8081/nexus/content/groups/public</url>
    </pluginRepository>
    <pluginRepository>
        <id>maven-repo</id>
        <name>maven repo</name>
        <url>http://repo.maven.apache.org/maven2/</url>
    </pluginRepository>
    <pluginRepository>
        <id>com.springsource.repository.bundles.milestone</id>
<name> SpringSource Enterprise Bundle Repository - SpringSource Milestone 
Releases</name>
<url>http://repository.springsource.com/maven/bundles/milestone</url>
    </pluginRepository>
</pluginRepositories>
<build><plugins><plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<fork>false</fork>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
<enhancerName>ASM</enhancerName>
<persistenceUnitName>WorkPersistenceUnit</persistenceUnitName>
</configuration><executions><execution>
<phase>compile</phase><goals><goal>enhance</goal></goals></execution></executions>
</plugin><plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>false</extensions><executions>  <execution>
<id>bundle</id> <phase>package</phase><goals>
<goal>bundle</goal></goals></execution></executions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>DSP iWork Integration</Bundle-Name>
<Bundle-Version>${dsp.version}</Bundle-Version>
<Bundle-Classpath>.</Bundle-Classpath>
<Import-Package>javax.persistence,com.co.dsp.dsi.scheduler,org.apache.log4j,
com.co.dsp.kernel.spi;version="0.3",com.co.dsp.kernel.util;version="0.3",
com.co.dsp.dsi.dups.api;version="0.3",com.co.dsp.dsi.dups.constants;version="0.3",
com.co.dsp.dsi.dups.exception,com.co.dsp.dsi.config,org.springframework.beans.factory,
org.springframework.osgi.context,org.springframework.osgi.util,
org.osgi.framework;version="1.5",com.co.dsp.dsi.das.api,javax.jdo, 
javax.jdo.identity, javax.jdo.spi</Import-Package></instructions></configuration>
</plugin></plugins>
    </build>
</project>

执行后更新部分消息:mvn clean process-classes -X

   [DEBUG]Writing resolution tracking file C:\Users\502128830\.m2
\repository\asm\asm\resolver-status.properties
[DEBUG]Could not find metadata asm:asm/maven-metadata.xml in 
com.springsource.repository.bundles.milestone 
(http://repository.springsource.com/maven/bundles/milestone)
[DEBUG]Could not find metadata asm:asm/maven-metadata.xml in DN_M2_Repo 
(http://www.datanucleus.org/downloads/maven2/)
[WARNING]Could not transfer metadata asm:asm/maven-metadata.xml from/to 
local.repository (file:../../local.repository/trunk): No connector available to access 
repository     local.repository (file:../../local.repository/trunk) of type leg
acy using the available factories WagonRepositoryConnectorFactory
org.sonatype.aether.transfer.MetadataTransferException: Could not transfer metadata 
asm:asm/maven-metadata.xml from/to local.repository         
(file:../../local.repository/trunk): No connector available to access repository 
local.repository (
file:../../local.repository/trunk) of type legacy using the available factories 
WagonRepositoryConnectorFactory
        at org.sonatype.aether.impl.internal.DefaultMetadataResolver$ResolveTask.run
(DefaultMetadataResolver.java:588)
        at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run
(RunnableErrorForwarder.java:60)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.sonatype.aether.transfer.NoRepositoryConnectorException: No connector 
available to access repository local.repository (file:../../local.repository/trunk) 
of     type legacy using the available factories WagonRepositoryConnec
torFactory
        at 
org.sonatype.aether.impl.internal.DefaultRemoteRepositoryManager.getRepositoryConnector
(DefaultRemoteRepositoryManager.java:400)
        at org.sonatype.aether.impl.internal.DefaultMetadataResolver$ResolveTask.run
(DefaultMetadataResolver.java:559)
        ... 4 more
[DEBUG]Could not find metadata asm:asm/maven-metadata.xml in local (C:\Users\502128830
\.m2\repository)


[INFO]--- maven-datanucleus-plugin:3.0.1:enhance (default) @ dsp.dsp-iwork ---
[DEBUG]Could not find metadata org.datanucleus:datanucleus-core/maven-metadata.xml in 
local (C:\Users\502128830\.m2\repository)
 [WARNING]Could not transfer metadata asm:asm/maven-metadata.xml from/to 
local.repository (file:../../local.repository/trunk): No connector available to access 
repository     
local.repository (file:../../local.repository/trunk) of type leg
acy using the available factories WagonRepositoryConnectorFactory
org.sonatype.aether.transfer.MetadataTransferException: Could not transfer metadata 
asm:asm/maven-metadata.xml from/to local.repository     
(file:../../local.repository/trunk): No connector available to access repository 
local.repository (
file:../../local.repository/trunk) of type legacy using the available factories 
WagonRepositoryConnectorFactory
at org.sonatype.aether.impl.internal.DefaultMetadataResolver$ResolveTask.run
(DefaultMetadataResolver.java:588)
at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run
(RunnableErrorForwarder.java:60)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.sonatype.aether.transfer.NoRepositoryConnectorException: No connector 
available to access repository local.repository (file:../../local.repository/trunk) 
of  type legacy using the available factories WagonRepositoryConnec
torFactory
        at 
org.sonatype.aether.impl.internal.DefaultRemoteRepositoryManager.getRepositoryConnector
(DefaultRemoteRepositoryManager.java:400)
        at org.sonatype.aether.impl.internal.DefaultMetadataResolver$ResolveTask.run
(DefaultMetadataResolver.java:559)
        ... 4 more

1 个答案:

答案 0 :(得分:0)

你能发贴你的pom吗?

您希望使用DataNucleus Enhancer处理字节码。

你的插件必然会编译阶段,这是错误的,因为它适用于已编译的类。

您应该将其绑定到流程类。