3 Replies Latest reply on Dec 6, 2011 10:16 AM by Tom Cunningham

    Service with invmScope GLOBAL not found in jUDDI Registry

    Eduardo Teodoro Newbie

      Hi,

       

      I've created a service with no providers and no listeners in ESB that will only be called by standalone applications, deployed in other instance of jboss (remote invocation).

       

      The only way I found to make this service to work this way (with no providers, no Message-Aware Listener) was setting invmScope=GLOBAL. My problem is that this service is not found in jUDDI Regsitry (http://localhost:8080/uddi-console/uddibrowser.jsp), so when I call the service from my standalone app,

          

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

                                    ServiceInvoker invoker = new ServiceInvoker("MyServiceCategory", "MyService");

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

        Message returnMsg = invoker.deliverSync(msg, 10000l);

       

      I got the error:

       

           org.jboss.soa.esb.listeners.message.MissingServiceException: Registry details for service [MyServiceCategory:MyService] could not be determined from the registry.

       

       

      If I go to JBoss ESB Service List, my service is listed there as INVM service but is not in jUDDI Registry.

      All jars and files (META-INF/uddi.xml, jbossesb-properties.xml, juddi.properties, jndi.properties) are in the classpath from client apps.

       

      Why this service is not registered in the jUDDI Registry? How can I solve my problem?

       

       

      Thanks in advance.

        • 1. Re: Service with invmScope GLOBAL not found in jUDDI Registry
          Tom Cunningham Master

          I just tried this scenario with the helloworld quickstart edited down (ESB 4.10, AS 5.1.0.GA) and had no problems sending a message.      Chapter 3.1 in the Programmer's Guide contains quite a bit of background that'd be helpful to you here (although there is an error in the first jboss-esb.xml - the inVMScope goes on the service, not the jbossesb).

           

          Can you give me a simple jboss-esb.xml to try?    I used the SendEsbMessage.java from the helloworld quickstart to do the ServiceInvoker work for me.

           

          Your service's EPR is likely being handled by the InVMRegistryInterceptor and that's why it's not registered in jUDDI.     I think there's some info in the Services Guide on that.

          • 2. Re: Service with invmScope GLOBAL not found in jUDDI Registry
            Eduardo Teodoro Newbie

            Hi Tom,

             

            Here is my jboss-esb.xml, action class and client. Maybe the helloworld quickstart had no problems because it was registered in juddi registry already.

             

            Try a new service that is not registered in juddi registry yet. If you set inVmScope Global, it won't be registered. You can use my example, if you want to, by replacing the class Book for a simple String and comenting the EJB3 call in the action.

             

            My scenario has 2 instances os JBoss:

                 SOAP 5.1 - ESB  - ports-default

                 EAP 5.1 - EJB - ports-01

             

             

            1) jboss-esb.xml

             

            <?xml version="1.0"?>

            <jbossesb parameterReloadSecs="5"

                      xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd"

                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"           xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd           http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd">

             

            <services>

                 <service category="MyServiceCategory" description="Just a test" invmScope="GLOBAL" name="MyService"> 

                       <actions mep="RequestResponse">

                            <action class="br.com.soa.action.AddBookAction" name="AddBook"/>

                       </actions>

                 </service>

            </services>

            </jbossesb>

             

             

            2) AddBookAction.java

             

            public class AddBookAction {

             

                      @Process

                      public Message addBook(Message msg) {

                                Object obj = msg.getBody().get("book");

                                Book myBook = (Book) obj;

             

                                try {

                                          Properties prop = new Properties();

                                          prop.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");

                                          prop.put("java.naming.provider.url", "jnp://localhost:1199");

                                          prop.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

             

                                          InitialContext context = new InitialContext(prop);

                                          BookingService ejb = (BookingService) context.lookup("Library-EAR/BookingServiceBean/remote");

                                          ejb.save(myBook);

             

                                          msg.getBody().add("Status" , "sucess");

             

                                } catch (Exception e) {

                                          System.out.println("Erro: " + e.getMessage());

                                          msg.getBody().add("Status" , "error");

                                }

             

                                return msg;

                      }

             

             

            3) ClientApp.java

             

            public static void main(String[] args) {

                 try {

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

                                                    ServiceInvoker invoker = new ServiceInvoker("MyServiceCategory", "MyService");

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

             

                                                      Book book = new Book();

                                                      book.setId(new Long(1));

                                                      book.setTitle("ESB Test");

             

                                                     msg.getBody().add("book", book); 

                                                     msg.getProperties().setProperty("org.jboss.soa.esb.exceptionOnDeliverFailure", "true");

             

                                                    Message returnMessage = invoker.deliverSync(msg, 2000l);

                                                    String str = (String) retorno.getBody().get("Status");

                                                    System.out.println("status of test: " + str);

             

                                  } catch (Exception e) {

                                                    System.out.println("Error: " + e.getMessage());

                                                    System.exit(0);

                                  }

                      }

            • 3. Re: Service with invmScope GLOBAL not found in jUDDI Registry
              Tom Cunningham Master

              The simple answer here is just to add an ESB-aware and a gateway queue.       That way your service gets registered in jUDDI and that error goes away.     The InVM EPR being created by your configuration as posted isn't going to get one registered - and as long as you try to synchronously deliver you'll keep seeing that message until you add some form of external endpoint.