File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes A Quest for all of those who don't use RI for HF EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "A Quest for all of those who don Watch "A Quest for all of those who don New topic
Author

A Quest for all of those who don't use RI for HF EJB

John Liang
Greenhorn

Joined: Sep 17, 2003
Posts: 29
Hello,
I strongly and humbly suggest:
For all those who don't use the RI or in addition to RI, please post detailed solutions on how to deploy all those beans and enterprise applications into differnt Application Servers. So that we could have a contrast among how application servers do their setup and deployment.
Are you up to this challenge?
Hope this works as a community!!
John


=====================================<br />John Liang<br />SCJP2 1.4, SCWCD, SCBCD<br />Working on: WebLogic Architect, IBM Certified Enterprise Developer and Sun Certified Enterprise Architect
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
This is a great suggestion... and I'll throw in a little extra incentive. We will be *so* grateful for anyone posting alternate *detailed* instructions, that we'll add your name to the next printing of the book (these happen every two months or so...) if you post instructions that others are able to follow successfully!
Cheers and thanks!
-Kathy
Rajeev Asthana
Ranch Hand

Joined: Oct 27, 2003
Posts: 43
Originally posted by John Liang:
Hello,
For all those who don't use the RI or in addition to RI, please post detailed solutions on how to deploy all those beans and enterprise applications into differnt Application Servers. So that we could have a contrast among how application servers do their setup and deployment.

Hope this works as a community!!
John

I may use Application Server 7, so if there is some community like this, it'd be great
Ed Tse
Ranch Hand

Joined: Sep 18, 2003
Posts: 183
Which App Server is supported among most platforms? Kathy mentioned JBoss several times in the book, I would love to see the detail to set one up.


SCJP, Pre-SCJD (URLyBird 1.3.1), Teradata Cert'd Prof
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
Maybe a good idea to post the on the [url=http://www.wickedlysmart.com/]Wickedly Smart] site.
John Liang
Greenhorn

Joined: Sep 17, 2003
Posts: 29
Alright, thanks Kathy.
Well, my previous post on the Sun One Application Server 7 for Chapter 1 Advisor Bean is at:
Detailed Instructions of Deploying Chapter 1 of Advisor Bean in Sun ONE Application Server 7
Still I cannot figure out how to use Java-RMI to talk to the EJB yet!!!
Here is the problem:
I have compiled successfully using the EJB-JAR file:
javac -classpath $CLASSPATH:AdviceBean.jar AdviceClient.java
However, when I run it:
java -classpath $CLASSPATH:AdviceBean.jar AdviceClient
It shows:
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:63)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at AdviceClient.go(AdviceClient.java:16)
at AdviceClient.main(AdviceClient.java:9)
According to
FAQ of J2EE SDK 1.3.1
It is because of Red Hat Linux installation. I'll try to change /etc/hosts and see whether it works on not.
Stay tuned,
John
John Liang
Greenhorn

Joined: Sep 17, 2003
Posts: 29
Help!!! Help!!!
The FAQ suggested to change the IP of the server node to something other than 127.0.0.1 in /etc/hosts. Well, I have done that, and the Sun ONE Application Server 7 cannot even start, also httpd (Apache HTTP Server) cannot start either.
In terms of the other way, the DNS way, I don't know what to do with it. I have two books on that:
DNS and BIND 4th Edition and DNS & BIND Cookbook
But I have never successfully setup DNS before. I try to setup DNS for two months before without luck. I ask my system administrator at my full time job, he said, "Good Luck, my friend." Oh no ... ... I don't know what to do this time.
Please guys, help out on DNS ... ...
I am a software architect, not a system administrator!!!
Any help would do it, thanks in advance,
John
Ross Goldberg
Ranch Hand

Joined: Jul 09, 2003
Posts: 63
Well look who's finally crawling out of the woodwork...(me)
I just recently installed Mandrake Linux and plan to try it on both WinXP as well as on Linux with both RI and with JBoss...not sure when I'll get to it, but my goal is over the weekend to get the initial advice beans working for all four scenarios or as many of them as I can get working...will post details here as I accomplish them, but again, I won't likely start on this until Saturday.
Dunno if I can help you, but I'm surely going to try.
Ross
Ross Goldberg
Ranch Hand

Joined: Jul 09, 2003
Posts: 63
Well, before I can try to help others, I think I'm in need of some help myself...
Please click on the following link to see my screenshot:
Uh Oh!!!
It's a 1400 x 1050 desktop, so you'll need to scroll a bit to see it all, probably.
I created all the code for the three pieces of the AdviceBean, went through all the steps through deployment and that went without a hitch. I double-checked to ensure I set the interfaces correctly (see uhoh2 below):
Uh Oh 2
The code is as appears in the book for each of the three classes as well as for the AdviceClient and compiles without a hitch. I tried running it two different ways...one was where I created my source for the client in /projects/advice/src (with the class in /projects/advice/classes) and the other was with the AdviceClient.class copied to /projects/advice in case it was a classpath issue.
In the version I ran via IDEA, I included the AdviceClientJar in the classpath and started execution at main inside of AdviceClient. I receive the following error:

