This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I am trying to get the first example (Advice Bean) in the "Headfirst EJB" book up and running. I have created the Java classes as per the book, compiled them and deployed them fine. Does it matter which directory I start the J2EE RI server from? I notice Cloudscape is putting log files in the directory I start the server from yet logs are placed in C:\j2sdkee1.3.1\logs (i.e. centralised). With the server running and the deploytool reporting everything is ok (and all the instructions followed and double checked in the book), I run the test client which accesses the bean and prints out a random string generated by it (its a very simple bean!). The client code is again as per the book. Running the client is producing a FileNotFoundException saying can't find C:\HeadfirstEJB\projects\advice\configs\security.properties. As you probably can guess C:\HeadfirstEJB\projects\advice\ is the working directory for my project and also where deploytool was instructed to store the AdviceApp.ear file and also the generated client jar AdviceAppClient.jar (again as per the book). Needless to say, this directory does not contain configs\security.properties and nor do I think it should. I note that C:\j2sdkee1.3.1 contains a configs\security.properties file and I think the client is looking in the wrong place. I had a hunch it might be something to do with the InitialContext object, but I really don't know - can anyone help me out to get this (simple) example working please? Many thanks Arun
Hello! I was able to get the first Advice bean project to work (I too followed the book exactly), but there was an initial problem. I got a "CORBA BAD_OPERATION" error due to a "headfirst._Advice_Stub.getAdvice(unknown Source)" error. It turns out there is a "bug" in the RI that the Wickedly Smart website alerts us to: http://www.wickedlysmart.com/HeadFirst/HeadFirstEJB/HeadFirstEJBNotes.html So I changed all the referenes/uses of the method in the bean from "getAdvice()" to "getAdviceMessage()" and it now seems to work fine. I started the J2EE server from the c:\projects\advice directory and I do not seem to get the "file not found error"... Here is my ouptut in the command-prompt window:
C:\Projects\advice>j2ee -verbose J2EE server listen port: 1050 Naming service started:1050 Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true <snip> Binding DataSource, name = jdbc/XACloudscape__xa, dataSource = COM.cloudscape.core.RemoteXaDataSource@161581 Starting JMS service... Initialization complete - waiting for client requests Binding: < JMS Destination : jms/Queue , javax.jms.Queue > <snip> Starting web service at port: 8000 Starting secure web service at port: 7000 J2EE SDK/1.3.1 Starting web service at port: 9191 J2EE SDK/1.3.1 J2EE server startup complete. Compiling C:\j2sdkee1.3.1\repository\xplaptop\gnrtrTMP\AdviceApp\headfirst\AdviceBean_RemoteHomeImpl.java .... Compiling C:\j2sdkee1.3.1\repository\xplaptop\gnrtrTMP\AdviceApp\headfirst\AdviceBean_EJBObjectImpl.java .... rmic headfirst.AdviceBean_RemoteHomeImpl... rmic headfirst.AdviceBean_EJBObjectImpl... rmic headfirst.Advice... rmic headfirst.AdviceHome... Application AdviceApp deployed. session context ejb create in getAdviceMessage And then I tried starting the J2EE RI server at the root -- C:\
C:\>j2ee -verbose J2EE server listen port: 1050 Naming service started:1050 Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true <snip> Starting JMS service... Initialization complete - waiting for client requests Binding: < JMS Destination : jms/Queue , javax.jms.Queue > <snip> Starting web service at port: 8000 Starting secure web service at port: 7000 J2EE SDK/1.3.1 Starting web service at port: 9191 J2EE SDK/1.3.1 Loading jar:/C:/j2sdkee1.3.1/repository/xplaptop/applications/AdviceApp1073850255481Server.jar J2EE server startup complete. in session context in ejb create in getAdviceMessage
Here is the output from the client window: C:\Projects\advice>java AdviceClient A bird in the hand... is uncomfortable C:\Projects\advice>java AdviceClient A watched pot... is boring C:\Projects\advice>java AdviceClient Early to bed and early to rise... means you can't watch Letterman
Hi, i know i am replying to an old post, but posting for anyone facing similar issue.
I also faced the issue while running my client Advice application,hence I modified my Client Code to include "INITIAL_CONTEXT_FACTORY" and "PROVIDER_URL". Below is code snippet
Properties p = new Properties();
InitialContext ic = new InitialContext(p);
Object o = ic.lookup("Advisor");