The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

shivkpr (30) [Avatar] Offline
#1
Hi,
I've managed to get a trial version of Jbuilder enterprise 2005 but when I open your project - ejb-sched
I get a compile errror on schedule bean.

cannot access create exception

I've got other questions but I was hoping to solve this issue first as If i get the application running then it amy be self explanatory
nford (36) [Avatar] Offline
#2
Re: Using EJBs
You are correct, I'm not getting notifications for new messages for some reason. I'll check with the admin on this.

The error you are getting is probably because you don't have an application server configured yet. This project uses JBoss 3.x. If you go to Enterprise | Configure Servers... and set up JBoss, this error should go away.

Of course, you will have to download and install JBoss first.
shivkpr (30) [Avatar] Offline
#3
Re: Using EJBs
hi i've been to jboss and installled jboss4.0
when i open my project in jbuilder and configure server.
jboss 3 is still greyed out
do i need some paths etc
nford (36) [Avatar] Offline
#4
Re: Using EJBs
You have to go to Enterprise | Server setup, enable the server (setting all the appropriate paths), and then go to project properties and select JBoss.

The sample was created with JBoss 3, I haven't tried it in version 4 yet.
shivkpr (30) [Avatar] Offline
#5
Re: Using EJBs
i'm not sure where to install v3 but i've added some more paths and now getting the following errors

no depploy service or ejb serviceavail for ejb-sched1 ejb module
same for ejb-sched2

no deploy service availab for ejb-shed2 application module
shivkpr (30) [Avatar] Offline
#6
Re: Using EJBs
also i' cannot find a .jmcl file. would it be in the
jboss area or under the new project

the exact areas i'm getting are
"ejb-sched.jar": No deploy service or EJB service available for ejb-sched1 EJB module.
"ejb-sched2.jar": No deploy service or EJB service available for ejb-sched3 EJB module.
"ejb-sched4.jar": No deploy service or EJB service available for ejb-sched5 EJB module.
"ejb-sched1.ear": No deploy service available for ejb-sched2 Application module.
"ejb-sched3.ear": No deploy service available for ejb-sched4 Application module.
"ejb-sched5.ear": No deploy service available for ejb-sched6 Application module.

i do apreciate this help
nford (36) [Avatar] Offline
#7
Re: Using EJBs
Sorry, I'm not savvy enough about JBoss to be able to remotely debug your installation issues. You are having class-loader problems, but I have no idea what is causing them.
shivkpr (30) [Avatar] Offline
#8
Re: Using EJBs
sorry what does class laoder problems mean
what does it mean when say no deploy service or ejb service avail

do i need to add extra jars from your zip file

its bit dissapointing i cant that the application working.are they any other ways

without the jmcl file i cant
ive setup oracle drivers and sqlj
shivkpr (30) [Avatar] Offline
#9
Re: Using EJBs
is it anyway related to me having tostart up jboss first or would jbuilder handle this for me
nford (36) [Avatar] Offline
#10
Re: Using EJBs
This topic is really beyond the scope of my book. The EJB example there was designed to show that you can change the boundary classes to use EJB's with minimal side effects on the rest of the application.

There are numerous good books on the market covering EJB development (like Monson-Hafel's EJB book) that covers this topic. And, there are JBoss specific books out as well.

Don't get caught up in the necessity to run this sample, getting bogged down in the details of getting an application server running, and miss the point of the sample. Using application servers is a very complex topic all to itself.
shivkpr (30) [Avatar] Offline
#11
Re: Using EJBs
Its just I'd like to have the application you done up and running to find out some of my queries.

Please see below some of them

My understanding is that Viewschedule servlet gets called first. As not with the
post option, do get gets called and then it calls dopost

default seems to be get opposed to post ?

My understanding is that context is required to handle the calling to the ejbs
and also if 10 uers then 10 contexts each handling locks and commits ?

- Issue when event added via the create ejb why another context created
-why new context container for eventtypes

can one context not handle a session


on the add of the item why not passed the instance scheduleitem to the
ejb opposed to single items passed ,getStart etc

Diff between statless and stateful. all the ejbs seems stateless
entity beans stateful ?.

How effective are ejbs compared to keeping all the DML on the database
server that taks care of insert/update/delete
nford (36) [Avatar] Offline
#12
Re: Using EJBs
<-----
My understanding is that Viewschedule servlet gets called first. As not with the
post option, do get gets called and then it calls dopost
------>

In this particluar case, the doGet() is always the one called. It is a (bad) habit that many J2EE developers get into to always implement both doGet() and doPost(), and have one call the other. In this case, doPost() is never called, and should be removed.


<-----
My understanding is that context is required to handle the calling to the ejbs
and also if 10 uers then 10 contexts each handling locks and commits ?
------>

Yes, you can think of the context as being like a connection to the database. Each user has their own context. In the application, I created a new context for each user and stored it in the session. You can write it either way -- it takes a little more time to re-create the context each time, but it takes less memory (because you aren't storing the context in the session) vs. storing it for each user. I chose to store it for each user.

The context is used anytime you need to get a resource from the EJB server. So, in the EventDbBean, I was required to get a database connection from the connection pool kept in JNDI. To talk to JNDI, you need a context object, which I create. This one isn't tied to a particular user, it is used to get the resource from the application server. I could pass the user's context into the bean, but I chose not to.

<-----
on the add of the item why not passed the instance scheduleitem to the
ejb opposed to single items passed ,getStart etc
------>

For Entity EJB's, the way that you add a new record is to call the Home's create() method, which takes individual fields. I could have created another method on the Home class that took a single ScheduleItem, but the parameter list was so short I decided not to.


-------->
Diff between statless and stateful. all the ejbs seems stateless
entity beans stateful ?.
<---------

There are stateful and stateless session beans (I only used stateless session beans in this project). All entity beans are automatically stateful.


--------->
How effective are ejbs compared to keeping all the DML on the database
server that taks care of insert/update/delete
<---------

It depends entirely on the application you are writing. If you need declaritive transactions, security in the application server, scalability, or database independnce, you should use EJBs. They are one of many different object-relational mapping technologies (others are JDO and Hibernate).