In the second case, where I ensured I had AdviceBean in the same spot as the jar, I issued the command
java -cp {$CLASSPATH}:AdviceAppClient.jar AdviceClient
My %classpath% var contains:
C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar;.
The only error feedback I get there is:
Exception in thread "main" java.lang.NoClassDefFoundError: AdviceClient

Here is my AdviceClient.java code:

Would appreciate any insight...this went smooth as silk until this final step where I went to remove the results.
Ross
Magnus Stattin
Ranch Hand

Joined: Jun 05, 2003
Posts: 65
In the first case you can try to change the method getAdvice to something like getMessage. There is some issues with the Sun RI that make it fail when the method has a name that is same as the name of the bean (Advice, getAdvice()).
In the second case include the path to client to the classpath and I think is should work better.
Best Regards
/Magnus
Vladas Razas
Ranch Hand

Joined: Dec 02, 2003
Posts: 385
Huh, what's wrong with RI ? To those who has just started deploying your first Advice bean, I can tell already.. there is no other fully functional example in the book and no more deploying excercises. I don't say it's bad - the book has all code you need. But I wouldn't worry so much about RI - it's one time quest, for one bean only.
Ross Goldberg
Ranch Hand

Joined: Jul 09, 2003
Posts: 63
I'll try the suggested rename and see if that resolves it...or the classpath being more explicit. It's odd since it basically seems as though it is a path issue given that it deployed fine, etc.
Ross
Ad van Ommen
Greenhorn

