jbossdemocentral / brms-coolstore-demo

Retail online web shopping cart example, the Cool Store demo leverages JBoss BRMS, JBoss Developer Studio, and Vaadin UI framework.
60 stars 64 forks source link

Duplicate rules in coolstore-2.0.0.jar KJAR in "support/libs" #56

Closed DuncanDoyle closed 8 years ago

DuncanDoyle commented 8 years ago

The "support/libs" directory contains a "coolstore-2.0.0.jar" KJAR file which gets put in the WEB-INF/lib folder of the "brms-coolstore-demo.war" app. The KJAR contains duplicate rules. It contains a decision table (ShippingRules), and the DRL representation of that decision table. This causes the following problem.

Caused by: java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=Shipping%20Rules.gdst, line=5, column=0
   text=Duplicate rule name: Row 1 Shipping Rules], Message [id=2, level=ERROR, path=Shipping%20Rules.gdst, line=17, column=0
   text=Duplicate rule name: Row 2 Shipping Rules], Message [id=3, level=ERROR, path=Shipping%20Rules.gdst, line=29, column=0
   text=Duplicate rule name: Row 3 Shipping Rules], Message [id=4, level=ERROR, path=Shipping%20Rules.gdst, line=41, column=0
   text=Duplicate rule name: Row 4 Shipping Rules], Message [id=5, level=ERROR, path=Shipping%20Rules.gdst, line=53, column=0
   text=Duplicate rule name: Row 5 Shipping Rules], Message [id=6, level=ERROR, path=Shipping%20Rules.gdst, line=10, column=0
   text=Duplicate declaration for variable '$sc' in the rule 'Row 1 Shipping Rules'], Message [id=7, level=ERROR, path=Shipping%20Rules.gdst, line=22, column=0
   text=Duplicate declaration for variable '$sc' in the rule 'Row 2 Shipping Rules'], Message [id=8, level=ERROR, path=Shipping%20Rules.gdst, line=34, column=0
   text=Duplicate declaration for variable '$sc' in the rule 'Row 3 Shipping Rules'], Message [id=9, level=ERROR, path=Shipping%20Rules.gdst, line=46, column=0
   text=Duplicate declaration for variable '$sc' in the rule 'Row 4 Shipping Rules'], Message [id=10, level=ERROR, path=Shipping%20Rules.gdst, line=58, column=0
   text=Duplicate declaration for variable '$sc' in the rule 'Row 5 Shipping Rules']]
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:450) [drools-compiler-6.4.0.Final-redhat-3.jar:6.4.0.Final-redhat-3]
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:604) [drools-compiler-6.4.0.Final-redhat-3.jar:6.4.0.Final-redhat-3]
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:549) [drools-compiler-6.4.0.Final-redhat-3.jar:6.4.0.Final-redhat-3]
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:531) [drools-compiler-6.4.0.Final-redhat-3.jar:6.4.0.Final-redhat-3]
    at com.redhat.coolstore.util.BRMSUtil.getStatefulSession(BRMSUtil.java:53) [classes:]
    at com.redhat.coolstore.service.ShoppingCartServiceImplBRMS.priceShoppingCart(ShoppingCartServiceImplBRMS.java:52) [classes:]

Best solution seems to remove that pre-build coolstore-2.0.0.jar KJAR and not package it with the web-app.

eschabell commented 8 years ago

This jar added so that the SA, who runs the install and then fires up the UI, sees failures without the jar available due to the UI project not being able to build during install without the jar installed in maven.

The story line in demoing this in the video attached to the product outlines that the first step is to login and build the BRMS project jar and then bump the version so that the scanner picks it up (removing any duplicate errors).

Used to just include a pre-built UI WAR and deploy it during the installation, but was also getting issues from SA's with other java versions, causing more interactions with us than will scale. Since moving to the current situation, no problems from the field.

That's the background.

DuncanDoyle commented 8 years ago

The KJAR file is actually installed in Maven in the init.sh script using a "mvn install:install-file" goal, so the KJAR is actually available in Maven and in the WEB-INF/lib. It actually needs it in the WEB-INF/lib because the KJAR also contains the domain model classes needed by the web-app.

The error you're actually getting is not that it can't find the KJAR in Maven, it finds a faulty one with duplicate rules, causing the error while building the KieBase. What happens after that is that that error causes one of the EJBs to be dropped, so even when you build a correct KJAR after that, you can't run the demo anymore. The next exception you get when trying to add something to the shopping cart (before or after building the new KJAR in business-central) is this:

16:10:30,241 SEVERE [com.vaadin.server.DefaultErrorHandler] (http-127.0.0.1:8080-1) : javax.ejb.NoSuchEJBException: JBAS016055: EJB has been removed
    at org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.getBusinessObject(StatefulSessionObjectReferenceImpl.java:123) [jboss-as-weld-7.5.7.Final-redhat-3.jar:7.5.7.Final-redhat-3]
    at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:113) [weld-core-1.1.33.Final-redhat-1.jar:1.1.33.Final-redhat-1]
    at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56) [weld-core-1.1.33.Final-redhat-1.jar:1.1.33.Final-redhat-1]
    at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105) [weld-core-1.1.33.Final-redhat-1.jar:1.1.33.Final-redhat-1]
    at com.redhat.coolstore.service.ShoppingCartService$998405650$Proxy$_$$_Weld$Proxy$.priceShoppingCart(ShoppingCartService$998405650$Proxy$_$$_Weld$Proxy$.java) [classes:]
    at com.redhat.coolstore.web.ui.ShoppingCartView.updateDatasource(ShoppingCartView.java:102) [classes:]
    at com.redhat.coolstore.web.ui.ShoppingCartView.updateShoppingCart(ShoppingCartView.java:114) [classes:]

The only way to run this demo is: