users@glassfish.java.net

Re: Error on execution of a JEE 6 App Client Project in GF 3.1.1

From: <forums_at_java.net>
Date: Thu, 1 Dec 2011 11:23:04 -0600 (CST)

Hi,
I have done some changes in my code leaving as follows,
public class EJBTestCase {
  protected Context context;
  protected EJBContainer c;
 
  protected ObtenerMaxIdPedidoUsuario bean;
  public EJBTestCase() {
  }
  @Test
  public void test() throws Exception {
      if (context != null) {
          c.close();
      }
      HashMap<String, Object> props = new HashMap<String, Object>();
      File[] ejbModules = new File[1];
      ejbModules[0] = new File("ejb-app/classes");
      props.put(EJBContainer.MODULES, ejbModules);
      c = EJBContainer.createEJBContainer(props);
      context = c.getContext();
     
      bean = (ObtenerMaxIdPedidoUsuario) context.
       
lookup("java:global/ejb-app/classes/ObtenerMaxIdPedidoUsuario");
      assertNotNull(bean);
      long maxId = bean.ObtenerMaxId();
      assertNotNull(maxId);
      System.out.println("MaxId: " + maxId);
     
      if (context != null) {
          c.close();
      }
  }
 
 
/*
  @BeforeClass
  public static void setUp() throws Exception {
    if (context != null) {
      c.close();
    }
    HashMap<String, Object> props = new HashMap<String, Object>();
    File[] ejbModules = new File[1];
    ejbModules[0] = new File("ejb-app/classes");
    props.put(EJBContainer.MODULES, ejbModules);
    c = EJBContainer.createEJBContainer();
    context = c.getContext();
  }
  @AfterClass
  public static void tearDown() throws Exception {
    if (context != null) {
      c.close();
    }
  }
 
*/
 
  public static void main(String[] s) throws Exception {
      EJBTestCase ejbTest = new EJBTestCase();
      ejbTest.test();
  }
}
And added JUnit 4 to the build path. But it still throws an exception,
01-dic-2011 18:13:23 com.sun.ejb.containers.BaseContainer initializeHome
INFO: Portable JNDI names for EJB ObtenerMaxIdPedidoUsuario :
[java:global/ejb-app/classes/ObtenerMaxIdPedidoUsuario,
java:global/ejb-app/classes/ObtenerMaxIdPedidoUsuario!session.ObtenerMaxIdPedidoUsuario]
01-dic-2011 18:13:23 com.sun.enterprise.connectors.module.ConnectorDeployer
load
ADVERTENCIA: RAR8038: unable to load the resource-adapter [ gf-client_jar ],
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
01-dic-2011 18:13:23 org.glassfish.internal.data.ModuleInfo load
GRAVE: Exception while invoking class
com.sun.enterprise.connectors.module.ConnectorDeployer load method
java.lang.RuntimeException: String index out of range: -1
    at
com.sun.enterprise.connectors.module.ConnectorDeployer.load(ConnectorDeployer.java:209)
    at
com.sun.enterprise.connectors.module.ConnectorDeployer.load(ConnectorDeployer.java:95)
    at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
    at
org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:257)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
    at
com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129)
    at
org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:142)
    at
org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)
    at
javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)
    at test.EJBTestCase.test(EJBTestCase.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    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.StringIndexOutOfBoundsException: String index out of
range: -1
    at java.lang.String.substring(String.java:1937)
    at
com.sun.appserv.connectors.internal.api.ConnectorsUtil.getEmbeddedRarModuleName(ConnectorsUtil.java:690)
    at
com.sun.enterprise.connectors.module.ConnectorDeployer.load(ConnectorDeployer.java:184)
    ... 39 more
01-dic-2011 18:13:23 org.glassfish.api.ActionReport failure
GRAVE: Exception while loading the app
01-dic-2011 18:13:23 org.glassfish.deployment.admin.DeployCommand execute
GRAVE: Exception while loading the app : String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1937)
    at
com.sun.appserv.connectors.internal.api.ConnectorsUtil.getEmbeddedRarModuleName(ConnectorsUtil.java:690)
    at
com.sun.enterprise.connectors.module.ConnectorDeployer.load(ConnectorDeployer.java:184)
    at
com.sun.enterprise.connectors.module.ConnectorDeployer.load(ConnectorDeployer.java:95)
    at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
    at
org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:257)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
    at
com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129)
    at
org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:142)
    at
org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)
    at
javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)
    at test.EJBTestCase.test(EJBTestCase.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    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)
01-dic-2011 18:13:23 org.glassfish.ejb.embedded.EJBContainerProviderImpl
createEJBContainer
INFO: [EJBContainerProviderImpl] Cleaning up on failure ...
PlainTextActionReporterFAILUREDescription: deploy AdminCommandError occurred
during deployment: Exception while loading the app : String index out of
range: -1. Please see server.log for more details.
    [name=ejb-app
01-dic-2011 18:13:24 org.glassfish.admin.mbeanserver.JMXStartupService
shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
01-dic-2011 18:13:24 org.glassfish.admin.mbeanserver.JMXStartupService
shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
01-dic-2011 18:13:24 com.sun.enterprise.v3.server.AppServerStartup stop
INFO: Shutdown procedure finished
01-dic-2011 18:13:24 AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
I am thinking of these lines of the exception,
INFO: Portable JNDI names for EJB ObtenerMaxIdPedidoUsuario :
[java:global/ejb-app/classes/ObtenerMaxIdPedidoUsuario,
java:global/ejb-app/classes/ObtenerMaxIdPedidoUsuario!session.ObtenerMaxIdPedidoUsuario]
and
01-dic-2011 18:13:23 org.glassfish.ejb.embedded.EJBContainerProviderImpl
createEJBContainer
INFO: [EJBContainerProviderImpl] Cleaning up on failure ...
PlainTextActionReporterFAILUREDescription: deploy AdminCommandError occurred
during deployment: Exception while loading the app : String index out of
range: -1. Please see server.log for more details.
    [name=ejb-app
but I do not know what is going wrong,
Any suggestion?
Thanks in advance,
Regards,
Jose


--
[Message sent by forum member 'josealvarezdelara']
View Post: http://forums.java.net/node/868910