无法为HardSoftScoreHibernateType添加TypeDef注释以保持分数

时间:2017-03-12 14:06:47

标签: optaplanner kie-wb

我正在尝试将HardSoftScore作为整数列保留,如https://www.javacodegeeks.com/2015/09/integrating-jpa-hibernate-with-optaplanner.html中所述。但是,在包含以下语句时,我收到以下错误

Only a type can be imported. org.optaplanner.persistence.jpa.impl.score.buildin.hardsoft.HardSoftScoreHibernateType resolves to a package

添加TypeDef注释。

构建时出错

    $(document).ready(function () {

      function reorient(e) {
        var orientation = window.screen.orientation.type;
        $("body > div").css("-webkit-transform", (orientation == 'landscape-primary' || orientation == 'landscape-secondary') ? "rotate(-90deg)" : "");
      }
    $(window).on("orientationchange",function(){
        reorient();
    });
      window.setTimeout(reorient, 0);
    });

我正在使用kie-wb 7.0.0.Beta6来创建optaplanner项目。

2 个答案:

答案 0 :(得分:0)

optaplanner-persistence-jpa中添加pom.xml依赖项,以便将该jpa支持用于optaplanner。

Xstream是通过optaplanner-core的瞬态依赖 - 您不必手动添加它。

Jettison通常不需要。

mvn help:effective-pom检查您的有效pom - 您可能会从降低XStream版本等的某个父pom继承。还要mvn dependency:tree -Dverbose确定谁在确定xstream版本。< / p>

答案 1 :(得分:0)

下面是我的pom.xml。我只将kie-maven-plugin插件版本从7.0.0-SNAPSHOT(由系统生成)更改为7.0.0.Beta6并添加了optaplanner-persistence-jpa依赖。

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.optaplanner.examples</groupId>
  <artifactId>cloud-balancing</artifactId>
  <version>1.0</version>
  <packaging>kjar</packaging>
  <name>cloud-balancing</name>
  <repositories>
    <repository>
      <id>guvnor-m2-repo</id>
      <name>Guvnor M2 Repo</name>
      <url>http://localhost:8080/jbpm-console/maven2/</url>
    </repository>
  </repositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.kie</groupId>
        <artifactId>kie-maven-plugin</artifactId>
        <version>7.0.0.Beta6</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <!-- https://mvnrepository.com/artifact/org.optaplanner/optaplanner-persistence-jpa -->
    <dependency>
      <groupId>org.optaplanner</groupId>
      <artifactId>optaplanner-persistence-jpa</artifactId>
      <version>7.0.0.Beta6</version>
    </dependency>  
  </dependencies>
</project>

mvn help:effective-pom

    [INFO] --- maven-help-plugin:2.2:effective-pom (default-cli) @ cloud-balancing ---
    Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools-api/2.4.3/maven-plugin-tools-api-2.4.3.pom
    Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools-api/2.4.3/maven-plugin-tools-api-2.4.3.pom (5 KB at 10.6 KB/sec)
    Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools/2.4.3/maven-plugin-tools-2.4.3.pom
    Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools/2.4.3/maven-plugin-tools-2.4.3.pom (10 KB at 19.8 KB/sec)
    Downloading: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.4.3/xstream-1.4.3.pom
    Downloaded: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.4.3/xstream-1.4.3.pom (9 KB at 17.9 KB/sec)
    Downloading: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream-parent/1.4.3/xstream-parent-1.4.3.pom
    Downloaded: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream-parent/1.4.3/xstream-parent-1.4.3.pom (19 KB at 30.1 KB/sec)
    Downloading: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.4.3/xstream-1.4.3.jar
    Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools-api/2.4.3/maven-plugin-tools-api-2.4.3.jar
    Downloaded: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.4.3/xstream-1.4.3.jar (471 KB at 343.4 KB/sec)
    Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools-api/2.4.3/maven-plugin-tools-api-2.4.3.jar (51 KB at 27.5 KB/sec)
    [INFO]
    Effective POMs, after inheritance, interpolation, and profiles are applied:

在有效POM中没有引用Xstream,除了日志显示xstream-1.4.3.jar已下载。

mvn依赖:tree -Dverbose显示com.thoughtworks.xstream:xstream:jar:1.4.9是org.optaplanner的依赖:optaplanner-core

