When I first set up the sample hello world application I get errors in the rules/sample.drl files
The error is as follows:
Rule Compilation error Only a type can be imported. com.sample.DroolsTest.Message resolves to a package
Only a type can be imported. org.drools.core.spi.KnowledgeHelper resolves to a package
KnowledgeHelper cannot be resolved to a type
com.sample.DroolsTest.Message cannot be resolved to a type
org.kie.api.runtime.rule.FactHandle cannot be resolved to a type
org.kie.api.runtime.rule.FactHandle cannot be resolved to a type
java.lang.Exception cannot be resolved to a type
org.kie.api.runtime.rule.RuleContext cannot be resolved to a type
Message.GOODBYE cannot be resolved to a type
org.drools.core.util.bitmask.AllSetBitMask cannot be resolved to a type
com.sample.DroolsTest.Message cannot be resolved to a type
Also I fixed the error when I write dialect "mvel"
but for some reason I am not okay with this quick fix.
Am I missing some plugin or dependencies?
I am a newbie to drools rule engine and I followed all steps correctly.
Yes the most possible explanation is that you have missed some depedencies.
You need to include drools-core for example:
Only a type can be imported. org.drools.core.spi.KnowledgeHelper resolves to a package
suggests that Rules does not have access to KnowledgeHelper and tries to import it as a package.
Same thing happens with:
org.kie.api.runtime.rule.RuleContext
and kie-api depedency.
If you use Eclipse or some other IDE and started a new drools project then maybe drools library is not in build path.
Related
I'm trying to call a simple REST API in Talend. I've tried the tRestClient component but ran into problems (see here). Now i'm trying to use the tRest component but get a different error.
Talend error
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey.client cannot be resolved to a variable
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey.api.client.Client cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
My Talend job is just a tRest into a tLogRow. The tRest component is configured with the API call URL, HTTP Method GET, and i've added HTTP Headers "Accept" "application/*****.1.0+json" which are the values specified by the API. I can call the API on my PC from other software and i get a success response.
I've installed the latest jar file from here and have tried using a tLibraryLoad to load this jar before the tRest client but get the same error.
Any ideas?
I believe you're not using the right version of the jersey core library; Here's what the tREST looks like when you use it for the first time :
It will prompt you to install missing jars (not distributed by Talend), which are :
jersey-client-1.4.jar
jersey-core-1.4.jar
At which point you can just click "Download and install all modules available" and it will install them for you.
You don't need to use tLibraryLoad component, just delete all versions of these jars that might be present in the following locations, restart your studio, and you should get the prompt to install them again (as in the above screenshot) :
<Talend root folder>\configuration\.m2\repository\org\talend\libraries
<Talend root folder>\lib\java
Issue was solved by overwriting both jersey-client-1.4-6.0.0.jar and jersey-client-1.4-6.0.0.jar iwth the version from a colleague's PC.
Download spring data redis 2.0.2.RELEASE source code from Github, import with eclipse(Version: Mars.2 Release (4.5.2)) [import - Maven -Existing Maven Projects].
There were still some problems after resovled the problems lombok and org.apache.maven.archiver.MavenArchiver.getManifes:
Description Resource Path Location Type
Cannot infer type arguments for ConvertingCursor<> DefaultStringRedisConnection.java /spring-data-redis/src/main/java/org/springframework/data/redis/connection line 3246 Java Problem
The method any(Class<byte[]>) is ambiguous for the type LettuceConnectionUnitTestSuite.LettuceConnectionUnitTests LettuceConnectionUnitTestSuite.java /spring-data-redis/src/test/java/org/springframework/data/redis/connection/lettuce line 172 Java Problem
The method any(Class<byte[]>) is ambiguous for the type LettuceConnectionUnitTestSuite.LettuceConnectionUnitTests LettuceConnectionUnitTestSuite.java /spring-data-redis/src/test/java/org/springframework/data/redis/connection/lettuce line 172 Java Problem
The method defaultNullTo(Supplier<Object>) in the type LettuceResult.LettuceResultBuilder<T,Object> is not applicable for the arguments (Supplier<R>) LettuceConnection.java /spring-data-redis/src/main/java/org/springframework/data/redis/connection/lettuce line 132 Java Problem
Type mismatch: cannot convert from LettuceResult<T,Object> to LettuceResult<T,R> LettuceConnection.java /spring-data-redis/src/main/java/org/springframework/data/redis/connection/lettuce line 123 Java Problem
Did Spring projects need special import methods, I try to use STS to import, and there are similar problems.
Any Advice Or Help?
1. What IDE should be used to import the Spring data redis project?
2. How resolve these errors above after eclipse import?
I changed my Scala version from 2.10.x to 2.11.8. I am getting some compilation issues. I tried, but still not able to resolve because I am poor in Scala and sbt.
WebService.scala:36: can't expand macros compiled by previous versions of Scala
[error] logger.error(s"WebService.getSiteData(${Id}): Unknown Error, Error Message: $e")
What might be the issue here?
I resolved this issue but it not a single thing, I did couple of things:
First I gone through the error location in WebService.scala.
Then to the corresponding "Logger" class.
I check from which jar that "Logger" class coming.
I found that it referring to some thing else jar than what I am expecting.
That jar is coming from one of my dependent project (modules) so in build.sbt, those dependent jars I excluded that wrong jar which I found.
After I changed the code in WebService.scala, I removed that import for logger and added new import having Logger what I expecting. I did same all the other places in my project.
WebService.scala:36: can't expand macros compiled by previous versions of Scala
[error] logger.error(s"WebService.getSiteData(${Id}): Unknown Error, Error Message: $e")
This is not particular to logger issue. If you are getting "can't expand macros compiled by previous versions of Scala" issue", you have to do same procedure for corresponding to your error (my case logger).
First time, I search online regarding this issue, I found same issue facing lot of people, but different library classes (I face Logger class issue).
I am trying to compile Orbeon Forms in IntelliJ IDEA 14.0.1 Community Edition, but I am getting compile errors.
Checked out the branch origin/4.7-ce
Opened the project with IntelliJ
Got on error: Load error: undefined path variables. MESSAGE is undefined. Fix it
Fixed the MESSAGE error by entering C:\temp as the value. I don't know if this matters.
Installed the Scala and File Watchers plugins
Configured the Java SDK as jdk1.7.0_09
Removed the scala-sdk that was referencing non-existent scala compiler, library, reflect jars in my $USER_HOME\.ivy2\cache directory.
Installed the Scala 2.10.3 SDK and configured as a library in the project.
Make Project
Got 94 errors, all related to the util and xml packages. I would have expected the packages to be scala.util and scala.xml.
Example errors:
orbeon-forms\src\main\scala\org\orbeon\oxf\common\PEVersion.scala
Error:(34, 8) object Try is not a member of package util<br/>
import util.Try
orbeon-forms\src\main\scala\org\orbeon\oxf\fb\AlertsAndConstraintsOps.scala<br/>
Error:(46, 9) type mismatch;<br/>
found : scala.xml.Elem<br/>
required: org.orbeon.saxon.om.NodeInfo<br/>
toXML currentLang<br/>
What am I doing wrong?
I was able to fix this error by changing the import from:
import util.Try to import scala.util.Try
There were other files that had the same issue with the scala.xml package.
The full list of files I changed is:
src\main\scala\org\orbeon\oxf\common\PEVersion.scala
src\main\scala\org\orbeon\oxf\fr\mongodb\MongoDBPersistence.scala
src\main\scala\org\orbeon\oxf\fr\process\ProcessInterpreter.scala
src\main\scala\org\orbeon\oxf\fr\process\SimpleProcess.scala
src\main\scala\org\orbeon\oxf\fr\process\XFormsActions.scala
src\main\scala\org\orbeon\oxf\xforms\action\XFormsAPI.scala
src\main\scala\org\orbeon\oxf\xforms\analysis\ElementAnalysis.scala
src\main\scala\org\orbeon\oxf\xforms\analysis\PathMapXPathAnalysis.scala
src\main\scala\org\orbeon\oxf\xforms\control\controls\XFormsInputControl.scala
src\main\scala\org\orbeon\scaxon\XML.scala
src\test\scala\org\orbeon\oxf\common\VersionTest.scala
hi im creating a lift scala application
this is my problem
when i import net.liftweb.mapper._ package the compiler gives me error...
i tried to add lift-mapper_2.9.1-2.4-M4.jar jar file to build path ,but the error exists..!
the compiler shows..
bad symbolic reference. A signature in package.class refers to term db in package net.liftweb which is not available. It may be completely missing from
the current classpath, or the version on the classpath might be incompatible with the version used when compiling package.class.
Try to add the mapper via SBT or maven configuration?
Anyway, Scala-2.9.1 and Lift 2.4-M4 are very-very out of date. Better use something like that for a good start: https://github.com/lift/lift_25_sbt/
It works out of the box, and you'll only have to add 1 line to add the mapper support for it. (After that, all dependencies would be downloaded and added to the project automatically, by SBT.)