Joined: Nov 28, 2003
Posts: 1
Weblogic 8.1 instead of RI is quite straightforward.
My experience so far can be summarized as follows
  • Installing and configuration of a domain is fully standard.
  • Deployment using Weblogic Builder on the directory with the EJB classes
  • The client needs some extra lines for the JNDI to succeed.


  • New findings will be posted as I proceed in HF EJB.
    Ad
    [ December 14, 2003: Message edited by: Ad van Ommen ]
    Magnus Stattin
    Ranch Hand

    Joined: Jun 05, 2003
    Posts: 65
    My experience of Weblogic is the same as Ad van Ommen's. It is really easy to work with and I think it is nice to work with a server that may be used in real life.
    It uses a compiler tool called appc to make the make the stubs and other classes. If something is wrong with your bean classes it will give you very detailed information on what is missing or incorrect.
    I made a guide for how to deploy AdviceBean in weblogic 8.1 some time ago. It can be found here if someone is intrested.
    Best Regards
    /Magnus
    Asher Tarnopolski
    Ranch Hand

    Joined: Jul 28, 2001
    Posts: 260
    ross, your problem is a result of the ri bug .
    read this thread:
    http://www.coderanch.com/t/158262/java-EJB-SCBCD/certification/CORBA-bad-operation-error-RI


    Asher Tarnopolski
    SCJP,SCWCD
    Ross Goldberg
    Ranch Hand

    Joined: Jul 09, 2003
    Posts: 63
    Many thanks, Asher and others!!! I didn't realize Kathy had that post up there, so that is very helpful.
    BTW, does anyone know if there is a thread on JBoss configuration as well? Especially WITHOUT using a GUI, since I want to learn how to do it on Linux (both on my machine and on a "commercial" website)? These will lead to the steps I ultimately hope to post for John and others, because I think it will benefit all of us, but I'm running into a lot of learning curve right now and could definitely use some pointers or a turn in the right direction.
    Thx,
    Ross
    Ross Goldberg
    Ranch Hand

    Joined: Jul 09, 2003
    Posts: 63
    Woohoo! Asher (for the link) and Dan are the champs!!!
    My problem, as I posted above, was the CORBA NO_PERMISSION issue (and not the first issue that was referenced).
    The ONLY CHANGE I had to make were the ones per Dan's instructions in the deploytool....that is, I clicked on the security tab for the Advice/Advisor EJB. I then chose Deployment Settings...then selected Support Client Choice. I then redeployed (Tools -> Update and Redeploy) and was able to readily run my program without any recompilation of the client nor any changes to the java source code for the bean and its two interfaces.
    Now, I do have a question about using the RI and/or JBoss...first, I'm trying to figure out how to use JBoss (I believe 3.2.2) on Windows, but I'm also trying to figure out how to use both the RI and JBoss on Linux WITHOUT a GUI since when deploying to a web site (for testing and fun), I won't have a GUI available (or so I presume). I do on the local linux install, but not for the remote-hosted website.
    Would appreciate any pointers.
    Thx,
    Ross
    Barry Gaunt
    Ranch Hand

    Joined: Aug 03, 2002
    Posts: 7729
    For JBoss 3.2.3 see here.


    Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
    Getting someone to think and try something out is much more useful than just telling them the answer.
    Ross Goldberg
    Ranch Hand

    Joined: Jul 09, 2003
    Posts: 63
    One more...
    While I'm having NO PROBLEM at all running the advice client from an IDE (IDEA), I am not able to run it from the command line and am getting virtually no error information to help me diagnose....this is still under the RI (which was updated with the change to make it work, and which works fine under IDEA, which has the AdviceAppClient.jar in its classpath.
    For the dos version, I copied the AdviceClient.class to the /projects/advice directory to ensure it is in the same directory. If you look at my listing above, you can confirm that AdviceClient.java (which was created in /projects/advice/src and compiled into /projects/advice/classes is not in a package. So I copied AdviceClient.class to /projects/advice to put it in the same directory as the deployed jar (or rather as the client jar for the deployed bean).
    Following are what I tried and the tiny amount of feedback I'm getting back...while I am using J2SDK1.4.2_02 (yes, should be 1.3) and J2SDKEE1.3, I am using the exact same set under the IDE which as I mentioned works fine.
    I'm not sure if the package name should be preceded by a : as shown in the book on pg. 58 or if that should be a semicolon....anyone know for certain??? I tried both, but get the same error....see below, plz. I'm getting really close, but want to ensure I fully understand it and that I have it working for all cases...then I can work on the JBoss cases for Windows, then Linux locally, then Linux remotely.
    Thanks,
    Ross
    Vladas Razas
    Ranch Hand

    Joined: Dec 02, 2003
    Posts: 385
    I am one of the poor people who have only 440 mb of RAM. WebLogic kills my PC. WebSphere runs little more better but still all I see is swapping. Tomcat is pretty fast! Of course it does not provide all those nifty features.
    Ross Goldberg
    Ranch Hand

    Joined: Jul 09, 2003
    Posts: 63
    In my example above which works from within the IDE, but not from DOS, I'm simply using RI.
    Ross
    Magnus Stattin
    Ranch Hand

    Joined: Jun 05, 2003
    Posts: 65
    Hello Ross
    You are indeed very close ;-). What I think you have to do is to include the path to the AdviseClient.class like this:
    java -cp {$CLASSPATH};AdviceAppClient.jar;D:\projects\advice AdviceClient
    or you can use a simple . for the current working directory like this:
    java -cp {$CLASSPATH};AdviceAppClient.jar;. AdviceClient
    Semicolon is used on windows and colon is used on Linux.
    Hope it helps
    /Magnus
    Asher Tarnopolski
    Ranch Hand

    Joined: Jul 28, 2001
    Posts: 260
    Barry - nice jboss deployment tutorials. you did it much better than i would, so i won't even try
    Listen folks, i have a question (and according to kathy, there are no dumb questions ):
    at least in the fisrt Advice example (and i still didn't make it to the next one) the implementations of the SessionBean interface methods in the Enterprise Bean itself do not throw javax.ejb.EJBException , which should be done according to api...
    You've guessed right, my question is Y?
    [ December 15, 2003: Message edited by: Asher Tarnopolski ]
    Magnus Stattin
    Ranch Hand

    Joined: Jun 05, 2003
    Posts: 65
    The EJBException is a runtime exception, so you don't have to declare it. If a runtime exception would occur in the method it would be sent back to a local client as a EJBException and to a remote client as a checked Remote exception. You can declare it just to make things clearer but the result would be the same and the compiler will not care.
    Best Regards
    /Magnus
    [ December 15, 2003: Message edited by: Magnus Stattin ]
    Ross Goldberg
    Ranch Hand

    Joined: Jul 09, 2003
    Posts: 63
    Magnus,
    My first question was "duh! Of course!" That made perfect sense...although I would have expected the classpath pointing to the jar to include that current directory, I have rationalized/figured out why it doesn't/wouldn't.
    However, when I put in either of the two examples you typed, I ended up getting a different error much to my surprise, that relates to the classloader. I've been trying various things, but from DOS, nothing has yet to work despite the ease by which it worked from the UI...perhaps I'm forgetting another item in the classpath that I'm not realizing?? Would I need to include the J2EE.jar in the classpath? Nope...that wasn't it either. Here are the failed attempts:


    I know I'm realllllllly close, especially since it works fine in the GUI, but like I said, I want to ensure I know how to do it from the command line as well.
    Plz help.
    Ross
    Magnus Stattin
    Ranch Hand

    Joined: Jun 05, 2003
    Posts: 65
    Hello Ross
    I can understand your frustration, being so close. I'm unable to reproduce the error you get. I have seen issues this classloading errors, but that was when I put the client in a package, not when the client is located in the root directory.
    I let you know if I come up with anything. Good Luck. Try not to get stuck on this, its the only time you will want to do it from the command line like this.
    /Best Regards Magnus
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: A Quest for all of those who don't use RI for HF EJB