Got it to compile with my new ConverterTest.java, but still getting this on
"ant test.weblogic.70"? I have the web.xml in my ejb dir? Packaging help?

BUILD FAILED
C:\cactus\jakarta-cactus-13-1.4\sample-servlet\build\build.xml:145: webxml
attribute is required

modified ConverterTest.java (compiles)----------------
package org.apache.cactus.sample.ejb;

import javax.naming.*;
import javax.rmi.*;
import junit.framework.*;
import org.apache.cactus.*;

//added
import java.util.Properties;
import javax.ejb.*;


public class ConverterTest extends ServletTestCase
{
        private static final String JNDI_NAME = "ConverterHome";
        private String url;     
        private Converter converter;
        private ConverterHome home;

    public ConverterTest(String name)
    {
        super(name);
    }

    public static Test suite()
    {
        return new TestSuite(ConverterTest.class);
    }


    public void setUp() throws NamingException
    {
        String url       = "t3://localhost:7001";
    // Lookup the beans home using JNDI
    try 
        {
        home = lookupHome();
                } 
    catch (NamingException ne) 
        {
          throw ne;
        }
    }
/*
    public void setUp() throws NamingException
    {
        String url       = "t3://localhost:7001";
    // Lookup the beans home using JNDI
        Context ctx = getInitialContext();
    try 
        {
            Object home = ctx.lookup(JNDI_NAME);
            return (ConverterHome) narrow(home, ConverterHome.class);

        } 
    catch (NamingException ne) 
        {
            log("The client was unable to lookup the EJBHome.  Please make
sure ");
            log("that you have deployed the ejb with the JNDI name
"+JNDI_NAME+" on the WebLogic server at "+url);
            throw ne;
        }
    } 
*/

  private ConverterHome lookupHome()
    throws NamingException
  {
    // Lookup the beans home using JNDI
    Context ctx = getInitialContext();
   
    try {
      Object home = ctx.lookup(JNDI_NAME);
      return (ConverterHome) narrow(home, ConverterHome.class);
    } catch (NamingException ne) {
      log("The client was unable to lookup the EJBHome.  Please make sure
");
      log("that you have deployed the ejb with the JNDI name "+JNDI_NAME+"
on the WebLogic server at "+url);
      throw ne;
    }
  }

//added
   private Context getInitialContext() throws NamingException 
   {
    
    try {
      // Get an InitialContext
      Properties h = new Properties();
      h.put(Context.INITIAL_CONTEXT_FACTORY,
        "weblogic.jndi.WLInitialContextFactory");
      h.put(Context.PROVIDER_URL, url);
      return new InitialContext(h);
    } catch (NamingException ne) {
      log("We were unable to get a connection to the WebLogic server at
"+url);
      log("Please make sure that the server is running.");
      throw ne;
    }
  }

    public void testConvert() throws Exception
    {
        double dollar = this.converter.convertYenToDollar(100.0);
        assertEquals("dollar", 1.0, dollar, 0.01);
    }

    //added    
    private static void log(String s) {
            System.out.println(s);
    }
    
    //added
    private Object narrow(Object ref, Class c) {
            return PortableRemoteObject.narrow(ref, c);
    }
    
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to