Friday, May 29, 2015

How could I execute SQL query in ESQL

Usually I used to call stored procedure rather than executing SQL query directly in message flow, but this round the use case is a bit different. Is it possible to submit query in ESQL just like the prepare statement we did in regular programming language? The answer is yes. I have to put a mark mention that I have no knowledge about message flow programming, this skill was taught by my senior. This is how I make the query call:
    DECLARE query CHARACTER 'select tabA.colA, tabA.colB from Table_A tabA';
    DECLARE totalRow INTEGER;
    DECLARE I INTEGER;
    SET Environment.Variable.ResultSet[] = PASSTHRU(query);
    SET totalRow = CARDINALITY(Environment.Variable.ResultSet[]);
    IF (totalRow = 1) THEN
     SET OutputRoot.SOAP.Body.ns1:ServiceAResponse.ns1:Category.ns1:FieldA = Environment.Variable.ResultSet.colA;
     SET OutputRoot.SOAP.Body.ns1:ServiceAResponse.ns1:Category.ns1:FieldB = Environment.Variable.ResultSet.colB;
    ELSE
     SET I = 1;
     WHILE I < totalRow DO   
      SET OutputRoot.SOAP.Body.ns1:ServiceAResponse.ns1:Category[I].ns1:FieldA = Environment.Variable.ResultSet[I].colA;
      SET OutputRoot.SOAP.Body.ns1:ServiceAResponse.ns1:Category[I].ns1:FieldB = Environment.Variable.ResultSet[I].colB;
      SET I = I + 1;
     END WHILE;
    END IF;
The statement at line 4, PASSTHRU(query), is how I execute the query. The result will be store in ResultSet[]. It is an array. And then at line 11 is how I loop through the result set from DB

Take note also if the result set return just 1 row of record, I have to explicitly tell the program how it should be execute. Notice the difference between line 7 and line 12? This is because in ESQL, the assignment of only 1 value can't be done to a variable of array type.

Feeling stunt? Yes, I am.

Establish Informix connection in Message Broker

In order to allow WebSphere Message Broker (WMB) establish connection to Informix database, first I must have data source configure in Windows. The configuration was done through ODBC. The very first step is to have Informix driver install in Windows, otherwise there is no room for WMB connect to Informix. Following are the summary steps for the setup:
  1. Install Informix driver.
  2. Go to Control Panel > Administrative Tools > Data Sources (ODBC) > Drivers tab > Verify driver is there.
  3. In system DSN tab > Add new data source.
  4. Setup necessary details and choose 'olsoctcp' protocal.
Once done, the data source has to be register into WMB. Open up WMB command prompt and fire following command:

mqsisetdbparms Broker_Name -n Data_Source_Name -u username -p password

mqsicvp Broker_name -n Data_Source_Name

The last command is to verify the data source is successfully registered into message broker. And for each command entered, BIP8071I: Successful command completion. should be seen. Do take note also if the Windows command prompt is used instead of WMB command prompt, issue C:\IBM\MQSI\8.0.0.3\bin\mqsiprofile.cmd before any mqsi_xxx command can be used.

Continuous build on Message Flow with Jenkin

Every time there is a new release, I am required to get the latest source from SVN, make the build and then deploy using WebSphere Message Broker Toolkit. This is so manual way. Then later something cool pops up in my mind: “Could it be better if I automate the process in Jenkins”? Since Jenkins do support Windows batch command and WebSphere Message Broker able to accomplished task through command line, thus both tools might integrate together. Here are the steps to mimic the whole process from start to end:
  1. Clean the workspace.
  2. Get latest source from SVN.
  3. Build the bar file.
  4. Deploy to server.
Let’s start coding on batch script.
del /s /q MessageFlowProject\*.*
    for /d %%x in (.\MessageFlowProject\*) do @rd /s /q "%%x"
    FOR /f "tokens=*" %%G IN ('DIR /b /ad /s MessageFlowProject\*.svn*') DO RMDIR /s /q "%%G"
    
    svn checkout --force SVN_URL module_A
    svn checkout --force SVN_URL module_B
    svn checkout --force SVN_URL module_C
    svn checkout –-force SVN_URL MessageFlowProject
    
    C:\"Program Files"\IBM\MQSI\8.0.0.3\bin\mqsiprofile.cmd
    
    mqsipackagebar -a MessageFlowProject.bar -w . -y module_A module_B module_C MessageFlowProject
    
    mqsideploy -i 192.168.1.2 -p 1418 -q QueueA -e GRP.A -a MessageFlowProject.bar -w 600
