• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Cannot Access Ejb from Java Applcation

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Plzzz Help
I am trying to access stateless session ejb from java application but it is giving me following error:

. Start initializing
E. Start initializing
E. Start initializing
E. Start initializing
E
Time: 0.24
There were 4 errors:
1) testAddFileWithFileBytesNull(com.fitec.a2.test.VFSFacadeBeanAddFileTest)java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/GlobalORBExists
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:385)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:259)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:166)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:98)
at com.ibm.ws.naming.util.WsnInitCtx.<init>(WsnInitCtx.java:79)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:137)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:80)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at javax.naming.InitialContext.init(InitialContext.java:231)
at javax.naming.InitialContext.<init>(InitialContext.java:207)
at com.fitec.a2.test.VFSFacadeBeanAddFileTest.setUp(VFSFacadeBeanAddFileTest.java:72)
at com.fitec.a2.test.VFSFacadeBeanAddFileTest.main(VFSFacadeBeanAddFileTest.java:47)
2) testAddFileWithNullFileAbsolutePath(com.fitec.a2.test.VFSFacadeBeanAddFileTest)java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/GlobalORBExists
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:385)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:259)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:166)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:98)
at com.ibm.ws.naming.util.WsnInitCtx.<init>(WsnInitCtx.java:79)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:137)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:80)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at javax.naming.InitialContext.init(InitialContext.java:231)
at javax.naming.InitialContext.<init>(InitialContext.java:207)
at com.fitec.a2.test.VFSFacadeBeanAddFileTest.setUp(VFSFacadeBeanAddFileTest.java:72)
at com.fitec.a2.test.VFSFacadeBeanAddFileTest.main(VFSFacadeBeanAddFileTest.java:47)
3) testAddFileWithBlankFileAbsolutePath(com.fitec.a2.test.VFSFacadeBeanAddFileTest)java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/GlobalORBExists
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:385)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:259)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:166)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:98)
at com.ibm.ws.naming.util.WsnInitCtx.<init>(WsnInitCtx.java:79)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:137)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:80)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at javax.naming.InitialContext.init(InitialContext.java:231)
at javax.naming.InitialContext.<init>(InitialContext.java:207)
at com.fitec.a2.test.VFSFacadeBeanAddFileTest.setUp(VFSFacadeBeanAddFileTest.java:72)
at com.fitec.a2.test.VFSFacadeBeanAddFileTest.main(VFSFacadeBeanAddFileTest.java:47)
4) testAddFileWithFileObjectNull(com.fitec.a2.test.VFSFacadeBeanAddFileTest)java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/GlobalORBExists
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:385)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:259)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:166)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:98)
at com.ibm.ws.naming.util.WsnInitCtx.<init>(WsnInitCtx.java:79)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:137)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:80)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at javax.naming.InitialContext.init(InitialContext.java:231)
at javax.naming.InitialContext.<init>(InitialContext.java:207)
at com.fitec.a2.test.VFSFacadeBeanAddFileTest.setUp(VFSFacadeBeanAddFileTest.java:72)
at com.fitec.a2.test.VFSFacadeBeanAddFileTest.main(VFSFacadeBeanAddFileTest.java:47)
FAILURES!!!
Tests run: 4, Failures: 0, Errors: 4
Following is my code:::::::::::::::::::::::::::

