Hei
Hei

Reputation: 513

JBoss 7.1 JBAS014750: Operation handler failed to complete

I just start using JBoss to explore the world of EJB, however I encounter an issue.

When I try to write a project for EJB + JPA, I encounter an error and cannot deploy the project onto the JBoss. I am using EJB 3.1 + JBoss 7.1.1 now. Please find the following server log:

    22:18:50,132 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found EJBEntity.jar in deployment directory. To trigger deployment create a file called EJBEntity.jar.dodeploy
22:18:50,142 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-13) JBAS015876: Starting deployment of "EJBEntity.jar"
22:18:50,166 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for JPADB
22:18:50,183 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-6) JNDI bindings for session bean named LibraryPersistentBean in deployment unit deployment "EJBEntity.jar" are as follows:

    java:global/EJBEntity/LibraryPersistentBean!com.heic.tutorial.entity.stateless.LibraryPersistentBeanRemote
    java:app/EJBEntity/LibraryPersistentBean!com.heic.tutorial.entity.stateless.LibraryPersistentBeanRemote
    java:module/LibraryPersistentBean!com.heic.tutorial.entity.stateless.LibraryPersistentBeanRemote
    java:jboss/exported/EJBEntity/LibraryPersistentBean!com.heic.tutorial.entity.stateless.LibraryPersistentBeanRemote
    java:global/EJBEntity/LibraryPersistentBean
    java:app/EJBEntity/LibraryPersistentBean
    java:module/LibraryPersistentBean

22:18:50,400 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "EJBEntity.jar" was rolled back with failure message JBAS014750: Operation handler failed to complete
22:18:50,412 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment EJBEntity.jar in 11ms
22:18:50,413 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "JBAS014750: Operation handler failed to complete"}}
22:22:45,525 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-13) JBAS015876: Starting deployment of "EJBEntity.jar"
22:22:45,544 INFO  [org.jboss.as.jpa] (MSC service thread 1-13) JBAS011401: Read persistence.xml for JPADB
22:22:45,561 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-16) JNDI bindings for session bean named LibraryPersistentBean in deployment unit deployment "EJBEntity.jar" are as follows:

    java:global/EJBEntity/LibraryPersistentBean!com.heic.tutorial.entity.stateless.LibraryPersistentBeanRemote
    java:app/EJBEntity/LibraryPersistentBean!com.heic.tutorial.entity.stateless.LibraryPersistentBeanRemote
    java:module/LibraryPersistentBean!com.heic.tutorial.entity.stateless.LibraryPersistentBeanRemote
    java:jboss/exported/EJBEntity/LibraryPersistentBean!com.heic.tutorial.entity.stateless.LibraryPersistentBeanRemote
    java:global/EJBEntity/LibraryPersistentBean
    java:app/EJBEntity/LibraryPersistentBean
    java:module/LibraryPersistentBean

22:22:45,782 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "EJBEntity.jar" was rolled back with failure message JBAS014750: Operation handler failed to complete
22:22:45,787 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment EJBEntity.jar in 5ms
22:22:45,789 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "JBAS014750: Operation handler failed to complete"}}

I have no idea what "Operation handler failed to complete" means, all I know is JBoss does not allow me to deploy my project.

I have read a lot of materials for people who have the similar situation, most of them are related to persistence.xml / datasource / module configuration.

Please find the following files:

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="https://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="JPADB">
        <jta-data-source>java:jboss/datasources/MySQLDS</jta-data-source>
            <properties>
                <property name="showSql" value="true" />
                <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
            </properties>
    </persistence-unit>
</persistence>

Code segment for standalone.xml

<subsystem xmlns="urn:jboss:domain:datasources:1.0">
            <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                <datasource jndi-name="java:jboss/datasources/MySQLDS" pool-name="MySQL" enabled="true" use-java-context="true">
                    <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
                    <driver>mysqlDriver</driver>
                    <security>
                        <user-name>root</user-name>
                        <password>root</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="mysqlDriver" module="com.mysql">
                        <xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
                    </driver>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

Which the java:jboss/datasources/MySQLDS is the one I am planning to use.

%JBoss_Home%\modules\com\mysql\main\module.xml

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-5.1.31-bin.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api/>
    </dependencies>
</module>

And I have copied the mysql-connector-java-5.1.31-bin.jar into the %JBoss_Home%\modules\com\mysql\main\ directory as well.....

Please could anyone help me? I have struggled for the whole day but still cannot find a clue of what is happening......

Thank you very much.

Upvotes: 1

Views: 13097

Answers (2)

MohammadGhoreishi
MohammadGhoreishi

Reputation: 103

I had same problem during using mysql5 but it was my bad when i defined not correct mysq jdbc driver for jboss in modules. Be sure that jboss connected to your mysql datasource correctly. for example check the jboss/modules/com/mysql/modules.xml

<resource-root path="mysql-connector-java-5.1.21.jar"/>

path has to refrence correct name of jar file. And also the jar whith same name has to locate by the modules.xml file

Upvotes: 0

Hei
Hei

Reputation: 513

All of a sudden, I have fixed the issue.

I will post the answer here, hope it can help anyone who encounter similar situation.

Basically, I have done three things:

  1. I have used JBoss EAP 6.2 rather than JBoss AP 7.1

  2. I have changed jta-data-source from java:jboss/datasources/MySQLDS to java:/MySQLDS in persistence.xml

  3. I have changed jndi-name from java:jboss/datasources/MySQLDS to java:/MySQLDS in standalone.xml

Thank you.

Upvotes: 3

Related Questions