[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: Configuring JBoss 5.0.0 CR1 for MySQL

mayankmit2002 do-not-reply at jboss.com
Tue Sep 30 02:13:49 EDT 2008


Hi Peter,
     i'm posting the complete stack trace for deployment of EJB jar.

==========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: E:\jboss-5.0.0.CR1

  JAVA: c:\program files\java\jdk1.6.0_10\bin\java

  JAVA_OPTS: -Dprogram.name=run.bat -server -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

  CLASSPATH: E:\jboss-5.0.0.CR1\bin\run.jar

===============================================================================

09:40:41,863 INFO  [ServerImpl] Starting JBoss (Microcontainer)...
09:40:41,863 INFO  [ServerImpl] Release ID: JBoss [Morpheus] 5.0.0.CR1 (build: SVNTag=JBoss_5_0_0_CR1 date=200806301254)
09:40:41,879 INFO  [ServerImpl] Home Dir: E:\jboss-5.0.0.CR1
09:40:41,879 INFO  [ServerImpl] Home URL: file:/E:/jboss-5.0.0.CR1/
09:40:41,879 INFO  [ServerImpl] Library URL: file:/E:/jboss-5.0.0.CR1/lib/
09:40:41,879 INFO  [ServerImpl] Patch URL: null
09:40:41,879 INFO  [ServerImpl] Server Name: default
09:40:41,879 INFO  [ServerImpl] Server Home Dir: E:\jboss-5.0.0.CR1\server\default
09:40:41,879 INFO  [ServerImpl] Server Home URL: file:/E:/jboss-5.0.0.CR1/server/default/
09:40:41,879 INFO  [ServerImpl] Server Data Dir: E:\jboss-5.0.0.CR1\server\default\data
09:40:41,879 INFO  [ServerImpl] Server Temp Dir: E:\jboss-5.0.0.CR1\server\default\tmp
09:40:41,879 INFO  [ServerImpl] Server Config URL: file:/E:/jboss-5.0.0.CR1/server/default/conf/
09:40:41,879 INFO  [ServerImpl] Server Library URL: file:/E:/jboss-5.0.0.CR1/server/default/lib/
09:40:41,879 INFO  [ServerImpl] Root Deployment Filename: jboss-service.xml
09:40:42,854 INFO  [ServerImpl] Starting Microcontainer, bootstrapURL=file:/E:/jboss-5.0.0.CR1/server/default/conf/bootstrap.xml
09:40:44,127 INFO  [CopyMechanism] VFS temp dir: E:\jboss-5.0.0.CR1\server\default\tmp
09:40:44,127 INFO  [ZipEntryContext] VFS force nested jars copy-mode is enabled.
09:40:48,953 INFO  [ServerInfo] Java version: 1.6.0_10-beta,Sun Microsystems Inc.
09:40:48,953 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Server VM 11.0-b11,Sun Microsystems Inc.
09:40:48,953 INFO  [ServerInfo] OS-System: Windows XP 5.1,x86
09:40:49,173 INFO  [JMXKernel] Legacy JMX core initialized
09:40:51,516 INFO  [MetaDataAwareProfile] Using profile root:E:\jboss-5.0.0.CR1\server\default
09:40:56,106 INFO  [WebService] Using RMI server codebase: http://127.0.0.1:8083/
09:41:14,153 WARN  [HackClassloaderMetaDataDeployer] FIXME Using loader repository config: jboss.console:sar=console-mgr.sar for  vfsfile:/E:/jboss-5.0.0.CR1/server/default/deploy/management/console-mgr.sar/ use classloading metadata not loader repository config
09:41:15,395 INFO  [AspectDeployer] Deploying xml into org.jboss.aop.AspectManager at 3171e for BaseClassLoader at 107c405{vfsfile:/E:/jboss-5.0.0.CR1/server/default/deploy/ejb3-interceptors-aop.xml}
09:42:18,041 INFO  [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector
09:42:18,482 INFO  [MailService] Mail Service bound to java:/Mail
09:42:18,544 WARN  [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instru
ctions on how to do this.
09:42:19,598 INFO  [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
09:42:19,598 INFO  [TransactionManagerService] Setting up property manager MBean and JMX layer
09:42:20,352 INFO  [TransactionManagerService] Starting recovery manager
09:42:20,793 INFO  [TransactionManagerService] Recovery manager started
09:42:20,808 INFO  [TransactionManagerService] Binding TransactionManager JNDI Reference
09:42:22,113 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: c:\program files\java\jdk1.6.0_10\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS
;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\ULTRAE~1;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\CVSNT\;C:\Program Files\Java\jdk1.6.0_10\bin
09:42:22,239 INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
09:42:22,239 INFO  [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
09:42:22,255 INFO  [Catalina] Initialization processed in 337 ms
09:42:22,255 INFO  [StandardService] Starting service jboss.web
09:42:22,255 INFO  [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.1.CR3
09:42:22,380 INFO  [Catalina] Server startup in 127 ms
09:42:22,805 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/jboss-5.0.0.CR1/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
09:42:22,820 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/jboss-5.0.0.CR1/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
09:42:22,883 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/jboss-5.0.0.CR1/server/default/deploy/jms-ra.rar/META-INF/ra.xml
09:42:22,899 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/jboss-5.0.0.CR1/server/default/deploy/mail-ra.rar/META-INF/ra.xml
09:42:22,946 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/jboss-5.0.0.CR1/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
09:42:23,889 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: main
09:42:23,968 INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
09:42:23,984 INFO  [RAMJobStore] RAMJobStore initialized.
09:42:23,984 INFO  [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
09:42:23,984 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.5.2
09:42:23,984 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
09:42:24,565 INFO  [NativeServerConfig] JBoss Web Services - Stack Native Core
09:42:24,565 INFO  [NativeServerConfig] 3.0.2.GA
09:42:27,222 INFO  [TomcatDeployment] deploy, ctxPath=/invoker, vfsUrl=http-invoker.sar/invoker.war
09:42:28,445 INFO  [TomcatDeployment] deploy, ctxPath=/web-console, vfsUrl=management/console-mgr.sar/web-console.war
09:42:29,165 INFO  [TomcatDeployment] deploy, ctxPath=/jmx-console, vfsUrl=jmx-console.war
09:42:29,275 INFO  [TomcatDeployment] deploy, ctxPath=/jbossws, vfsUrl=jbossws.sar/jbossws-management.war
09:42:29,447 INFO  [TomcatDeployment] deploy, ctxPath=/, vfsUrl=ROOT.war
09:42:29,666 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
09:42:31,420 WARN  [JDBCPersistenceManager]

JBoss Messaging Warning: DataSource connection transaction isolation should be READ_COMMITTED, but it is currently REPEATABLE_READ.
                         Using an isolation level less strict than READ_COMMITTED may lead to data consistency problems.
                         Using an isolation level more strict than READ_COMMITTED may lead to deadlock.

09:42:31,749 WARN  [QuartzTimerServiceFactory] sql failed: CREATE TABLE QRTZ_JOB_DETAILS(JOB_NAME VARCHAR(80) NOT NULL, JOB_GROUP VARCHAR(80) NOT NULL, DESCRIPTION VARCHAR(120) NULL, JOB_CLASS_NAME VARCHAR(128) NOT NULL, IS_DURABLE VARCHAR(1) NOT NULL, IS_VOLATILE VARCHAR(1) NOT NULL, IS_STATEFUL VA
RCHAR(1) NOT NULL, REQUESTS_RECOVERY VARCHAR(1) NOT NULL, JOB_DATA BINARY NULL, PRIMARY KEY (JOB_NAME,JOB_GROUP))
09:42:31,827 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: main
09:42:31,827 INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
09:42:31,843 INFO  [JobStoreCMT] Using db table-based data access locking (synchronization).
09:42:31,858 INFO  [JobStoreCMT] Removed 0 Volatile Trigger(s).
09:42:31,858 INFO  [JobStoreCMT] Removed 0 Volatile Job(s).
09:42:31,858 INFO  [JobStoreCMT] JobStoreCMT initialized.
09:42:31,858 INFO  [StdSchedulerFactory] Quartz scheduler 'JBossEJB3QuartzScheduler' initialized from an externally provided properties instance.
09:42:31,858 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.5.2
09:42:31,858 INFO  [JobStoreCMT] Freed 0 triggers from 'acquired' / 'blocked' state.
09:42:31,858 INFO  [JobStoreCMT] Recovering 0 jobs that were in-progress at the time of the last shut-down.
09:42:31,858 INFO  [JobStoreCMT] Recovery complete.
09:42:31,874 INFO  [JobStoreCMT] Removed 0 'complete' triggers.
09:42:31,874 INFO  [JobStoreCMT] Removed 0 stale fired job entries.
09:42:31,874 INFO  [QuartzScheduler] Scheduler JBossEJB3QuartzScheduler_$_NON_CLUSTERED started.
09:42:32,312 INFO  [ServerPeer] JBoss Messaging 1.4.1.CR1 server [0] started
09:42:32,516 WARN  [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover
09:42:32,516 WARN  [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
09:42:32,673 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
09:42:32,673 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory at a852b started
09:42:32,688 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
09:42:32,688 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory at 1edf48d started
09:42:32,688 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
09:42:32,688 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory at 104f3a5 started
09:42:32,704 INFO  [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
09:42:32,720 INFO  [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
09:42:32,720 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
09:42:33,565 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
09:42:33,597 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
09:42:33,612 INFO  [ServerImpl] JBoss (Microcontainer) [5.0.0.CR1 (build: SVNTag=JBoss_5_0_0_CR1 date=200806301254)] Started in 1m:51s:733ms
09:43:20,528 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:21,185 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:21,248 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:21,342 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:21,405 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:21,483 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:21,577 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:21,749 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:21,843 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:22,078 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:22,172 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:22,266 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:22,344 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:22,391 INFO  [STDOUT] ======> Creating interceptor metadata bridge
09:43:22,470 INFO  [JBossASKernel] Created KernelDeployment for: GraphicServer.jar
09:43:22,485 INFO  [JBossASKernel] installing bean: persistence.units:ear=GraphicServer.jar.ear,jar=GraphicServer.jar,unitName=GraphicServerPU
09:43:22,485 INFO  [JBossASKernel]   with dependencies:
09:43:22,485 INFO  [JBossASKernel]   and demands:
09:43:22,501 INFO  [JBossASKernel]      jboss.jca:name=DefaultDS,service=DataSourceBinding
09:43:22,501 INFO  [JBossASKernel]   and supplies:
09:43:22,501 INFO  [JBossASKernel]      persistence.units:unitName=GraphicServerPU
09:43:22,501 INFO  [JBossASKernel] Added bean(persistence.units:ear=GraphicServer.jar.ear,jar=GraphicServer.jar,unitName=GraphicServerPU) to KernelDeployment of: GraphicServer.jar
09:43:22,517 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/E:/jboss-5.0.0.CR1/server/default/deploy/GraphicServer.jar state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: Error deploying GraphicServer.jar: <injection-target> could not be found: com.le.graphicsServer.domain.AnimationBean.GraphicServerPU
        at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:192)
        at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:95)
        at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)
        at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
        at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:174)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:970)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:911)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1392)
        at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:784)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:912)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:834)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:672)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:455)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:594)
        at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:541)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
        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:619)