Notice the 3rd is required to clean .svn path as the 2nd statement unable to handle hidden path since .svn are hidden in file system. The script doesn’t work as expected in Jenkins environment. The build result was successful, and I could see following trace in the console output:
C:\Users\Vendor\.jenkins\jobs\Job1\workspace>C:\IBM\MQSI\8.0.0.3\bin\mqsiprofile.cmd
    MQSI 8.0.0.3
    C:\IBM\MQSI\8.0.0.3
I notice the last 2 statements, which is mqsi*, doesn’t get invoke after mqsiprofile.cmd were executed. I think this is due to mqsiprofile.cmd has additional environment configure to the system where Jenkins not able to read from there.

I’m running out of clue how could I continue, I am stuck!

Calendar input in data table filter

Primefaces’s DataTable is such a nice component where it allows me to implement filter on the table without additional code. There is still limitation when filter on calendar as I need to type in exactly the same string as shown in cell. I received complaint from users mention that it should be restrict to only calendar input to avoid human typo error. This sound like a lot of code change to my existing code!
    <p:dataTable id="dataTable">
       ...
    
       <p:column id="listOn" 
                 headerText="Listing Date"
                 filterFunction="#{uploadFileController.filterByDate}"
                 filterBy="#{dataItem.listOn}">
          <p:outputLabel value="#{dataItem.listOn}">
             <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
          </p:outputLabel>
       </p:column>
    
    <p:dataTable>
The piece above shows the original code implementing default filter. But after some try and error it doesn’t seem that difficult. Here are the steps to accomplish the task.
  1. Attach the calendar into filter input. 
  2. Update data table view after a date is select from calendar input.
  3. Reset data table view after filter input value is wiped off.
    <p:dataTable id="dataTable" widgetVar=”theTable”>
    
       ...
    
       <p:column id="listOn" 
                 headerText="Listing Date"
                 filterFunction="#{theController.filterByDate}"
                 filterBy="#{dataItem.listOn}">
             <f:facet name="filter">
                <p:calendar id="cal1" pattern="yyyy-MM-dd">
                   <p:ajax event="dateSelect" oncomplete="PF('theTable').filter()" update="dataTable" />
                   <p:ajax event="change" execute="@this" oncomplete="PF('theTable').filter()" update="dataTable"/>
                </p:calendar>
             </f:facet>
          <p:outputLabel value="#{dataItem.listOn}">
             <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
          </p:outputLabel>
       </p:column>
    
    <p:dataTable>

Thursday, May 28, 2015

Little trick on handling Maven failed to transfer error...

Transfer error again...
This is so frustrating every time I receive this error: Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://maven.repository.redhat.com/techpreview/all was cached in the local repository, resolution will not be reattempted until the update interval of jboss-ga-plugin-repository has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to jboss-ga-plugin-repository (http://maven.repository.redhat.com/techpreview/all): The operation was cancelled.
I have seen this error for so many times, and usually my action plan was:
  1. Refresh and clean the project.
  2. Force update Maven dependencies to the project.
And usually the result were still the same. There is a little nice trick could be done for this error, I got this trick from my senior:
  1. Open command prompt.
  2. Change directory to .m2 repository.
  3. Fire this command for /r %i in (*.lastUpdated) do del %i and wait until it complete.
  4. Force update Maven dependencies to the project.
This should cure the problem.

Saturday, May 23, 2015

Arquillian is looking for com/opera/core/systems/OperaDriver

