Drools KIE workbench 7: error when saving kmodule.xml file in 'Knowledge Base Settings' page - drools

In drools KIE workbench 7, for a project 'testRemoteKJar', I use 'Knowledge Base Settings:Knowledge bases an sessions' to edit its kmodule.xml, as in below screen shot.
Screen Shot--Knowledge Base Settings.
When I click button 'save' to save kmodule.xml, the console of the KIE workbench print below error message.
08-Jul-2017 19:29:00.161 INFO [Thread-12] org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder.updateResource Incremental build request received for: default://master#repo-demorules/testRemoteKJar/src/main/resources/META-INF/kmodule.xml (updated).
08-Jul-2017 19:29:00.317 INFO [Thread-607] org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder$3.execute Incremental build request being processed: PathImpl{uri='default://master#repo-demorules/testRemoteKJar', fileName='testRemoteKJar', attrs={}} (updated).
08-Jul-2017 19:29:00.325 SEVERE [Thread-13] org.kie.workbench.common.screens.impl.LibraryIndexer.fillIndexBuilder Unable to index default://master#repo-demorules/testRemoteKJar/src/main/resources/META-INF/kmodule.xml: package could not be resolved.
08-Jul-2017 19:29:00.726 SEVERE [Thread-607] org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages Unable to build KieBase, could not find include: kbase1
And if I download the jar file 'testRemoetKJar' from KIE workbench, the content of the kmodule.xml in that jar is just one line:
<kmodule xmlns="http://www.drools.org/xsd/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
The error log contains words 'package could not be resolved', but the project 'testRemoteKJar' does have package 'org_care.crm.testremotekjar' (the package name is used in the screenshot above). So the error log should have other meaning.
How to fix the error? Thanks a lot.

Related

Eclipse Language Servers: There is '1' error in 'javaee_7.xsd'

When I try to auto generate the web.xml file while creating a Dynamic Web Project in the Eclipse Enterprise version it shows an error of type "Language Servers". It indicates to this element of the web.xml file as error:
<web-app
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
>
There is '1' error in 'javaee_7.xsd'.
schema_reference.4: Failed to read schema document 'platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd', because 1) could not find the document; 2) the document could not be
read; 3) the root element of the document is not xsd:schema.).
This is a bug in Eclipse which manifested since 2021-03.
It's broken down here: https://github.com/eclipse/lemminx/issues/1042#issuecomment-859778034:
Ok I can reproduce the issue with a fresh Eclipse IDE (the last). I can explain the problem but I don't know how to fix it (for the moment).
When you have "There is '1' error in 'jakartaee_9.xsd'" error, you must open the XSD file (from the cache) and you should see 1 error and 1 warning:
There is a warning:
schema_reference.4: Failed to read schema document 'platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. jakartaee_9.xsd /lemminx-cache/https/jakarta.ee/xml/ns/jakartaee line 52 Language Servers
which try to define xml:lang attribute inside xml.xsd file. But here the xml.xsd cannot be retrieved (the warning message) and you have the error:
It tries to download the XSD from platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd but platform is specific to Eclipse IDE. In other words when http://www.w3.org/2001/xml.xsd must be resolved, it says that platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd is the location of XSD. I don't know who do that?
I have the impression than LemMinx is configured to use XML catalog from WTP:
While waiting for the Eclipse version with the fix (which is indeed not yet released at the time of writing), one work around is disable the LemMinx validation:
#chris21k please note that you can disable LemMinx validation:

Debugging OfBiz in Eclipse gives MissingResourceException

I downloaded the OfBiz Java application and the following line throws an MissingResourceException:
ResourceBundle res = ResourceBundle.getBundle(settingsResourceName);
The value of settingsResourceName is "cache", but I cannot find any file called cache.properties or cache_en.properties.
Where should I be looking? I'm new to Java. All my research on SO says there should be such a file.
I imported OfBiz in Eclipse using the Import menu option and selecting Existing Project from File System (I'm not in front of my dev machine so I don't remember the exact wording). But I chose the root folder of the downloaded OfBiz.
I then added the appropriate VM Arguments in the Run Configuration to get it to run properly at least. And that's it, on the first Run I got the above error. I think it has to do with a missing class path but I don't know what to add to class path.
Here is the stack trace:
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.ofbiz.base.util.Debug.<clinit>(Debug.java:68)
at org.apache.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:61)
at org.apache.ofbiz.base.start.StartupControlPanel.loadStartupLoaders(StartupControlPanel.java:202)
at org.apache.ofbiz.base.start.StartupControlPanel.start(StartupControlPanel.java:69)
at org.apache.ofbiz.base.start.Start.main(Start.java:84)
Caused by: java.util.MissingResourceException: Can't find bundle for base name cache, locale en
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:174)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:170)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:166)
at org.apache.ofbiz.base.util.cache.UtilCache.<init>(UtilCache.java:124)
at org.apache.ofbiz.base.util.cache.UtilCache.createUtilCache(UtilCache.java:769)
at org.apache.ofbiz.base.util.UtilProperties.<clinit>(UtilProperties.java:75)
... 5 more
UPDATE:
My mistake, I found two files both called cache.properties in the following folders:
ofbiz-trunk/build/resources/main
ofbiz-trunk/framework/base/config
But these are folders, not packages. I tried putting them in the .classpath but that did not work, I still kept getting the same error.
As suspected, I knew it was because of a missing reference to a class path. After looking at a section on this page: http://www.opensourcestrategies.com/ofbiz/ofbiz_eclipse.php, I learned that I was supposed to go to the Java Build Path and in the Libraries tab, click on Add Class Folder, then point that to ofbiz-trunk/framework/base/config. Which is where I have one of the cache.properties files.

SonarQube Eclipse plugin doesn't follow Eclipse links, and "sonar.sources" must be relative path

Eclipse: "Luna" Release 2 (4.4.2) [20150219-0600]
Sonar: 5.1 (under Java 1.7.0_76)
Sonar Eclipse plugin: 3.5.0.20150804-1512-RELEASE
We have a large Enterprise system with many projects, and for various non-negotiable reasons we create our Eclipse projects in a local workspace directory but use Eclipse links to point to the sources in another directory.
For example, assume that my Foo project is based in "C:/EclipseWorkspace/Foo" and has an "src" link at the top level like this:
C:/EclipseWorkspace/Foo/src -> C:/CodeRepository/Foo/src
I wanted to have the following very simple setup for the plugin:
sonar.sources = C:/CodeRepository/Foo/src
The problem is, the Sonar Eclipse plugin does not appear to support using an absolute path. When I run an analysis I get the following error on the console:
Retrieve remote issues of project Foo...
Start SonarQube analysis on Foo...
INFO: SonarQube Server 5.1
17:16:18.565 INFO - Incremental mode
17:16:18.609 INFO - Load global repositories
17:16:18.862 INFO - Load global repositories (done) | time=253ms
17:16:18.863 INFO - Server id: 20150910100331
17:16:18.865 INFO - User cache: C:\Users\eryq\.sonar\cache
17:16:18.870 INFO - Install plugins
17:16:18.894 INFO - Include plugins:
17:16:18.894 INFO - Exclude plugins: devcockpit, buildstability, pdfreport, report, buildbreaker, views, jira
17:16:19.375 ERROR - Invalid value of sonar.sources for Foo
Exception in thread "main" org.sonar.runner.impl.RunnerException: Unable to execute Sonar
...
Caused by: java.lang.IllegalStateException: The folder 'C:/CodeRepository/Foo/src' does not exist for 'Foo' (base directory = C:\EclipseWorkspace\Foo)
at org.sonar.batch.scan.ProjectReactorBuilder.checkExistenceOfPaths(ProjectReactorBuilder.java:427)
at ...
Notice that last line:
The folder 'C:/CodeRepository/Foo/src' does not exist for 'Foo' (base
directory = C:\EclipseWorkspace\Foo)
Since the Eclipse plugin does not allow me to override the projectBaseDir, how do I make it understand that the sonar.sources are actually in another directory outside that tree? This seems like a plugin bug: if I need to point to a list of sources directories, the plugin should let me specify absolute paths if needed.
Thanks in advance,
Eryq
This is not specific to SonarQube Eclipse and not related to absolute path: any SonarQube analysis requires to have source folders located under the project baseDir.
Allowing you to override sonar.projectBaseDir is an easy fix. But I'm not sure this would not lead to other issues later when issues are mapped to Eclipse resources... Feel free to test and submit a pull request.

Running GWT SuperDevMode in IDEA on Win8