重启服务器后,收到了很多警告,如下面的

    2017-03-13 23:45:28,539 INFO  [org.drools.compiler.kie.builder.impl.KieRepositoryImpl] (EJB default - 2) KieModule was added: ZipKieModule[releaseId=org.optaplanner.examples:cloud-balancing:1.0,file=C:\Users\User\.m2\repository\org\optaplanner\examples\cloud-balancing\1.0\cloud-balancing-1.0.jar]
    2017-03-13 23:45:30,399 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unexpected error while create instance of type org.optaplanner.core.api.score.holder.AbstractScoreHolder$DoubleConstraintUndoListener due to org.optaplanner.core.api.score.holder.AbstractScoreHolder and org.optaplanner.core.api.score.holder.AbstractScoreHolder$DoubleConstraintUndoListener disagree on InnerClasses attribute
    2017-03-13 23:45:30,400 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unexpected error while create instance of type org.optaplanner.core.api.score.holder.AbstractScoreHolder$MultiLevelActivationUnMatchListener due to org.optaplanner.core.api.score.holder.AbstractScoreHolder and org.optaplanner.core.api.score.holder.AbstractScoreHolder$MultiLevelActivationUnMatchListener disagree on InnerClasses attribute
    2017-03-13 23:45:30,400 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unexpected error while create instance of type org.optaplanner.core.api.score.holder.AbstractScoreHolder$LongConstraintUndoListener due to org.optaplanner.core.api.score.holder.AbstractScoreHolder and org.optaplanner.core.api.score.holder.AbstractScoreHolder$LongConstraintUndoListener disagree on InnerClasses attribute
    2017-03-13 23:45:30,401 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unexpected error while create instance of type org.optaplanner.core.api.score.holder.AbstractScoreHolder$IntConstraintUndoListener due to org.optaplanner.core.api.score.holder.AbstractScoreHolder and org.optaplanner.core.api.score.holder.AbstractScoreHolder$IntConstraintUndoListener disagree on InnerClasses attribute
    2017-03-13 23:45:30,401 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unexpected error while create instance of type org.optaplanner.core.api.score.holder.AbstractScoreHolder$BigDecimalConstraintUndoListener due to org.optaplanner.core.api.score.holder.AbstractScoreHolder and org.optaplanner.core.api.score.holder.AbstractScoreHolder$BigDecimalConstraintUndoListener disagree on InnerClasses attribute
    2017-03-13 23:45:30,515 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unexpected error while create instance of type ch.qos.logback.classic.boolex.EvaluatorTemplate due to groovy/lang/GroovyObject
    2017-03-13 23:45:30,532 WARN  [org.jboss.modules] (EJB default - 2) Failed to define class org.dom4j.xpp.ProxyXmlStartTag in Module "deployment.kie-server.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/dom4j/xpp/ProxyXmlStartTag (Module "deployment.kie-server.war:main" from Service Module Loader): org/gjt/xpp/XmlStartTag
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
            at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
            at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
            at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
            at org.jboss.modules.Module.loadModuleClass(Module.java:605)
            at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
            at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
            at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:348)
            at org.drools.core.common.ProjectClassLoader.internalLoadClass(ProjectClassLoader.java:158)
            at org.drools.core.common.ProjectClassLoader.loadClass(ProjectClassLoader.java:141)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
            at org.kie.server.services.drools.DroolsKieServerExtension.createContainer(DroolsKieServerExtension.java:108)
            at org.kie.server.services.impl.KieServerImpl.createContainer(KieServerImpl.java:280)
            at org.kie.server.services.impl.ContainerManager.installContainersSync(ContainerManager.java:43)
            at org.kie.server.services.impl.ContainerManager.installContainers(ContainerManager.java:33)
            at org.kie.server.jms.ContainerManagerEJB.installContainers(ContainerManagerEJB.java:38)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:497)
            at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)
            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:103)
            at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:58)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
            at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:73)
            at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
            at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.singleton.SingletonComponentInstanceAssociationInterceptor.processInvocation(SingletonComponentInstanceAssociationInterceptor.java:53)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
            at org.jboss.as.ejb3.concurrency.ContainerManagedConcurrencyInterceptor.processInvocation(ContainerManagedConcurrencyInterceptor.java:110)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
            at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
            at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
            at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
            at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
            at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.interceptors.LogDiagnosticContextRecoveryInterceptor.processInvocation(LogDiagnosticContextRecoveryInterceptor.java:82)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
            at org.jboss.as.ejb3.component.interceptors.AsyncFutureInterceptorFactory$1$2.runInvocation(AsyncFutureInterceptorFactory.java:101)
            at org.jboss.as.ejb3.component.interceptors.AsyncInvocationTask.run(AsyncInvocationTask.java:74)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
            at org.jboss.threads.JBossThread.run(JBossThread.java:320)

    2017-03-13 23:45:30,534 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unexpected error while create instance of type org.dom4j.xpp.ProxyXmlStartTag due to Failed to link org/dom4j/xpp/ProxyXmlStartTag (Module "deployment.kie-server.war:main" from Service Module Loader): org/gjt/xpp/XmlStartTag
    2017-03-13 23:45:31,012 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unexpected error while create instance of type org.drools.core.reteoo.RuleTerminalNode$RTNCleanupAdapter due to org.drools.core.reteoo.RuleTerminalNode and org.drools.core.reteoo.RuleTerminalNode$RTNCleanupAdapter disagree on InnerClasses attribute
    2017-03-13 23:45:31,057 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unable to create instance of type org.apache.xmlcommons.Version due to org.apache.xmlcommons.Version
    2017-03-13 23:45:31,153 WARN  [org.kie.server.services.drools.DroolsKieServerExtension] (EJB default - 2) Unable to create instance of type javax.xml.stream.FactoryFinder$ConfigurationError due to javax.xml.stream.FactoryFinder$ConfigurationError
    2017-03-13 23:45:31,350 WARN  [org.jboss.modules] (EJB default - 2) Failed to define class com.thoughtworks.xstream.converters.reflection.CGLIBEnhancedConverter$ReverseEngineeredCallbackFilter in Module "deployment.kie-server.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter$ReverseEngineeredCallbackFilter (Module "deployment.kie-server.war:main" from Service Module Loader): net/sf/cglib/proxy/CallbackFilter