On last week when I was unit testing with Arquillian, I got this error causing my unit test failed.
java.lang.NoClassDefFoundError: com/opera/core/systems/OperaDriver
 at java.lang.Class.getDeclaredMethods0(Native Method)
 at java.lang.Class.privateGetDeclaredMethods(Class.java:2575)
 at java.lang.Class.getDeclaredMethods(Class.java:1857)
 at org.jboss.arquillian.core.impl.Reflections.getObserverMethods(Reflections.java:52)
 at org.jboss.arquillian.core.impl.ExtensionImpl.of(ExtensionImpl.java:51)
 at org.jboss.arquillian.core.impl.ManagerImpl.inject(ManagerImpl.java:198)
 at org.jboss.arquillian.core.impl.InjectorImpl.inject(InjectorImpl.java:58)
 at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.createServiceInstance(ServiceRegistryLoader.java:108)
 at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.all(ServiceRegistryLoader.java:55)
 at org.jboss.arquillian.drone.impl.DroneRegistrar.registerConfigurators(DroneRegistrar.java:84)
 at org.jboss.arquillian.drone.impl.DroneRegistrar.register(DroneRegistrar.java:77)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
 at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
 at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
 at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
 at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
 at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
 at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
 at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)
 at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:97)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: com.opera.core.systems.OperaDriver
 at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
 ... 35 more
While spotting the error on the Maven configuration, I found out that grahene-webdriver and arquillian-drone-webdriver were both declare in POM.
        <dependency>
         <groupid>org.jboss.arquillian.graphene</groupid>
         <artifactid>graphene-webdriver</artifactid>
         <version>2.0.0.Alpha1</version>
         <type>pom</type>
         <scope>test</scope>
        </dependency>
        
        <dependency>
         <groupid>org.jboss.arquillian.graphene</groupid>
         <artifactid>graphene-webdriver-drone</artifactid>
         <version>2.0.0.Alpha3</version>
         <scope>test</scope>
        </dependency>
        
        <dependency>
         <groupid>org.jboss.arquillian.extension</groupid>
         <artifactid>arquillian-drone-webdriver</artifactid>
         <scope>test</scope>
        </dependency>
        
        <dependency>
         <groupid>org.jboss.arquillian.extension</groupid>
         <artifactid>arquillian-drone-webdriver-depchain</artifactid>
         <type>pom</type>
         <scope>test</scope>
        </dependency>
Why both web driver were declare? That was my first question come into my mind. Is that necessary? Is there any difference? As according to the Arquillian guide, I'm suppose to have graphene-webdriver with version 2.0.3.Final. And the other 3 dependencies are not needed. This has my problem resolved.

Saturday, May 16, 2015

Now I have Tomcat with Arquillian

Beginning mid of April until now, I have already spent almost 27 hours on the alien tool, Arquillian. The major problem I'm facing with this tool is the setup, the setup guide didn't mention clearly which Arquillian version should correlated with JBoss version. End up I spent my whole day fighting on the version issue. As of today, I am still failing to make it work with JBoss. This has greatly jeopardize my progress.

This is what make me failed during the setup for JBoss.
        <dependency>
         <groupid>org.jboss.spec</groupid>
         <artifactid>jboss-javaee-6.0</artifactid>
         <version>3.0.2.Final</version>
         <type>pom</type>
         <scope>provided</scope>
        </dependency>
        <dependency>
         <groupid>org.jboss.as</groupid>
         <artifactid>jboss-as-arquillian-container-managed</artifactid>
         <scope>test</scope>
        </dependency>
And this is what I have for Arquillian:
        <dependency>
            <groupid>org.jboss.arquillian.junit</groupid>
            <artifactid>arquillian-junit-container</artifactid>
            <scope>test</scope>
        <dependency>
            <groupid>org.jboss.arquillian.protocol</groupid>
            <artifactid>arquillian-protocol-servlet</artifactid>
            <scope>test</scope>
        </dependency>
        <dependency>
         <groupid>org.jboss.arquillian.graphene</groupid>
         <artifactid>graphene-webdriver-drone</artifactid>
         <version>2.0.0.Alpha3</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupid>org.jboss.arquillian.extension</groupid>
         <artifactid>arquillian-drone-webdriver</artifactid>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupid>org.jboss.arquillian.extension</groupid>
         <artifactid>arquillian-drone-webdriver-depchain</artifactid>
         <type>pom</type>
         <scope>test</scope>
        </dependency>
So far I only manage to make it work on Tomcat, and this is what I have for Tomcat:
        <dependency>
         <groupId>org.jboss.arquillian.container</groupId>
         <artifactId>arquillian-tomcat-embedded-7</artifactId>
         <version>1.0.0.CR4</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>org.apache.tomcat.embed</groupId>
         <artifactId>tomcat-embed-core</artifactId>
         <version>7.0.42</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>org.apache.tomcat.embed</groupId>
         <artifactId>tomcat-embed-jasper</artifactId>
         <version>7.0.42</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>org.apache.tomcat.embed</groupId>
         <artifactId>tomcat-embed-logging-juli</artifactId>
         <version>7.0.42</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>org.eclipse.jdt.core.compiler</groupId>
         <artifactId>ecj</artifactId>
         <version>4.2.2</version>
         <scope>test</scope>
        </dependency>
When running on Tomcat, there is additional stuff is needed which is not mentioned in Arquillian documentation, but I found it in the forum mention that I must have org.jboss.weld.environment.servlet.Listener in web.xml. First the following library is require:
        <dependency>
         <groupId>org.jboss.weld.servlet</groupId>
         <artifactId>weld-servlet</artifactId>
         <version>2.0.3.Final</version>
         <scope>test</scope>
        </dependency>
And then create a new web.xml in src/test/resources with following content:
<web-app id="WebApp_ID" version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
 <display-name>WebEngineering3</display-name>
 <welcome-file-list>
  <welcome-file>index.xhtml</welcome-file>
 </welcome-file-list>
 
 <servlet>
  <servlet-name>Faces Servlet</servlet-name>
  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.xhtml</url-pattern>
 </servlet-mapping>
 
 <listener>
  <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
 </listener>
</web-app>

Friday, May 1, 2015

Arquillian throws IllegalArgumentException during packaging with ShrinkWrap

Just come across Arquillian and find it so cool that I am able to perform unit test on front end without the 'Selenium way'. The way the Selenium did was I have to leave my computer alone while the test is running otherwise the test result will not accurate.

Now with this creature, I am worry free. In 'Arquillian way', I'm no longer have the web deploy to the server and have the server up and running before the test run. All I have to do were done in programming, this will include package the content in war file and get it deploy to server. It wasn't an Ant build, it was using ShrinkWrap.

Assuming I have my classes put inside the package org.huahsin68, the first step in unit test was the war packaging. It was done with the piece shows below:
   @Deployment(testable=false)
   public static WebArchive createDeployments() {
      WebArchive war = ShrinkWrap.create(WebArchive.class, "ThePackage.war");
      war.setWebXML(new File(WEBAPP_SRC, "WEB-INF/web.xml"));
      war.addPackage(java.lang.Package.getPackage("org.huahsin"));
      war.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
      war.addAsWebResource(new File(WEBAPP_SRC, "index.xhtml"));

      return war;
   }
Somehow there is an error with that piece when the test were run. Following stacktrace tells the whole story.
java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive org.huahsin68.IndexBeanTest.createDeployment()
 at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:177)
 at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:99)
 at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:62)
 at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
 at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
 at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
 at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
 at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
 at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
 at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:100)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
 at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
 at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
 at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
 at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
 at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
 at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
 at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
 at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
 at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)
 at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)
 at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
 at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
 at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
 at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:173)
 ... 50 more
Caused by: java.lang.IllegalArgumentException: Pack must be specified
 at org.jboss.shrinkwrap.impl.base.Validate.notNull(Validate.java:43)
 at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addPackage(ContainerBase.java:1363)
 at org.huahsin68.IndexBeanTest.createDeployment(IndexBeanTest.java:42)
 ... 55 more
There is a lazy way to resolve this issue, just pick any of the class and retrieve the package name from that class. Thus I replace the code:

war.addPackage(java.lang.Package.getPackage("org.huahsin"));

with this:

war.addPackage(anyClass.class.getPackage());

But this is not the clean way because if the class will going to remove in one day and this could lead to a disaster.

Good luck!