Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JBoss 7.1.1 doesn't start because of unexpected element "pool"

I get the following error message when I add the pool element:

Caused by: org.jboss.as.connector.util.ParserException: IJ010061: Unexpected element: pool

If I remove the pool element it works. I have checked the XSD in the docs folder and I am pretty sure this is right? Why does it fail?

    <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
        <resource-adapters>
            <resource-adapter>
                <archive>
                    jackrabbit-jca-2.6.2.rar
                </archive>
                <transaction-support>XATransaction</transaction-support>
                <connection-definitions>
                    <connection-definition class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory" jndi-name="java:/jca/JcrRepository" enabled="true" use-java-context="true" pool-name="jackrabbit-jca-2_6_2_rar-Pool" use-ccm="true">
                    <pool>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>4</max-pool-size>
                    </pool>
                   </connection-definition>
                </connection-definitions>
            </resource-adapter>
        </resource-adapters>
    </subsystem>
like image 917
LuckyLuke Avatar asked Oct 22 '22 04:10

LuckyLuke


1 Answers

It's not a bug, it's a feature ;)

...

Let's just go a little bit deep into the responsible implementation:

When you look into the source of the responsible parser you can see the following

     case TRANSACTION_SUPPORT: {
                         if (txSupportMatched) {
                            throw new ParserException(bundle.unexpectedElement(TRANSACTIONSUPPORT.getXmlName()));
                        }
                        String value = rawElementText(reader);
                        TRANSACTIONSUPPORT.parseAndSetParameter(value, operation, reader);
                        isXa = value != null && TransactionSupportEnum.valueOf(value) == TransactionSupportEnum.XATransaction;
                        txSupportMatched = true;
                        break;
                    }

That's the parsing of the resource-adapter-tag. If you write the XATransaction-keyword, the (by default false) isXa-var switches to true.

Now the parser of the connection-definition-tag expects a xa-pool-tag

           case XA_POOL: {
                        if (! isXa) throw new ParserException(bundle.unexpectedElement(CommonConnDef.Tag.XA_POOL.name()));
                        if (poolDefined)
                            throw new ParserException(bundle.multiplePools());
                        parseXaPool(reader, connectionDefinitionNode);
                        poolDefined = true;
                        break;
                    }
                    case POOL: {
                        if (isXa) throw new ParserException(bundle.unexpectedElement(CommonConnDef.Tag.POOL.name()));
                        if (poolDefined)
                            throw new ParserException(bundle.multiplePools());
                        parsePool(reader, connectionDefinitionNode);
                        poolDefined = true;
                        break;
                    }

Depending on the XATransaction-definition the ironjacamar-impl create different pool-implementations. And the xa-poolType of the schema allows more configuration then the standard-pooltype.

But I think that should be documented somewhere, at least in the schema.xsd

like image 199
Jan Piel Avatar answered Oct 27 '22 16:10

Jan Piel