package com.fitec.a2.test;
import java.rmi.RemoteException;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import junit.framework.Test;
import junit.framework.TestSuite;
import com.fitec.a2.ejb.common.FileObject;
import com.fitec.a2.ejb.vfs.VFSException;
import com.fitec.a2.ejb.vfs.VFSFacade;
import com.fitec.a2.ejb.vfs.VFSFacadeHome;
import com.meterware.servletunit.ServletTestCase;
//import org.apache.cactus.ServletTestCase;
/**
* Test Case implementation class for Enterprise Bean for VFSFacadeBean
*/
public class VFSFacadeBeanAddFileTest extends ServletTestCase {
// Remote Bean
private VFSFacade vfsFacade;

// Defines the testcase name for JUnit.
public VFSFacadeBeanAddFileTest(String theName) {
super(theName);

}
// Starts the tests using the JUnit TestRunner
public static void main(String[] args) {
junit.textui.TestRunner.main(
new String[] { VFSFacadeBeanAddFileTest.class.getName()});
}

// Returns a TestSuite that includes all methods starting with "test"
public static Test suite() {

return new TestSuite(VFSFacadeBeanAddFileTest.class);

}

// Set up the intial context and JNDI namespace and get a Home interface
public void setUp() {
try {
System.out.println(" Start initializing");
String initialContextFactory =
"com.ibm.websphere.naming.WsnInitialContextFactory";
String providerURL = "iiop://localhost:2080";

java.util.Properties props = new java.util.Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
props.put(Context.PROVIDER_URL, providerURL);

javax.naming.Context ctx = new javax.naming.InitialContext(props);

// look up for the VFSFacadeHome
VFSFacadeHome vfshome =
(VFSFacadeHome) PortableRemoteObject.narrow(
ctx.lookup("ejb/VFSFacadeHome"),VFSFacadeHome.class);

// get the remote from home
this.vfsFacade = vfshome.create();

} catch (Exception e) {
e.printStackTrace();
}
}
// JUnit will execute the tests from the bottom up so arranged that way.

public void testAddFileWithFileObjectNull() {
try
{
// create the file object
FileObject fileObject = new FileObject();

//Test : set the fileObject to null
//Output : VFSException(FILE_CREATION_ERROR) should be thrown
fileObject = null;
// call download file with IO
fileObject = vfsFacade.addFile(fileObject);


}catch(RemoteException exception)
{
exception.printStackTrace();
}
catch(VFSException exception)
{
System.out.println(exception.getExceptionMsg(exception.getExceptionCode()));
exception.printStackTrace();
}
catch(Exception exception )
{
exception.printStackTrace();
}
}
public void testAddFileWithBlankFileAbsolutePath() {

try{
// create the file object
FileObject fileObject = new FileObject();
//set file bytes with some data
fileObject.setFileBytes(new byte[]{1,2,3});

//Test : set the absolute blank
//Output : VFSException(FILE_CREATION_ERROR) should be thrown
fileObject.setAbsolutePath("");
// call add file with IO
fileObject = vfsFacade.addFile(fileObject);

}catch(RemoteException exception)
{
exception.printStackTrace();
}
catch(VFSException exception)
{
System.out.println(exception.getExceptionMsg(exception.getExceptionCode()));
exception.printStackTrace();
}
catch(Exception exception )
{
exception.printStackTrace();
}
}
public void testAddFileWithNullFileAbsolutePath() {

try{
// create the file object
FileObject fileObject = new FileObject();
//set file bytes with some data
fileObject.setFileBytes(new byte[]{1,2,3});

//Test : set the absolute path null
//Output : VFSException(FILE_CREATION_ERROR) should be thrown
fileObject.setAbsolutePath(null);
// call add file with IO
fileObject = vfsFacade.addFile(fileObject);

}catch(RemoteException exception)
{
exception.printStackTrace();
}
catch(VFSException exception)
{
System.out.println(exception.getExceptionMsg(exception.getExceptionCode()));
exception.printStackTrace();
}
catch(Exception exception )
{
exception.printStackTrace();
}
}
public void testAddFileWithFileBytesNull() {

try{
// create the file object
FileObject fileObject = new FileObject();

//Test : set the file bytes to null
//Output : VFSException(FILE_CREATION_ERROR) should be thrown
fileObject.setFileBytes(null);

// call add file with IO
fileObject = vfsFacade.addFile(fileObject);

}catch(RemoteException exception)
{
exception.printStackTrace();
}
catch(VFSException exception)
{
System.out.println(exception.getExceptionMsg(exception.getExceptionCode()));
exception.printStackTrace();
}
catch(Exception exception )
{
exception.printStackTrace();
}

}
}
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you would need the client application to be part of the EAR file which holds the beans etc(atleast thats the way i manage to run it). After its part of the EAR file u can use WAS/WASD launchClient.bat to run the client from command line.
The client application will have a descriptor which will have references to all the ejbs that u want to call from the client.
plz check Websphere Studio help for more information
GUL
 
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic