Bug 975820

Summary: Cannot start BPMS when any deployed project kmodule.xml set session as default
Product: [Retired] JBoss BPMS Platform 6 Reporter: Ivo Bek <ibek>
Component: Business CentralAssignee: Maciej Swiderski <mswiders>
Status: CLOSED WONTFIX QA Contact: Ivo Bek <ibek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: mswiders, rrajasek, rzhang
Target Milestone: ER2   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-23 11:56:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
the project with session set as default none

Description Ivo Bek 2013-06-19 12:13:10 UTC
Description of problem:

Business central isn't deployed when there was previously deployed a project with kmodule.xml, which has set session as default.

This is my kmodule.xml:
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <kbase name="remotekbase" default="true" eventProcessingMode="stream" equalsBehavior="identity">
    <ksession name="session" type="stateful" default="true" clockType="realtime" scope="javax.enterprise.context.ApplicationScoped" />
  </kbase>
</kmodule>

Below are the exceptions during BPMS startup.
13:02:46,852 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."business-central.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."business-central.war".WeldStartService: Failed to start service
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions:
Exception 0 :
org.jboss.weld.exceptions.WeldException: WELD-000049 Unable to invoke [method] @PostConstruct public org.kie.workbench.backend.AppSetup.assertPlayground() on org.kie.workbench.backend.AppSetup@37176bc4
	at org.jboss.weld.bean.AbstractClassBean.defaultPostConstruct(AbstractClassBean.java:404)
	at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.postConstruct(ManagedBean.java:178)
	at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:298)
	at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:101)
	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)
	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
	at org.kie.workbench.backend.AppSetup$Proxy$_$$_WeldClientProxy.toString(AppSetup$Proxy$_$$_WeldClientProxy.java)
	at org.kie.commons.services.cdi.StartupBeanExtension.runPostConstruct(StartupBeanExtension.java:81)
	at org.kie.commons.services.cdi.StartupBeanExtension.afterDeploymentValidation(StartupBeanExtension.java:65)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
	at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
	at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)
	at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)
	at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)
	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:245)
	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:233)
	at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:213)
	at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:75)
	at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:46)
	at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:31)
	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:382)
	at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
	at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
	at org.jboss.weld.introspector.jlr.WeldMethodImpl.invoke(WeldMethodImpl.java:174)
	at org.jboss.weld.bean.AbstractClassBean.defaultPostConstruct(AbstractClassBean.java:402)
	... 32 more
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Cannot find ksession with name 
	at org.jbpm.kie.services.impl.AbstractDeploymentService.commonDeploy(AbstractDeploymentService.java:80)
	at org.jbpm.kie.services.impl.KModuleDeploymentService.deploy(KModuleDeploymentService.java:125)
	at org.jbpm.kie.services.impl.KModuleDeploymentService$Proxy$_$$_WeldClientProxy.deploy(KModuleDeploymentService$Proxy$_$$_WeldClientProxy.java)
	at org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl.initDeployments(DeploymentManagerEntryPointImpl.java:60)
	at org.jbpm.console.ng.bd.backend.server.DeploymentManagerEntryPointImpl$Proxy$_$$_WeldClientProxy.initDeployments(DeploymentManagerEntryPointImpl$Proxy$_$$_WeldClientProxy.java)
	at org.jbpm.console.ng.bd.backend.server.AdministrationService.bootstrapDeployments(AdministrationService.java:143)
	at org.jbpm.console.ng.bd.backend.server.AdministrationService$Proxy$_$$_WeldClientProxy.bootstrapDeployments(AdministrationService$Proxy$_$$_WeldClientProxy.java)
	at org.kie.workbench.backend.AppSetup.assertPlayground(AppSetup.java:114)
	... 42 more
Caused by: java.lang.IllegalStateException: Cannot find ksession with name 
	at org.jbpm.runtime.manager.impl.cdi.InjectableRegisterableItemsFactory.getWorkItemHandlers(InjectableRegisterableItemsFactory.java:72)
	at org.jbpm.runtime.manager.impl.AbstractRuntimeManager.registerItems(AbstractRuntimeManager.java:43)
	at org.jbpm.runtime.manager.impl.SingletonRuntimeManager.init(SingletonRuntimeManager.java:55)
	at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl.newSingletonRuntimeManager(RuntimeManagerFactoryImpl.java:38)
	at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl$Proxy$_$$_WeldClientProxy.newSingletonRuntimeManager(RuntimeManagerFactoryImpl$Proxy$_$$_WeldClientProxy.java)
	at org.jbpm.kie.services.impl.AbstractDeploymentService.commonDeploy(AbstractDeploymentService.java:65)
	... 49 more

	at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:48)
	at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:31)
	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:382)
	at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	... 3 more