I am trying to configure my GWT project to run in SuperDevMode and experience severe problem during server run time.
So, I have working "regular" devMode configuration in Intellij IDEA. Created a new GWT configuration in app-servers list. Set the following values:
[Checked] Super Dev Mode
VM options: -Xmx512m -XX:MaxPermSize=384M
Dev Mode parameters: -bindAddress 0.0.0.0 -port 1234 -workDir d:\projects\myApp\SDV\ -src d:\projects\myApp\src\main\java com.app.MyApp
Made changes to my project's build xml file adding the lines in the end of file:
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<!-- enable source maps -->
<set-property name="compiler.useSourceMaps" value="true" />
Here is the console output on this config run:
workDir: d:\projects\myApp\SDV
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
binding: user.agent=safari
binding: compiler.useSourceMaps=true
binding: locale=en
Compiling module com.app.MyApp
Compiling 1 permutation
Compiling permutation 0...
Source Maps Enabled
Compile of permutations succeeded
Linking into d:\projects\myApp\SDV\com.app.MyApp\compile-1\war\myapp; Writing extras to d:\projects\myApp\SDV\com.app.MyApp\compile-1\extras\myapp
Link succeeded
Compilation succeeded -- 84.458s
Compile completed in 85210 ms
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
[ERROR] unable to create directory: d:\projects\myApp\SDV\com.app.MyApp\compile-1
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.codeserver.CompileDir.mkdir(CompileDir.java:103)
at com.google.gwt.dev.codeserver.CompileDir.create(CompileDir.java:93)
at com.google.gwt.dev.codeserver.Recompiler.makeCompileDir(Recompiler.java:267)
at com.google.gwt.dev.codeserver.Recompiler.compile(Recompiler.java:82)
....
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Process finished with exit code 1
I suspect it maybe Win8 file access permissions problem: cannot create the directory because it wasn't deleted successfully. Both lines in the log above that have this text:
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
are of red color in IDEA (if that has any special meaning).
I unchecked READ_ONLY checkbox in the properties of for the work folder in file explorer, and also run idea64.exe as Admin. Should I somehow run this codeserver compiler "as admin" too? Is it possible?
Also it may be a configuration issue, if it is and somebody can see it from the details below - I would really appreciate the help. Thanks in advance!
UPDATE
Running the superDevMode config with parameter "-noprecompile" gives the same results:
workDir: d:\projects\myApp\sdv
deleting: d:\projects\myApp\sdv\com.app.MyApp\compile-1
Module setup completed in 865 ms
deleting: d:\projects\myApp\sdv\com.app.MyApp\compile-1
[ERROR] unable to create directory: d:\projects\myApp\sdv\com.app.MyApp\compile-1
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.codeserver.CompileDir.mkdir(CompileDir.java:103)
at com.google.gwt.dev.codeserver.CompileDir.create(CompileDir.java:93)
at com.google.gwt.dev.codeserver.Recompiler.makeCompileDir(Recompiler.java:267)
So, definitely looks like file access problem (delete doesn't do its job?). Javadoc to CompileDir.create() method says: "Creates a new compileDir directory structure. The directory must not already exist, but its parent should exist." Seems that it already exists.
I think your configuration is correct. I am using the same parameters (with another portnumber) on my Mac and it works as expected.
The red color of the text:
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
is normal and indicates no problem.
I am not familiar with Windows 8, but would think, that you don't need to run idea.exe with admin rights. I think, uncheck the read-only checkbox should solve your problems.
Another way should be, that you create your workDir directory with Intellij.
File -> New -> directory
(That's what I did).
Ok, so this is fixed now in GWT 2.7.0 by GWT team.
https://code.google.com/p/google-web-toolkit/issues/detail?id=8619
Runs well, even though I can notice the message in the IDE console:
[WARN] unable to delete 'C:\Users\me\AppData\Local\Temp\gwt-codeserver-1341369077945982663.tmp\com.bla.MyAPP\compile-1' (skipped)
[ERROR] unable to create directory: C:\Users\me\AppData\Local\Temp\gwt-codeserver-1341369077945982663.tmp\com.bla.MyAPP\compile-1
Loading Java files in com.bla.MyAPP.
after printing this the IDE continues to run the app server.
Resolving the issue.
I also found that if you are converting your project from GWT 2.6.0 to 2.7.0, you should delete your 2.6.0 run configuration and setup a new one with GWT 2.7.0 defaults.

Unable to properly link external Java library in Eclipse

I've been struggling to properly integrate this Netflix Java Client to access Netflix's API into a very basic Eclipse Java Web Project.
Whenever I try to publish any content referring to this library, I get errors like the following, indicating an inability to resolve the type of the classes in the external library I'm trying to use.
Aug 20, 2011 11:48:42 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/OSNet03] threw exception [Unable to compile class for JSP:
An error occurred at line: 19 in the jsp file: /index.jsp
NetflixAPIClient cannot be resolved to a type
16: String myConsumerKey = new String("cefjbgekg7566cqrp2atua2n");
17: String myConsumerSecret = new String("redacted");
18:
19: NetflixAPIClient apiClient = new NetflixAPIClient(myConsumerKey, myConsumerSecret);
20: String uri = APIEndpoints.MOVIE_URI + "/2361637";
21: String details = null;
At the top of the file I include the proper class directories like this:
<%# page import="com.netflix.api.*" %>
<%# page import="com.netflix.api.client.*" %>
<%# page import="com.netflix.api.client.dal.*" %>
And I don't receive any errors from Eclipse telling me it can't resolve the classes. Only once I publish it to the server does this error occur.
I've tried building with jre7 and jdk1.7.0. The library I'm trying to work with includes elements that are from Java v6 and v5.
I included the library by building it with Maven and placing the directory in my WEB-INF/lib folder and then including the jar netflix-client-2.3-SNAPSHOT.jar in my Build Path.
I've looked all over the web for possible causes and tried every prescribed solution I've found but none have worked.
You may be able to tell I'm very new to using Eclipse and Java Web Programming but I'm trying to figure things out as best I can as I go.
check if build automatically is on :P. if not try turning it on for once.
if yes then check the project build path and look for libraries. check if the correct jars are there.
also check if your jars are not corrupted.
these are the usual problems for more wait for sm1 else to answer.
you could also try searching for the resource class that can't be resolved using Ctrl+Shift+R and see if the class turns up.
if you don't get it, then just extract the jar and see if the class is there for real.