2 Replies Latest reply on Jun 30, 2013 10:19 AM by ricol

    null 'value' arg in method call error when testing the security-basic sample in Eclipse

    ricol

      If I am calling the security-basic sample by the ant script provided by the sample, it works fine. However, when I tried to run the SendEsbMessage from Eclipse as java application. It just threw an java.lang.IllegalArgumentException. I have changed the codes to add the parameters.

       

      The environment is JBoss ESB 5.1.0 with JBoss ESB 4.11.

       

      Exception:

       

      Security SimpleListenerSecured Hello Secured World!!! esbuser esbpassword //I printed out the parameters

      Exception in thread "main" java.lang.IllegalArgumentException: null 'value' arg in method call.

                at org.jboss.internal.soa.esb.assertion.AssertArgument.isNotNull(AssertArgument.java:43)

                at org.jboss.internal.soa.esb.message.format.xml.ContextImpl.setContext(ContextImpl.java:95)

                at org.jboss.soa.esb.samples.quickstart.securitybasic.test.SendEsbMessage.main(SendEsbMessage.java:73)

      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

       

      Main method of SendEsbMessage:

       

          public static void main(String args[]) throws Exception

          {

      //      Setting the ConnectionFactory such that it will use scout

              System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");

       

             args = new String[]{"Security","SimpleListenerSecured","Hello Secured World!!!","esbuser","esbpassword"};

       

              for(String arg : args) {

                        System.out.print(arg + " ");

              }

              System.out.print("\n");

       

              if (args.length < 5)

              {

                  System.out.println("Usage SendEsbMessage <category> <name> <text to send> <username> <password>");

              }

              Message esbMessage = MessageFactory.getInstance().getMessage();

       

                          //          create an AuthenticationRequest

                          AuthenticationRequest authRequest = new AuthenticationRequestImpl.Builder().username(args[3]).password(args[4].toCharArray()).build();

       

                          //           set the authentication request on the message

                          esbMessage.getContext().setContext(SecurityService.AUTH_REQUEST, PublicCryptoUtil.INSTANCE.encrypt((Serializable) authRequest));

       

              final String message = args[2];

              esbMessage.getBody().add(message);

       

              ServiceInvoker invoker = new ServiceInvoker(args[0], args[1]);

       

              try {

                  invoker.deliverAsync(esbMessage);

              }catch(Exception ex) {

                 ex.printStackTrace();

              }

              System.exit(0);

          }

      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      Any idea why did this happen? Thanks.