Connection to metaspace failed when the TIBCO BusinessWorks Process includes some Java and TIBCO ActiveSpaces activities to connect to the same metaspace.

Connection to metaspace failed when the TIBCO BusinessWorks Process includes some Java and TIBCO ActiveSpaces activities to connect to the same metaspace.

book

Article ID: KB0089344

calendar_today

Updated On:

Products Versions
TIBCO ActiveSpaces -
Not Applicable -

Description

Description:
Connection to metaspace failed when the TIBCO BusinessWorks Process includes some Java and TIBCO ActiveSpaces activities to connect to the same metaspace.
Symptoms:
Exception thrown :
com.tibco.as.space.ASException: SYS_ERROR (metaspace_already_exists - name=<metaspacename>)
    at com.tibco.plugin.as.ASPutActivity.eval(ASPutActivity.java:125)
    at com.tibco.pe.plugin.Activity.eval(Unknown Source)
    at com.tibco.pe.core.TaskImpl.eval(Unknown Source)
    at com.tibco.pe.core.Job.a(Unknown Source)
    at com.tibco.pe.core.Job.k(Unknown Source)
    at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source)
    at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source)

Cause:
A process can only connect once to the same metaspace. When you try to connect a second time, the exception "TIBAS_SYS_ERROR metaspace_already_exists" is thrown.

Issue/Introduction

Connection to metaspace failed when the TIBCO BusinessWorks Process includes some Java and TIBCO ActiveSpaces activities to connect to the same metaspace.

Resolution

Use ASCommon.getMetaspace() to get a copy of the already valid metaspace object the BW engine has. A single process can only connect once to a specific metaspace, so if you call Metaspace.Connect() twice in a row you get the error described. Since the engine already has the Metaspace defined as a resource it is already connected to it. You can do Metaspace.getSpace() as many time as you want however but don't forget to do a close on the space object you get, as the space object is reference counted.