[jboss-user] [Installation, Configuration & DEPLOYMENT] - running EJB pplication in jboss giving NoClassDefFoundError
Shiveeta
do-not-reply at jboss.com
Fri Apr 25 02:24:18 EDT 2008
Hi,
I am a new user of jboss. I tried deploying a sample EJB apllication by following the tutorial at :- http://www.huihoo.org/jboss/online_manual/2.4/ch01s15.html . I was able to deploy the application in jboss <4.2.2GA> . but on calling EJB via a simple client, I face the following exception :-
interest-client:
[java] hi
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss
/logging/Logger
[java] at org.jnp.interfaces.NamingContext.(NamingContext.java:
143)
[java] at org.jnp.interfaces.NamingContextFactory.getInitialContext(Nam
ingContextFactory.java:41)
[java] at javax.naming.spi.NamingManager.getInitialContext(NamingManage
r.java:667)
[java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.
java:247)
[java] at javax.naming.InitialContext.init(InitialContext.java:223)
[java] at javax.naming.InitialContext.(InitialContext.java:175)
[java] at org.jboss.docs.interest.InterestClient.main(InterestClient.ja
va:30)
[java] Java Result: 1
I tried googling and my classpath has jbossall-client.jar in it. However still facing this problem.
The client code is :-
package org.jboss.docs.interest;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import org.jboss.docs.interest.Interest;
import org.jboss.docs.interest.InterestHome;
/** This simple application tests the 'Interest' Enterprise JavaBean which is
implemented in the package 'org.jboss.docs.interest'. For this to work, the
Bean must be deployed on an EJB server.
*/
class InterestClient
{
/** This method does all the work. It creates an instance of the Interest EJB on
the EJB server, and calls its `calculateCompoundInterest()' method, then prints
the result of the calculation.
*/
public static void main(String[] args)
{
System.out.println("hi");
// Enclosing the whole process in a single `try' block is not an ideal way
// to do exception handling, but I don't want to clutter the program up
// with catch blocks
InitialContext jndiContext=null;
try
{
// Get a naming context
jndiContext = new InitialContext();
System.out.println("Got context");
}
catch(Exception e)
{
System.out.println("I am here!!");
e.printStackTrace();
}
try
{
// Get a reference to the Interest Bean
Object ref = jndiContext.lookup("interest/Interest");
System.out.println("Got reference");
// Get a reference from this to the Bean's Home interface
InterestHome home = (InterestHome)
PortableRemoteObject.narrow(ref, InterestHome.class);
// Create an Interest object from the Home interface
Interest interest = home.create();
// call the calculateCompoundInterest() method to do the calculation
System.out.println("Interest on 1000 units, at 10% per period, compounded over 2 periods is:");
System.out.println(interest.calculateCompoundInterest(1000, 0.10, 2));
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}
Please guide in this ...Any help would be apprecitated. Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146712#4146712
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146712
More information about the jboss-user
mailing list