dcsimg
accessing a ejb session function from client iam facing some runtime exceptions --
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   nreddy_nreddy
Posted On:   Thursday, February 24, 2005 06:22 AM

hi , iam facing problem in case: iam accessing function present in a bean which is session bean..ok my server jboss 3 (internally tomact 5.0) this is my progrm iam able to run but not compiling ... ------------------------------ my actual program----------------- import javax.naming.*; import java.io.*; import javax.rmi.*; import java.util.*; import java.rmi.*; import javax.ejb.*; import java.lang.*; import java.rmi.RemoteException; import com.mae.component.deal.databean.DealData; import com.mae.component.deal.databean.DealDataList; import com.mae.component.valueobject.ComponentIdentifier;    More>>

hi ,
iam facing problem in
case: iam accessing function present in a bean which is session bean..ok
my server jboss 3 (internally tomact 5.0)


this is my progrm iam able to run but not compiling ...







------------------------------ my actual program-----------------
import javax.naming.*;
import java.io.*;
import javax.rmi.*;
import java.util.*;
import java.rmi.*;
import javax.ejb.*;
import java.lang.*;
import java.rmi.RemoteException;
import com.mae.component.deal.databean.DealData;
import com.mae.component.deal.databean.DealDataList;
import com.mae.component.valueobject.ComponentIdentifier;
import com.mae.component.valueobject.types.ComponentType;
import com.mae.security.sessionmgmt.*;
import java.io.PrintStream;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import com.mae.component.util.ComponentUtil;
import com.mae.component.valueobject.ComponentIdentifier;
import com.mae.component.valueobject.types.ComponentType;
import com.mae.config.ServerConfigException;
import com.mae.logging.SystemLogger;
import com.mae.security.accessctrl.exception.PermissionDeniedException;
import com.mae.security.sessionmgmt.UserSessionContext;
import com.mae.template.TemplateEngine;
import com.mae.util.*;
import java.io.File;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import com.mae.component.ComponentRegistry;
import com.mae.component.user.UserComponentFactory;
import com.mae.common.BaseSessionBean;
import com.mae.logging.SystemLogger;
import com.mae.component.valueobject.ComponentIdentifier;
import com.mae.component.valueobject.types.ComponentType;
import com.mae.component.exception.ComponentNotFoundException;
import com.mae.component.exception.ComponentReadException;
import com.mae.component.exception.ComponentCreateException;
import com.mae.component.exception.ComponentUpdateException;
import com.mae.component.ComponentFactory;
import com.mae.component.root.Root;
import com.mae.security.sessionmgmt.valueobject.SessionVO;
import com.mae.security.sessionmgmt.UserSessionContext;
import com.mae.security.*;
import com.mae.principal.valueobject.UserPreferenceVO;
import com.mae.exception.BaseRuntimeException;
import com.mae.util.EJBHelper;
import com.mae.component.deal.*;
public class client1
{
public client1()
{

}

public void setUp() throws Exception
{
try
{
Properties properties = new Properties();

properties.put("Context.INITIAL_CONTEXT_FACTORY","org.jnp.interfaces.NamingContextFactory");
properties.put("Context.PROVIDER_URL", "localhost:8080");
InitialContext initialcontext =new InitialContext(properties);
Object obj = initialcontext.lookup("com/mae/component/DealComponent");
DealComponentLocalHome dealcomponentlocalhome =
(DealComponentLocalHome)PortableRemoteObject.narrow(obj,
com.mae.component.deal.DealComponentLocalHome.class);
dealcomponentlocal = dealcomponentlocalhome.create();
}
catch(Exception exception)
{
System.err.println("Caught an unexpected exception! in setup try 1");
exception.printStackTrace();
}
try
{
Properties properties1 = new Properties();
properties1.put("Context.INITIAL_CONTEXT_FACTORY",
"org.jnp.interfaces.NamingContextFactory");
properties1.put("Context.PROVIDER_URL", "localhost:8080");
InitialContext initialcontext1 = new InitialContext(properties1);
Object obj1 = initialcontext1.lookup("com/mae/SessionManagerLocal");
SessionManagerLocalHome sessionmanagerlocalhome =
(SessionManagerLocalHome)PortableRemoteObject.narrow(obj1,
com.mae.security.sessionmgmt.SessionManagerLocalHome.class);
sessionmanagerlocal = sessionmanagerlocalhome.create();
}
catch(Exception exception1)
{
System.err.println("Caught an unexpected exception! in setup try 2");
exception1.printStackTrace();
}
}
public void test() throws Exception
{
com.mae.security.sessionmgmt.valueobject.SessionVO sessionvo =
sessionmanagerlocal.establishSession("admin", "admin", objValidityDuration);
UserSessionContext usersessioncontext = new UserSessionContext(sessionvo);
ComponentIdentifier componentidentifier = new ComponentIdentifier();
componentidentifier.setId(1001);
componentidentifier.setType(ComponentType.DEAL);
componentidentifier.setVersion(1L);
DealData dt=new DealData();

// DealDataList dealdatalist = dealcomponentlocal.getAllDeals(usersessioncontext,);

}
DealComponentLocal dealcomponentlocal;
SessionManagerLocal sessionmanagerlocal;
public Long objValidityDuration;
public static void main(String g[]) throws Exception
{
client1 c1=new client1();
c1.setUp();
c1.test();
}
}

------------------end my program---------------








when i compaile no errors but in run time iam getting errorslike.......................





E:Jboss_10gjboss-3.2.3client>java client1
Caught an unexpected exception! in setup try 1
javax.naming.NoInitialContextException: Need to specify class name in environment or system property
, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at client1.setUp(client1.java:70)
at client1.main(client1.java:121)
Caught an unexpected exception! in setup try 2
javax.naming.NoInitialContextException: Need to specify class name in environment or system property
, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at client1.setUp(client1.java:85)
at client1.main(client1.java:121)
Exception in thread "main" java.lang.NullPointerException
at client1.test(client1.java:98)
! at client1.main(client1.java:122)
-----------------------------------------------------------------------******************



actually i copied the jndi name from this program ...........
public interface DealComponentLocalHome
extends EJBLocalHome
{
public abstract DealComponentLocal create()
throws CreateException;
public static final String COMP_NAME = "java:comp/env/ejb/DealComponentLocal";
public static final String JNDI_NAME = "com/mae/component/DealComponentLocal";
}

----------------
actuall bean is ---DealBean---- which is implemented all methods.........

   <<Less
About | Sitemap | Contact