Caused by: java.lang.RuntimeException: <injection-target> could not be found: com.le.graphicsServer.domain.AnimationBean.GraphicServerPU
        at org.jboss.injection.InjectionUtil.findInjectionTarget(InjectionUtil.java:225)
        at org.jboss.injection.InjectionUtil.injectionTarget(InjectionUtil.java:301)
        at org.jboss.injection.PersistenceContextHandler.loadXml(PersistenceContextHandler.java:64)
        at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:561)
        at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:392)
        at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:505)
        at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:185)
        ... 26 more
09:43:22,532 WARN  [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

*** CONTEXTS IN ERROR: Name -> Error

vfszip:/E:/jboss-5.0.0.CR1/server/default/deploy/GraphicServer.jar -> java.lang.RuntimeException: <injection-target> could not be found: com.le.graphicsServer.domain.AnimationBean.GraphicServerPU


        at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:676)
        at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:661)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:291)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
        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:619)


Here is the code for ApplicationBean.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.le.graphicsServer.domain;

import com.le.graphicsServer.persistence.Animation;
import com.le.graphicsServer.persistence.Login;
import com.le.graphicsServer.persistence.Plain;
import com.le.graphicsServer.persistence.PlainElements;
import com.le.graphicsServer.util.Constants;
import com.le.graphicsServer.util.Constants.Animation_Constants;
import com.le.graphicsServer.util.Constants.Error_Message;
import com.le.graphicsServer.util.Constants.Login_Constants;
import com.le.graphicsServer.util.Constants.Response;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityExistsException;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.apache.log4j.Logger;

