各位大虾,我想单独使用ofbiz 的entity engine(ofbiz preview 3.0),请各位诊断一下:
1)ant build file(independbuild.xml ):
<?xml version="1.0"?>
<project name="OFBiz - Entity" default="jar" basedir=".">
<!-- ================================================================== -->
<!-- Initialization of all property settings -->
<!-- ================================================================== -->
<target name="init">
<property environment="env"/>
<property name="desc" value="Entity Component"/>
<property name="name" value="ofbiz-entity"/>
<property name="src.dir" value="src"/>
<property name="dtd.dir" value="dtd"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
</target>
<target name="classpath">
<path id="local.class.path">
<fileset dir="${lib.dir}" includes="*.jar"/>
<fileset dir="${lib.dir}/dbcp" includes="*.jar"/>
<fileset dir="${lib.dir}/jdbc" includes="*.jar"/>
<fileset dir="${lib.dir}/jotm" includes="*.jar"/>
<fileset dir="../../base/lib" includes="*.jar"/>
<fileset dir="../../base/lib/logging" includes="*.jar"/>
<fileset dir="../../base/build/lib" includes="*.jar"/>
<fileset dir="${build.dir}/lib" includes="*.jar"/>
<fileset dir="../entityext/build/lib" includes="*.jar"/>
<fileset dir="../service/build/lib" includes="*.jar"/>
<fileset dir="../security/build/lib" includes="*.jar"/>
<pathelement location="../../base/config" />
<pathelement location="."/>
<pathelement location="config"/>
<pathelement location="entitydef"/>
<pathelement location="../service/config"/>
<pathelement location="../security/config"/>
</path>
</target>
<!-- ========================================================================
Target: run
Runs Test as a stand-alone application.
========================================================================= -->
<target name="run"
description="Runs EntityEngine Test as a standalone app."
depends="init,classpath">
<java classname="org.ofbiz.entity.Test" fork="true">
<classpath refid="local.class.path"/>
</java>
</target>
</project>
2) Test.java File:
package org.ofbiz.entity;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.*;
public class Test {
public static void main(String[] args) {
System.out.println("Entered testFindByPrimaryKey");
//Instantiate the delegator.
GenericDelegator delegator = GenericDelegator.getGenericDelegator("default");
// Find book by primary key
try {
GenericValue party= delegator.findByPrimaryKey("SequenceValueItem",
UtilMisc.toMap("seqName", "Party"));
System.out.println("seqName=["+party.getString("seqName")+"] seqId=["+party.getString("seqId")+"]");
}catch (GenericEntityException ex1) {
}
return;
}
}
3)重新build entity engine
4)run -f independbuild.xml run 后出现如下信息:
D:\ofbiz\components\entity>ant -f independentbuild.xml run
Buildfile: independentbuild.xml
init:
classpath:
run:
[java] Entered testFindByPrimaryKey
[java] 0 [ GenericDelegator.java:137:INFO ] Creating new Delegator wit
h name "default".
[java] 1071 [ ComponentConfig.java:103:WARN ] No components were found,
something is probably missing or incorrect in the component-load setup.
[java] 1081 [ ModelReader.java:260:INFO ] FINISHED LOADING ENTITIES
- ALL FILES; Entities=0 ViewEntities=0 Fields=0 Relationships=0
[java] 1101 [ ComponentConfig.java:103:WARN ] No components were found,
something is probably missing or incorrect in the component-load setup.
[java] 1201 [ ServiceDispatcher.java:74 :INFO ] [ServiceDispatcher] : Crea
ting new instance.
[java] 1271 [ ComponentConfig.java:103:WARN ] No components were found,
something is probably missing or incorrect in the component-load setup.
[java] 1271 [ ComponentConfig.java:103:WARN ] No components were found,
something is probably missing or incorrect in the component-load setup.
[java] 1492 [ ServiceDispatcher.java:140:INFO ] [ServiceDispatcher.registe
r] : Registered dispatcher: entity-default
[java] 1502 [ ComponentConfig.java:103:WARN ] No components were found,
something is probably missing or incorrect in the component-load setup.
[java] 1502 [ GenericDispatcher.java:85 :INFO ] [LocalDispatcher] : Create
d Dispatcher for: entity-default
[java] 1502 [ ComponentConfig.java:103:WARN ] No components were found,
something is probably missing or incorrect in the component-load setup.
[java] 1502 [ JobPoller.java:85 :INFO ] JobPoller: (org.ofbiz.serv
ice.job.JobPoller@2b3d53) Thread Running...
[java] 1522 [ JmsListenerFactory.java:72 :INFO ] Starting JMS Listener Fact
ory Thread...
[java] 1542 [ GenericDelegator.java:280:ERROR] Error getting entity defin
ition from model
[java] org.ofbiz.entity.GenericModelException: Could not find definition fo
r entity name SequenceValueItem
[java] at org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader
.java:321)
[java] at org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDeleg
ator.java:278)
[java] at org.ofbiz.entity.GenericDelegator.makePK(GenericDelegator.jav
a:462)
[java] java.lang.IllegalArgumentException: [GenericDelegator.makePK] could
not find entity for entityName: SequenceValueItem
[java] at org.ofbiz.entity.GenericDelegator.makePK(GenericDelegator.jav
a:465)
[java] at org.ofbiz.entity.GenericDelegator.findByPrimaryKey(GenericDel
egator.java:600)
[java] at org.ofbiz.entity.GenericDelegator.findByPrimaryKey(GenericDel
egator.java:600)
[java] at org.ofbiz.entity.Test.main(Test.java:18)
[java] at org.ofbiz.entity.Test.main(Test.java:18)
[java] 1772 [ Jotm.java:98 :INFO ] JOTM started with a local
transaction factory which is not bound.
[java] 1782 [ Jotm.java:109:INFO ] CAROL initialization
[java] 2072 [ JobManager.java:123:ERROR] Cannot load jobs from data
source.
[java] org.ofbiz.entity.GenericModelException: Could not find definition fo
r entity name JobSandbox
[java] at org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader
.java:321)
[java] at org.ofbiz.entity.GenericDelegator.findByCondition(GenericDele
gator.java:985)
[java] at org.ofbiz.entity.GenericDelegator.findByAnd(GenericDelegator.
java:913)
[java] at org.ofbiz.service.job.JobManager.poll(JobManager.java:121)
[java] at org.ofbiz.service.job.JobPoller.run(JobPoller.java:89)
[java] at java.lang.Thread.run(Thread.java:536)
????????(Y/N)? y
D:\ofbiz\components\entity>
5)问题:如何才能找到SequenceValueItem的definition,不想让JobManager等出来?
谢谢
conan8chan@yahoo.com