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 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 AdviceClient.main(AdviceClient.java:16)
This is a know issue. The hint is that the component interface business method should be renamed into something else. It's just enought to look at other posts or to make a search in this forum to find the solution. This is what I did anyway.
Think the better way to solve a problem is by yourself ! hehehehe
Ok, found the problem. Listen carefully, like I said, not much info on the others threads about that.
Main reason : Version J2EE 1.4 is significatively different in deployment with J2EE 1.3.
You have to build an client application with the deploy tool and do a EJB ref to the Entreprise Bean.
NO INITIAL CONTEXT IS NECESSARY (sorry for capitals, it is important)
The code in the HeadFirst EJB book is GOOD but, like it says in ERRATA, don't use the name "getAdvice()" for the method but something different as "getMessage()" (There's a conflict between the Home Interface Name and something I don't remember. For more info, consult this web site, I found the explanation here).
I strongly suggest that you follow the J2EE Tutorial for deploying the Client Application (very easy), the part before is identical to the book.