雇员.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;
.....
日程安排.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 增强器(版本 3.1.0.release):类的增强 “com.co.dsp.iwork.entity.EmployeeSchedule”类具有元数据,但找不到该类。请检查您的 CLASSPATH 规范。DataNucleus Enhancer 完成但出现错误。请查看增强器日志以获取完整详细信息。某些类可能已得到增强,但某些类导致了 dataneucleaus 日志显示的错误: - 类“com.co.dsp.iwork.entity.EmployeeSchedule”:填充元数据 13:22:59,059(主)调试 [DataNucleus.MetaData] -类“com.co.dsp.iwork.entity.EmployeeSchedule”字段“员工”:为嵌入类“com.co.dsp.iwork.entity.EmployeeSchedulePK”中的字段添加元数据,因为它没有出现在元数据中定义。13:22:59,059(主)调试 [DataNucleus.MetaData] - 类“com.co.dsp.iwork.entity. 13:22:59,060(主要)错误 [DataNucleus.MetaData] - *类“com.co.dsp.iwork.entity.#UNKNOWN.id”具有元数据,但找不到该类。请检查您的 CLASSPATH 规范。* 13:22:59,061(主要)调试 [DataNucleus.MetaData] - org.datanucleus.metadata.InvalidClassMetaDataException:类“com.co.dsp.iwork.entity.EmployeeSchedule”具有元数据,但找不到该类。请检查您的 CLASSPATH 规范。13:22:59,063(主要)错误 [DataNucleus.Enhancer] - DataNucleus 增强器完成但出现错误。请查看增强器日志以获取完整详细信息。某些类可能已得到增强,但某些导致错误类“com.co.dsp.iwork.entity.EmployeeSchedule”具有元数据,但找不到该类。请检查您的 CLASSPATH 规范。org.datanucleus.metadata.InvalidClassMetaDataException:类“com.co.dsp.iwork.entity.EmployeeSchedule”具有元数据,但找不到该类。请检查您的 CLASSPATH 规范。在 org.datanucleus.metadata.ClassMetaData。
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