[JBoss JIRA] (DROOLS-5434) Incorrect warning about file declaring wrong package
by Magnus Larsson (Jira)
[ https://issues.redhat.com/browse/DROOLS-5434?page=com.atlassian.jira.plug... ]
Magnus Larsson updated DROOLS-5434:
-----------------------------------
Description:
I am running Drools in a Spring-Boot jar and get the following warning statement _File 'BOOT-INF/classes/com/example/test/TEST.drl' is in folder 'BOOT-INF/classes/com/example/test' but declares package 'com.example.test'. It is advised to have a correspondance between package and folder names_. The package name in the drl file is correct, the problem is just that _BOOT-INF.classes._ isn't considered when evaluating if printing the warning or not.
I have tracked it down to *KieBuilderImpl.java*, method *isFileInKieBase*. The last 2 lines in that method calls:
{code:java}
// packageNameForFile prints warning if package in .drl file is not same as flatted directory structure
// Does not care about SUPPORTED_RESOURCES_ROOTS, thus prints the warning
String pkgNameForFile = packageNameForFile( fileName, folderNameForFile, !useFolders, file );
// Does care about SUPPORTED_RESOURCES_ROOTS, so the drl file is loaded
return isPackageInKieBase( kieBase, pkgNameForFile );
{code}
As it is implemented right now, the warning might either be a false-positive (and still get loaded), or the package is wrong (and the file is not loaded).
Voting to include the SUPPORTED_RESOURCES_ROOTS as valid prefixes when checking if the warning should be printed.
was:
I am running Drools in a Spring-Boot jar and get the following warning statement _File 'BOOT-INF/classes/com/example/test/TEST.drl' is in folder 'BOOT-INF/classes/com/example/test' but declares package 'com.example.test'. It is advised to have a correspondance between package and folder names_. The package name in the drl file is correct, the problem is just that _BOOT-INF.classes._ isn't considered when evaluating if printing the warning or not.
I have tracked it down to *KieBuilderImpl.java*, method *isFileInKieBase*. The last 2 lines in that method calls:
{code:java}
// Does not care about SUPPORTED_RESOURCES_ROOTS, thus prints the warning
String pkgNameForFile = packageNameForFile( fileName, folderNameForFile, !useFolders, file );
// Does care about SUPPORTED_RESOURCES_ROOTS, so the drl file is loaded
return isPackageInKieBase( kieBase, pkgNameForFile );
{code}
As it is implemented right now, the warning might either be a false-positive (and still get loaded), or the package is wrong (and the file is not loaded).
Voting to include the SUPPORTED_RESOURCES_ROOTS as valid prefixes when checking if the warning should be printed.
> Incorrect warning about file declaring wrong package
> ----------------------------------------------------
>
> Key: DROOLS-5434
> URL: https://issues.redhat.com/browse/DROOLS-5434
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Reporter: Magnus Larsson
> Assignee: Mario Fusco
> Priority: Major
>
> I am running Drools in a Spring-Boot jar and get the following warning statement _File 'BOOT-INF/classes/com/example/test/TEST.drl' is in folder 'BOOT-INF/classes/com/example/test' but declares package 'com.example.test'. It is advised to have a correspondance between package and folder names_. The package name in the drl file is correct, the problem is just that _BOOT-INF.classes._ isn't considered when evaluating if printing the warning or not.
> I have tracked it down to *KieBuilderImpl.java*, method *isFileInKieBase*. The last 2 lines in that method calls:
> {code:java}
> // packageNameForFile prints warning if package in .drl file is not same as flatted directory structure
> // Does not care about SUPPORTED_RESOURCES_ROOTS, thus prints the warning
> String pkgNameForFile = packageNameForFile( fileName, folderNameForFile, !useFolders, file );
> // Does care about SUPPORTED_RESOURCES_ROOTS, so the drl file is loaded
> return isPackageInKieBase( kieBase, pkgNameForFile );
> {code}
> As it is implemented right now, the warning might either be a false-positive (and still get loaded), or the package is wrong (and the file is not loaded).
> Voting to include the SUPPORTED_RESOURCES_ROOTS as valid prefixes when checking if the warning should be printed.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 6 months
[JBoss JIRA] (WFLY-6938) Startup error messages caused by expression where expressions are not allowed are confusing
by Brian Stansberry (Jira)
[ https://issues.redhat.com/browse/WFLY-6938?page=com.atlassian.jira.plugin... ]
Brian Stansberry commented on WFLY-6938:
----------------------------------------
This looks like two separate issues.
The host.xml one would belong in WFCORE. Probably good to check it's still an issue first though.
The main one, generally if an expression is not supported it's because the attribute is a model reference, and for such an attribute the wiring should be converted to use capabilities, which will result in a capability violation message. I think has been done for EE concurrency.
I'm reluctant to start blanket rejecting text that looks like an expression because we think it's wrong, as perhaps it's valid text for some case. Perhaps the capability resolution handling could handle that a bit better though and provide a slightly different failure message if it finds expression text in the unresolvable capability name. That too would be something that should be tracked in WFCORE.
> Startup error messages caused by expression where expressions are not allowed are confusing
> -------------------------------------------------------------------------------------------
>
> Key: WFLY-6938
> URL: https://issues.redhat.com/browse/WFLY-6938
> Project: WildFly
> Issue Type: Enhancement
> Components: Server
> Affects Versions: 10.1.0.CR1
> Reporter: Ondrej Chaloupka
> Assignee: Lukas Vydra
> Priority: Minor
>
> When a property expression is used at place where expression usage is not allowed then error message which is shown is quite confusing. From user point of view (especially the newcomer) it would be nice if the error message shows the real reason - usage of expression at place where is not permitted.
> Maybe CLI could warn on usage of expression on place where is not allowed too.
> Documentation recommends configuration with CLI, editing of XML file is common too. More of it there are some tasks which are harder to be done with CLI and editing XML is faster/easier.
> Examples:
> Setting
> {code}
> /subsystem=ee/managed-executor-service=default:write-attribute(name=context-service, value="${my.context.service}")
> {code}
> ends with this error message during startup
> {code}
> 14:13:21,076 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
> ("subsystem" => "ee"),
> ("managed-executor-service" => "default")
> ]) - failure description: {
> "WFLYCTL0412: Required services that are not installed:" => ["jboss.concurrent.ee.context.service.${my.context.service}"],
> "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.concurrent.ee.executor.default is missing [jboss.concurrent.ee.context.service.${my.context.service}]"]}
> {code}
> another confusion is setting name of host in {{host-slave.xml}} file. When set as
> {code}
> <host xmlns="urn:jboss:domain:4.2" host="${host.name}">
> {code}
> then NullPointerException is thrown.
> {code}
> [Host Controller] 14:18:45,238 ERROR [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0033: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
> at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131)
> at org.jboss.as.host.controller.HostControllerConfigurationPersister.load(HostControllerConfigurationPersister.java:188)
> at org.jboss.as.host.controller.DomainModelControllerService.boot(DomainModelControllerService.java:594)
> at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:299)
> at java.lang.Thread.run(Thread.java:745)[Host Controller] Caused by: javax.xml.stream.XMLStreamException: ParseError
> at [row,col]:[3,1][Host Controller] Message: WFLYCTL0197: Unexpected attribute 'host' encountered
> at org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute(ParseUtils.java:117)
> at org.jboss.as.host.controller.parsing.HostXml_4.readHostElement(HostXml_4.java:311)
> at org.jboss.as.host.controller.parsing.HostXml_4.readElement(HostXml_4.java:170)
> at org.jboss.as.host.controller.parsing.HostXml.readElement(HostXml.java:79)
> at org.jboss.as.host.controller.parsing.HostXml.readElement(HostXml.java:50)
> at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
> at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
> at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123) ... 4 more
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
4 years, 6 months