Display Debug Information

2006-03-22
2013-05-02
  • Stephen More
    Stephen More
    2006-03-22

    I am having some problems getting upnp-sample-* to work.

    In TvFrame.java I placed:
        org.cybergarage.util.Debug.on();
    then I recompiled.

    I see no output to stdout.
    I do see the sample tv image but that is it.

    upnpdump.pl also shows nothing.
    What can I do to figure out what is wrong ?

     
    • Stefano Lenzi
      Stefano Lenzi
      2006-03-22

      Hi mores,
           Are you running the sample on windows with the javaw command line?
      If so that's way you're not able to get any debug information.

      Otherwise if you're running it inside a IDE like Eclipse it's very strange.

      BTW, can you give us more information about your system:
      - OS?
      - JBM?
      - IDE?

      Ciao,
      Stefano "Kismet" Lenzi

       
    • Stephen More
      Stephen More
      2006-03-22

      OS: Red Hat Enterprise Linux ES release 4
      JVM: java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

      No ide, this is command line on a linux box.

      org/cybergarage/util/Debug.java show output going to System.out. Why would I not see this from a command line ?

       
      • Stefano Lenzi
        Stefano Lenzi
        2006-03-22

        Hi Stephen,
            That's sound strange... running the program from command line should show the System.out

        Are you sure that you are using HotSpot JDK instead of gcj? Which is the output of java -version?

        Strange result can be generated even by more that Device or ControlPoint running on the same instance of the JVM, but if you are running the example without changing the that's not the case.

        Other reason can be not alligned version between sources and binary that you're using, you can try with deleting *ALL* .class and rebuild.

        BTW, can you tell me which kind of trouble do you  need to debug beacuse may be we can reach the same objective in a different way.

        Ciao,
        Stefano "Kismet" Lenzi

         
    • Stephen More
      Stephen More
      2006-03-23

      Yes, it is Sun's version. The output I provided was from java -version.

      My real trouble is that I am trying to write my own upnp device. My code is extremely simple:

      public class JavaRenderer extends org.cybergarage.upnp.Device
      {
              public JavaRenderer( String[] args ) throws org.cybergarage.upnp.device.InvalidDescriptionException
              {
                      super( "description/JavaRenderer.xml" );
              }

              public static void main( String args[] )
              {
                      try
                      {
                              final JavaRenderer jr = new JavaRenderer( args );

                              jr.start();

                              Runtime.getRuntime().addShutdownHook( new Thread()
                              {
                                      public void run()
                                      {
                                              System.out.println("Java runtime shutting down");
                                              jr.stop();
                                      }
                              });
                      }
                      catch( Exception e )
                      {
                              e.printStackTrace();
                      }
            }

      }

      I expect this to bind to the default port and stay running until I stop it. This is not the case. The only output I get is:
      Java runtime shutting down

      I get no excpetions. I thought I must be doing something wrong so I started to play with the examples and found out that I can't get them to work either. 

       
    • Stefano Lenzi
      Stefano Lenzi
      2006-03-23

      Hi Stephen,
         I think to have some tips for you. Do you have IPv6 configured on some of your interface? If so change the configuration of UPnP so that it avoid to bind services to IPv6.

          Also the code that you're using do not enable the debug string you should try to enable it with:
      org.cybergarage.util.Debug.on();
        
      Ciao,
      Stefano "Kismet" Lenzi

       
    • Stephen More
      Stephen More
      2006-03-23

      Yes. The problem was IPv6.
      There was no output of anykind informing me of this.

      Can someone add to line 72 of
      org/cybergarage/http/HTTPServerList.java

      if (Debug.isOn() == true)
           Debug.message( "using IP: " + bindAddr + " port: " + port );

      Then when it happens again the output will be helpful.

       
      • Stefano Lenzi
        Stefano Lenzi
        2006-03-23

        Stephan,
            that's is a slight bug that I found when I was unable to run the same code that was running on Win and Linux on Mac OS X, and by debugging line by line I found that was unable to bind service some IPv& address, if I remember well the problem is generated by the IP on the interface sit0.

        Glad to be helpfull,
        Stefano "Kismet" Lenzi

        P.S.: I have just commit the changes that you asked