13:02:51,937 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 26) JBAS018559: Deployed "dashbuilder.war" (runtime-name : "dashbuilder.war")
13:02:51,938 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 26) JBAS018559: Deployed "business-central.war" (runtime-name : "business-central.war")
13:02:51,939 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."business-central.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."business-central.war".WeldStartService: Failed to start service

13:02:52,005 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
13:02:52,006 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
13:02:52,006 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss BPMS 6.0.0.Alpha-redhat-1 (AS 7.2.0.Final-redhat-8) started (with errors) in 32253ms - Started 416 of 582 services (103 services failed or missing dependencies, 62 services are passive or on-demand)


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Build & Deploy a project with kmodule.xml, which contains a session set as default
2. Restart BPMS
3. See the console log where the exceptions appear.

Actual results:


Expected results:


Additional info:

Comment 1 Ivo Bek 2013-06-19 12:15:34 UTC
Created attachment 762904 [details]
the project with session set as default

Comment 3 Maciej Swiderski 2013-06-20 13:56:14 UTC
Unfortunately the kjar attached does not produce valid KieModule - returns an empty KieModule but rebuild it manually to try it and all works as expected. It is completely fine (or even recommended) to have session marked as default as that simplifies deployment. 
In general there are two ways to deploy kjars in kie-wb:
1. auto deploy that is automatically attempted when you build project in project explorer
2. using Deployments screen where you specify details of the kjar to deploy

The main difference between these two is that with second one you can provide the name of kbase and ksession that shall be used when deploying (creating runtime manager). In first case it relies on default kbase and ksession definitions. If they are not there then it won't be able to deploy as it cannot guess what kbase and ksession it shall use. Meaning auto deploy will fail but user can manually deploy it using Deployments screen where kbase and ksession names can be given.

Comment 4 Ivo Bek 2013-06-21 07:56:31 UTC
Hi Maciej,

Yes I understand that but the user should be only warned about the missing default kbase and ksession, because in the current situation we aren't able to deploy the business central to fix this "mistake", and change the project kmodule.xml or create the default kbase, and ksession. BTW I didn't figure out how to create the default kbase and ksession. Is it possible to create them in the business central or how is this done?

For now I would recommend to not use the default kbase, and ksession, because we weren't able to fix it without removing .niogit, repository, data and tmp folders but then the BPMS will never be the same as before; so, it's even better to install the new BPMS again and clone the user's repositories from .niogit.

Thank you

Comment 5 Maciej Swiderski 2013-06-21 08:20:13 UTC
Ivo, in most of the cases you should not create any kbase or ksession in kmodule.xml at all as that would make default being generated for you. So leaving blank kmodule.xml when authoring should make the deployment works just fine.

In Beta3 there was an issue that authoring tool was adding one ksession there by default (was already removed so it keeps clean kmodule.xml) and that might cause issues as it was not marked as default. Removing it from kmodule.xml made all works ok.

Moreover there is no need to remove entire .niogit if you want to clean up runtime environment, in fact there are two ways:
1. remove only system.git from .niogit folder
2. clone system.git repository and make the required changes - all system configuration is stored as files, for example each deployment unit is stored as independent file in the system repository and can be manipulated. So once cloned you can delete given deployment unit and push the changes back to the origin repository.

Another thing is that when deployment fails it is not stored in the system repository so on restart it will not be deployed as only successful deployed units are stored in system repo.

Comment 6 Ivo Bek 2013-06-21 09:04:12 UTC
Thank you for the clarification; it's very helpful when there isn't any documentation about that. Well it would be nice to have the default generated kbase and kmodule present in the Project Editor because I thought there must be something to be set.

Comment 7 Maciej Swiderski 2013-06-21 09:16:07 UTC
understand that, and as soon as we are done with features will enter documentation phase so more and more docs will come in. Feel free to ask questions until documentation is provided.

Kbase and ksession needs to be specified usually when you have more than one base and you want to isolate them but in usual case you have one and the default is just fine.
For ksession is slightly different as kmodule.xml allows you to specify some configuration for it, like listeners or work item handlers that might be important to define there too. Please note that human task is not needed to be defined as RuntimeManager configures it by default.

Comment 9 Maciej Swiderski 2013-08-02 11:26:43 UTC
marking as modified as there are no planned changes in code.

Comment 10 Ivo Bek 2013-09-23 11:53:32 UTC
Conclusion:
The issue was caused by bad configuration of kmodule.xml and the proper configuration should be explained in documentation to avoid the issue. Simple clear kmodule.xml works fine in BPMS 6.0.0.ER3.