/**
 *
 * @author mayank.mittal
 */
@Stateless
public class AnimationBean implements AnimationLocal {

    @PersistenceContext(name = "GraphicServerPU")
    private EntityManager entityManager;
    private static Logger log;


    static {
        log = Logger.getLogger(AnimationBean.class);
    }

    //<editor-fold defaultstate="collapsed" desc="Add a new Animation to the database with the name provided">
    @Override
    public Error_Message addAnimation(Hashtable<Enum, String> htbDetail) {
        log.debug("Entered into addAnimation Method::::::::::::::");
        Error_Message error_Message = null;
        error_Message = Error_Message.Error_Occured;
        String strAnimationName = htbDetail.get(Animation_Constants.Animation_Name);
        String strUserID = htbDetail.get(Login_Constants.User_ID);
        Animation animation = new Animation();
        try {
            entityManager.createQuery("Select a From Animation a where a.animationName='" + strAnimationName + "'").getSingleResult();
            error_Message = Error_Message.Record_Already_Exists;
        } catch (NoResultException noResultException) {
            log.info("Name not found:::::::::::;;;;;;");
            animation.setAnimationName(strAnimationName);
            animation.setValidated(0);
            animation.setUserID(strUserID);
            entityManager.persist(animation);
            error_Message = Error_Message.Record_Sucessfully_Added;
        } catch (Exception exception) {
            log.error("Exception Occured in addAnimation");
            error_Message = Error_Message.Error_Occured;
        }
        log.debug("Exiting with error Status " + error_Message.toString());
        return error_Message;
    }
    //</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="Provides Functionality to edit Animation details">
    @Override
    public Error_Message editAnimation(HashMap<Animation_Constants, Object> mapData) {
        Error_Message errorIndex = Error_Message.Error_Occured;
        Animation animation = null;
        Integer iAnimationID;
        String strAnimationName;
        try {
            iAnimationID = (Integer) mapData.get(Animation_Constants.Animation_ID);
            strAnimationName = (String) mapData.get(Animation_Constants.Animation_Name);
            if (!(iAnimationID == null)) {
                animation = entityManager.find(Animation.class, iAnimationID);
                if (!(animation == null)) {
                    try {
                        entityManager.createQuery("Select a From Animation a Where a.animationName='" + strAnimationName + "'").getSingleResult();
                        errorIndex = Error_Message.Record_Already_Exists;
                    } catch (NoResultException noResultException) {
                        animation.setAnimationName(strAnimationName);
                        errorIndex = Error_Message.Record_Sucessfully_Added;
                    }
                } else {
                    errorIndex = Error_Message.Animation_Not_Available;
                }
            } else {
                errorIndex = Error_Message.Invalid_Data_Provided;
            }
        } catch (Exception exception) {
            errorIndex = Error_Message.Error_Occured;
        }

        
        return errorIndex;
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Returns Animation Details" >
    @Override
    public Hashtable<Enum, Object> getAnimationDetailsByAnimationID(Integer iAnimationID) {
        Hashtable<Enum, Object> htbResponse = null;
        List plains = null;
        List lstPlainElements = null;

        Query query = null;


        Integer iPlainCount = null;
        Integer iIFrameCount = 0;
        Integer iButtonCount = 0;
        Integer iBMPCount = 0;
        Animation animation = null;



        htbResponse = new Hashtable<Enum, Object>();
        try {

            if (iAnimationID == null) {
                htbResponse.put(Constants.Response.Error_Index, Error_Message.Invalid_Data_Provided);
                return htbResponse;
            }
        } catch (Exception e) {
            htbResponse.put(Constants.Response.Error_Index, Error_Message.Invalid_Data_Provided);
            return htbResponse;
        }

        animation = entityManager.find(Animation.class, iAnimationID);
        plains = (List) animation.getPlains();

        if (plains.isEmpty() == true) {
            htbResponse.put(Constants.Response.Error_Index, Error_Message.No_Plain_Found);
            return htbResponse;
        }
        iPlainCount = plains.size();    // Total No. of Plains in Animation
        for (Plain plain : plains) {
            query = entityManager.createQuery("Select p from PlainElement as p where p.plainID = " + plain.getPlainID().intValue());
            lstPlainElements = query.getResultList();
            for (PlainElements plainElements : lstPlainElements) {
                switch (plainElements.getElementType()) {
                    case 0x80:
                        iButtonCount++;
                        break;
                    case 0x86:
                        iIFrameCount++;
                        break;
                    case 0x82:
                        iBMPCount++;
                        break;
                }
            }
        }

        htbResponse.put(Constants.Animation_Constants.Plain_Count, iPlainCount);
        htbResponse.put(Constants.Animation_Constants.IFrame_Count, iIFrameCount);
        htbResponse.put(Constants.Animation_Constants.BMP_Count, iBMPCount);
        htbResponse.put(Constants.Animation_Constants.Button_Count, iButtonCount);
        htbResponse.put(Constants.Animation_Constants.Animation_ID, iAnimationID);
        htbResponse.put(Constants.Response.Error_Index, Constants.Error_Message.Error_Occured);
        return htbResponse;
    }
    //</editor-fold>
    @Override
    public Hashtable<Enum, Object> getAnimationDetailsByLoginID(String userID) {
        log.info("Enter into getAnimationDetailsByLoginID::::::::::::");
        Error_Message errorIndex = Error_Message.Error_Occured;
        Hashtable<Animation_Constants, Integer> htbCount = null;
        Hashtable<Enum, Object> htbResponse = new Hashtable<Enum, Object>();
        Hashtable<String, Hashtable<Animation_Constants, Integer>> htbDetail = new Hashtable<String, Hashtable<Animation_Constants, Integer>>();
        List lstplains = null;
        List lstPlainElements = null;
        List lstAnimation = null;

        Query query = null;

        Integer iAnimationID = null;



        try {
            if (!(userID == null)) {
                Login login = entityManager.find(Login.class, userID);
                int iPermission = login.getPermission();
                if (iPermission == 0) {
                    lstAnimation = entityManager.createQuery("Select a From Animation a").getResultList();
                } else {
                    lstAnimation = entityManager.createQuery("Select a From Animation a Where a.userID='" + userID + "'").getResultList();
                }
                Integer ianimationcount = 0;
                if (!(lstAnimation.isEmpty())) {
                    ianimationcount = lstAnimation.size();
                    log.debug("animation count::::::::::::" + ianimationcount);
                    for (Animation animation : lstAnimation) {
                        Integer iPlainCount = 0;
                        Integer iIFrameCount = 0;
                        Integer iButtonCount = 0;
                        Integer iBMPCount = 0;
                        Integer iVDOCount = 0;
                        lstplains = (List) animation.getPlains();
                        htbCount = new Hashtable<Animation_Constants, Integer>();
                        iPlainCount = lstplains.size();    // Total No. of Plains in Animation
                        log.debug("plain count::::::::::::" + iPlainCount);
                        for (Plain plain : lstplains) {
                            query = entityManager.createQuery("Select p from PlainElements as p where p.plainID = " + plain.getPlainID().intValue());
                            lstPlainElements = query.getResultList();
                            for (PlainElements plainElements : lstPlainElements) {
                                switch (plainElements.getElementType()) {
                                    case 0x80:
                                        iButtonCount++;
                                        break;
                                    case 0x86:
                                        iIFrameCount++;
                                        break;
                                    case 0x82:
                                        iBMPCount++;
                                        break;
                                    case 0x85:
                                        iVDOCount++;
                                        break;
                                }
                            }
                        }
                        htbCount.put(Constants.Animation_Constants.Plain_Count, iPlainCount);
                        htbCount.put(Constants.Animation_Constants.IFrame_Count, iIFrameCount);
                        htbCount.put(Constants.Animation_Constants.BMP_Count, iBMPCount);
                        log.debug("animation.getAnimationID()::::::::::::" + animation.getAnimationID());
                        htbCount.put(Constants.Animation_Constants.Button_Count, iButtonCount);
                        htbCount.put(Constants.Animation_Constants.Video_Count, iVDOCount);
                        htbCount.put(Constants.Animation_Constants.Animation_ID, animation.getAnimationID());
                        htbDetail.put(animation.getAnimationName(), htbCount);
                    }
                    htbResponse.put(Response.Data, htbDetail);
                    errorIndex = Error_Message.No_Error;
                } else {
                    errorIndex = Error_Message.Animation_Not_Available;
                }
            } else {
                errorIndex = Error_Message.Invalid_Data_Provided;
            }
        } catch (Exception e) {
            log.error("Exception in getAnimationDetailsByLoginID::::::::::::");
            e.printStackTrace();
        }
        htbResponse.put(Error_Message.ERROR_INDEX, errorIndex);
        log.info("Exit from getAnimationDetailsByLoginID::::::::::::" + htbResponse);
        return htbResponse;
    }
}


Application.java (Entity Bean)

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.le.graphicsServer.persistence;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;

/**
 *
 * @author rahul.nikhra
 */
@Entity
public class Animation implements Serializable {

