After one week of searching my mistake i found it :-)

The container gave no stack trace and only showed the message "Failed to
start container:  [Caused by: java.lang.reflect.InvocationTargetException]".
But my mistake was, that myOtherClass was not in the same package
(respectivly in a subpackage) as PeerInstace.

But now i've an other problem for which i can't find a solution for hours:

    public void addTopic(String topic, TopicList topicList) throws Exception
    {
          topicPath.add(topic); // topicPath is a string array, in the given
example: [action], the tree has the following structure: root=action

        if(topic (eg: action) exists, then insert subtopic (eg:
conditional))
            insertTopic(topic, subLevel, topicPath, topicList);
        else
        {
          Topic newTopic = new SimpleTopic(new QName(NS, topic)); //
topicpath2String converts the string array to a string: [action] => action
          System.out.println("A Topic newTopic = new done [LN " +
newTopic.getName().getLocalPart() + "]");    
            
          newTopic.setTopicPath(topicPath);
          System.out.println("B newTopic.setTopicPath(topicPath)
["+topicpath2string(topicPath)+"] done");    
            
          topicList.addTopic(newTopic);
          System.out.println("C topicList.addTopic(newTopic) done");    
       }
    }

   private void insertTopic(Topic root, String topic, List<String>
topicPath, TopicList topicList)
   {
        topicPath.add(currentLevel); // topicPath is a string array, in the
given example: [action][conditional], the tree has the following structure:
root=action child=conditional
        
        Topic newNode = new SimpleTopic(new QName(NS,
topicpath2string(topicPath))); // topicpath2String converts the string array
to a string with / as divider: [action][conditional] => action/conditional
        System.out.println("1 Topic newNode = new done [LN " +
newNode.getName().getLocalPart() + "]"); // debug message
            
        newNode.setTopicPath(topicPath);
        System.out.println("2 root.setTopicPath(topicPath)
["+topicpath2string(topicPath)+"]");

        root.addTopic(newNode);
        System.out.println("3 root.addTopic(newNode) done");
                
        topicList.addTopic(newNode);
        System.out.println("4 topicList.addTopic done");
    }

When I start the globus-container i get the following exception/output:
A Topic newTopic = new done [LN Action]
B newTopic.setTopicPath(topicPath) [Action] done
C topicList.addTopic(newTopic) done
1 Topic newNode = new done [LN Action/conditional]
2 root.setTopicPath(topicPath) [Action/conditional]
java.lang.RuntimeException: Topic path either null or not of size 1
        at
org.globus.wsrf.impl.SimpleTopicList.topicAdded(SimpleTopicList.java:207)
        at org.globus.wsrf.impl.SimpleTopic.topicAdded(SimpleTopic.java:188)
        at org.globus.wsrf.impl.SimpleTopic.addTopic(SimpleTopic.java:64)
        at
at.katai.distPS.peer.impl.topic.TopicTree.insertTopic(TopicTree.java:165)
        at
at.katai.distPS.peer.impl.topic.TopicTree.addTopic(TopicTree.java:79)
        [...]

I've absolutly no idea why insertTopic(){ root.addTopic(newNode); } crashes
with the message "java.lang.RuntimeException: Topic path either null or not
of size 1". If i understand the tutorial correct, the topicpath for the tree
  Action
  |
  +-conditional
has to be a string arry [Action][conditional]?

lg michael


> -----Original Message-----
> From: Rachana Ananthakrishnan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 11, 2007 3:03 PM
> To: 'Michael Katai'; [email protected]
> Subject: RE: [gt-user] TopicTree in WS
> 
> Can you print stack trace of the exception to see what is causing it ?
> 
> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/reflect/InvocationTar
> getEx
> ception.html
> 
> Rachana
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Michael Katai
> > Sent: Monday, September 10, 2007 4:16 PM
> > To: [email protected]
> > Subject: [gt-user] TopicTree in WS
> >
> > Hello!
> >
> > I will write a notification producer with java-ws-core, where
> > the class has the following skelleton:
> >
> > public class PeerInstance implements Resource,
> > ResourceProperties, TopicListAccessor {
> >   public PeerInstance()
> >   {
> >     instance1 = new myClass();
> >     instance2 = myOtherClass.getInstance();
> >   }
> > }
> >
> > public class myClass
> > {
> >   public static myClass getInstance() throws Exception
> >   {
> >     return new myClass();
> >   }
> > }
> >
> > The instantiation of instance1 works fine, but the
> > getInstance-call crashes
> > with:
> > Failed to start container:  [Caused by:
> > java.lang.reflect.InvocationTargetException]
> >
> > Has anybody an idea why?
> > And is there another tutorial in addition to
> > http://gdp.globus.org/gt4-tutorial/download/progtutorial-pdf_0
> > .2.1.tar.gz ?
> >
> > thanks for your help,
> >   michael
> >

Reply via email to