    private static final long serialVersionUID = 1L;
    private Integer animationID;
    private String animationName;
    private Integer validated;
    private String userID;
    public Collection < Plain > collPlain;
    public Collection < Button > collbuttons;

    @Id
    @GeneratedValue
    public Integer getAnimationID() {
        return animationID;
    }

    public void setAnimationID(Integer animationID) {
        this.animationID = animationID;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public String getAnimationName() {
        return animationName;
    }

    public void setAnimationName(String animationName) {
        this.animationName = animationName;
    }

    public Integer getValidated() {
        return validated;
    }

    public void setValidated(Integer validated) {
        this.validated = validated;
    }
/////////////////////////////////////////////////////////////////////////////////
    @OneToMany
    @JoinColumn(name = "animationID")
    public Collection < Plain > getPlains() {
        return collPlain;
    }

    public void setPlains(Collection< Plain > collPlain) {
        this.collPlain = collPlain;
    }

    @OneToMany(mappedBy = "linkID")
    public Collection < Button > getButtons() {
        return collbuttons;
    }

    public void setButtons(Collection < Button > buttons) {
        this.collbuttons = buttons;
    }
/////////////////////////////////////////////////////////////////////////////////
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (animationID != null ? animationID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Animation)) {
            return false;
        }
        Animation other = (Animation) object;
        if ((this.animationID == null && other.animationID != null) || (this.animationID != null && !this.animationID.equals(other.animationID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Persistence.Animation[animationID=" + animationID + "]";
    }
}





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4179474#4179474

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4179474



More information about the jboss-user mailing list