To EJB ot Not?

Hello,
We are getting started on a J2EE project which is quite similar to the
other J2EE projects prople have been doing ..a typical supply-chain
type.
We are trying to decide if we should go ahead with an Entity EJB or a
JDO.
The last I ever worked on Entity EJB was 2-3 years ago when the Entity
EJB technology was really immature (we did'nt have EJB relationships
then)
I was wondering if some one could state a practical and a honest
experince of using Entity EJBs in terms of production
stability/performance/transaction and so on.
Much appreciated,
N Rao

You shouldn't concern yourself with a right or wrong approach and
adhering to theory spewed from some book written by someone that's
never designed AND implemented a system. Rather seek the
technologically optimal solution. Application boundaries (or tiers)
exist, but they are flexible to a small degree in order to allow for
an optimal solution. Somewhere between a strictly designed system and
a system that hasn't been designed at all lies a well-designed and
well-implemented system that runs optimally. Having said all that...
I'm currently working on a JDO project. Unfortunately, I arrived too
late in the game to have any influence or input into the design
process and while it's working, I feel the solution isn't optimal for
a few reasons, but most importantly because there are
enterprise-shareable business objects in the application that cannot
be shared easily given the current architecture. Is that the JDO's
problem? Not at all. The problem is that someone has a hard-on for JDO
rather than a vision for an optimal solution for the customer that, at
least initially, takes into account all possible solutions.
I would not hesitate to use EJBs or 2.0 Entity EJBs. A couple of years
ago this technology was a virgin as opposed to what it is now - a real
slut. It's been around the block a few times and, unlike human sluts,
has benefited extremely well from its promiscuity. However, just
because you're using Entity EJBs doesn't mean all your data should be
modeled as such. As usual, you must temper theory with practical
reasoning. I still only use Entity EJBs primarily to model
transactional business data to which multiple clients need
simultaneous access. For instance, inventory data is an ideal
candidate as it meets the criteria - transactional business data to
which multiple clients require simultaneous access. There are other
uses of entity beans and read-only entity beans, but I've said too
much already. Time to post.
Jason

Similar Messages

  • EJB is not throwing exception to calling Action class in Unix environment

    Hi
    We are using Weblogic Server 9.2.3.0.
    One of our EJB is not throwing exception to calling Action class in Unix environment. Its working fine in Windows.
    Somehow the EJB is swallowing the exception.
    any idea? I suspect it may be environmental issue?
    thank you

    Hi
    We are using Weblogic Server 9.2.3.0.
    One of our EJB is not throwing exception to calling Action class in Unix environment. Its working fine in Windows.
    Somehow the EJB is swallowing the exception.
    any idea? I suspect it may be environmental issue?
    thank you

  • POJO in the EJB module : To EJB or Not

    Hi All,
    We are preparing the architecture of a new system in J2EE. As usual we have come across the question "To Use EJB or NOT". And we have decided to use EJB when there are transactions involved. ie., If the are multiple updates or inserts involved in a single call. Otherwise - for simple 'selects' just use POJO business service to avoid EJB overhead. These simple classes are placed in same module where EJB is placed. With the module reference delegate will directly create instance of POJO and get the Value Objects.
    Is this approach acceptable? Second question is can I use �Local EJB� invocation when I am sure that I am NOT going to distribute my application components?
    Please help.

    You mention 3 times that you are a "creative person" in a way that seems to indicate you think programming (or perhaps more properly: software engineering) isn't a creative activity.
    Now, I'm sure there are many types of programming that are repetitive, boring and not creative at all, but in my experience, implementing a new concept is a highly creative and intellectually stimulating activity, especially if you have a big influence on the final architecture and design of the system (i.e. it's not "programming to spec").
    As an aside: I'm sure your idea is very innovative and new, but if you haven't been able to get anyone (including yourself) to create even the start of an actual working version in 10 years, it doesn't speak well of your ability to enthuse people and actually get something done. The dot-com fiasco has shown the industry the dangers of "great ideas" without anything to back it up.

  • Calling a newly deployed EJB from an EJB gives a NoSuchMethod Exception if the jar of the newly deployed ejb is not in the classpath

    Hi ,
    I have an EJB A which is already deployed when the server starts. A second ejb
    B is deployed at a later time.
    EJB A calls methods in EJB B. I use reflection in EJB A to call methods in EJB
    B.
    I get a NoSuchMethodException when I call the create method in the Home object
    of EJB B. If I add the ejb jar file to the classpath before the server starts
    then it is able to resolve the method.
    The problem is the EJBs which are called from EJB A is not known before the server
    is started. New EJBs can be deployed at runtime and EJB A should be able call
    the methods in newly deployed EJB's.
    I also use the URLClassLoader to load all the classes in the jar file of the newly
    deployed EJB in EJB A and it still gives a NoSuchMethodException because it cannot
    resolve the stub class.
    My error log is shown below.
    This is an urgent issue.
    Thanks
    SampleConnector::testEJBService called
    In Key : P1 Value : Input2
    In Key : P3 Value : Input1
    In Key : P2 Value : SomeConst
    Loaded Class = com.bizwave.samples.rejb.SampleRemote
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_EOImpl
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_HomeImpl
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_Impl
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteHome
    java.lang.NoSuchMethodException
    at java.lang.Class.getMethod0(Native Method)
    at java.lang.Class.getDeclaredMethod(Class.java:1151)
    at com.bizwave.samples.ejb.SampleConnectorEJB.testEJBService(SampleCon
    ctorEJB.java:181)
    at com.bizwave.samples.ejb.SampleConnectorEJB_be5y1v_EOImpl.testEJBSer
    ce(SampleConnectorEJB_be5y1v_EOImpl.java:98)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.bizwave.fc.utils.ClassUtils.invokeEJBMethod(ClassUtils.java:109
    at com.bizwave.infra.fjet.engine.EJBServiceStepMgr.executeService(EJBS
    viceStepMgr.java:91)

    Hi,
    I am attaching a test case. This test case actually demonstrates a security bug.
    Unzip the file and modify the StartWeblogic.cmd in domainA to not refer to the
    SampleRemoteEJB.jar in the classpath. If u run the test client under the client
    dir u will see a NoSuchMethodException.
    The reason is it is not able to load the dynamically generated stub file.
    Initially I had the getMethod and it didn't work. You might have to modify the
    files to suit ur env. The easier way is to run th edomain wizard and create 2
    domains. Run the servers in development mode and place the jars under the applications
    dir
    Thanks
    Rajesh Mirchandani <[email protected]> wrote:
    Do you have any old EJB classes in your classpath? Did you recompile
    your EJBs if you
    upgraded from a old release or a Service pack?
    Bob Lee wrote:
    Hmmmm. That's an interesting problem.
    Why is it giving you a NoSuchMethodException instead of a
    ClassNotFoundException?
    Can you post the code from SampleConctorEJB.java, line 181?
    Try changing your call to getDeclaredMethod() to getMethod().
    getDeclaredMethod() searches only the class you called it on, whereas
    getMethod() traverses to the superclasses and interfaces. You onlyneed
    getDeclaredMethod() when you're accessing a nonpublic method.
    Not sure if this will help, but it's worth a shot.
    Bob
    Vasu wrote:
    Hi ,
    I have an EJB A which is already deployed when the server starts.
    A second ejb
    B is deployed at a later time.
    EJB A calls methods in EJB B. I use reflection in EJB A to call methodsin EJB
    B.
    I get a NoSuchMethodException when I call the create method in theHome object
    of EJB B. If I add the ejb jar file to the classpath before the serverstarts
    then it is able to resolve the method.
    The problem is the EJBs which are called from EJB A is not knownbefore the server
    is started. New EJBs can be deployed at runtime and EJB A shouldbe able call
    the methods in newly deployed EJB's.
    I also use the URLClassLoader to load all the classes in the jarfile of the newly
    deployed EJB in EJB A and it still gives a NoSuchMethodExceptionbecause it cannot
    resolve the stub class.
    My error log is shown below.
    This is an urgent issue.
    Thanks
    SampleConnector::testEJBService called
    In Key : P1 Value : Input2
    In Key : P3 Value : Input1
    In Key : P2 Value : SomeConst
    Loaded Class = com.bizwave.samples.rejb.SampleRemote
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_EOImpl
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_HomeImpl
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_Impl
    Loaded Class = com.bizwave.samples.rejb.SampleRemoteHome
    java.lang.NoSuchMethodException
    at java.lang.Class.getMethod0(Native Method)
    at java.lang.Class.getDeclaredMethod(Class.java:1151)
    at com.bizwave.samples.ejb.SampleConnectorEJB.testEJBService(SampleCon
    ctorEJB.java:181)
    at com.bizwave.samples.ejb.SampleConnectorEJB_be5y1v_EOImpl.testEJBSer
    ce(SampleConnectorEJB_be5y1v_EOImpl.java:98)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.bizwave.fc.utils.ClassUtils.invokeEJBMethod(ClassUtils.java:109
    at com.bizwave.infra.fjet.engine.EJBServiceStepMgr.executeService(EJBS
    viceStepMgr.java:91)
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support
    [user_projects.zip]

  • Med Rec medrec tutorial 10 deployments-- EJB Modules EJB is not shown

    This note adds missing steps in the Med Rec (medrec) Tutorial 10
    The tutorial shows how to use EJBGEN to generate EJB classes (incl java source) from .ejb files.
    Unfortunately it is missing a few key details. These are described below.
    Many thanks to Chris Wall for supplying the answers and hints.
    Q: The tutorial includes deploying the manually generated physSessionEjb’s. After doing the step that generates the PhysSession*.java files, onefinds that when trying to deploy that there are no class files – nothing has been built. Are the class files supposed to be generated by the ejbgen step?
    [Chris] No, EJBGen just generates the local and remote interfaces and descriptors only. An additional step should be added to explain how to build the newly generated EJBs. I believe you are correct in calling “src/physicianEar$ ant –f build.xml build”.
    Q: Manually built the class files using ‘ant –f build.xml build’ in the physicianEar src dir – but that failed in the acc.split.dir step with class not found /org/apache/struts/action/ActionForm.
    Obviously did not get the struts jars on the classpath. But as much of the build as completed did include creating the class files.
    [Chris] Yes, it looks like struts.jar is not in the classpath. Is this the “build.split.dir” or “appc.split.dir” target? In either case, wlcompile and wlappc should recognized all libs in "${app-inf.dest.lib}" and append them to the compile/appc classpath automatically. The libs should have been copied during the “prepare” target. Can you make sure that struts.jar exists in c:/medrec_tutorial/build/physicianEar/APP-INF/lib? If not, re-run the target with verbose: “src/physicianEar$ ant -verbose -f build.xml build”, and make sure that the libs are copied in the “prepare” target.
    Q: When doing the deploy step, we get no errors but on the console window and do not see the tutorial_deployment item under DeploymentsàEJB Modules. There is something under Deployments-->Applications --> tutorial_deployment. It appears the deploy failed since there’s nothing under Deployments --> EJB Modules, and what is there is ‘left over’ from deploying the jar (the ear?) that contains the stuff deployed by the deploy step at the start of tutorial 10.
    [Chris] Once the build is successful, you must deploy the EAR. This is done by executing : “src/physicianEar$ ant -f build.xml redeploy.physician.ear”. Again, a step that was left out. Yes, you should be looking at Deployments--> Applications--> tutorial_deployment. So, to summarize: generated the local and remote and descriptors for the EJB, compile the EJB and package the EAR, deploy the EAR, and then view the deployment in the console.

    This note adds missing steps in the Med Rec (medrec) Tutorial 10
    The tutorial shows how to use EJBGEN to generate EJB classes (incl java source) from .ejb files.
    Unfortunately it is missing a few key details. These are described below.
    Many thanks to Chris Wall for supplying the answers and hints.
    Q: The tutorial includes deploying the manually generated physSessionEjb’s. After doing the step that generates the PhysSession*.java files, onefinds that when trying to deploy that there are no class files – nothing has been built. Are the class files supposed to be generated by the ejbgen step?
    [Chris] No, EJBGen just generates the local and remote interfaces and descriptors only. An additional step should be added to explain how to build the newly generated EJBs. I believe you are correct in calling “src/physicianEar$ ant –f build.xml build”.
    Q: Manually built the class files using ‘ant –f build.xml build’ in the physicianEar src dir – but that failed in the acc.split.dir step with class not found /org/apache/struts/action/ActionForm.
    Obviously did not get the struts jars on the classpath. But as much of the build as completed did include creating the class files.
    [Chris] Yes, it looks like struts.jar is not in the classpath. Is this the “build.split.dir” or “appc.split.dir” target? In either case, wlcompile and wlappc should recognized all libs in "${app-inf.dest.lib}" and append them to the compile/appc classpath automatically. The libs should have been copied during the “prepare” target. Can you make sure that struts.jar exists in c:/medrec_tutorial/build/physicianEar/APP-INF/lib? If not, re-run the target with verbose: “src/physicianEar$ ant -verbose -f build.xml build”, and make sure that the libs are copied in the “prepare” target.
    Q: When doing the deploy step, we get no errors but on the console window and do not see the tutorial_deployment item under DeploymentsàEJB Modules. There is something under Deployments-->Applications --> tutorial_deployment. It appears the deploy failed since there’s nothing under Deployments --> EJB Modules, and what is there is ‘left over’ from deploying the jar (the ear?) that contains the stuff deployed by the deploy step at the start of tutorial 10.
    [Chris] Once the build is successful, you must deploy the EAR. This is done by executing : “src/physicianEar$ ant -f build.xml redeploy.physician.ear”. Again, a step that was left out. Yes, you should be looking at Deployments--> Applications--> tutorial_deployment. So, to summarize: generated the local and remote and descriptors for the EJB, compile the EJB and package the EAR, deploy the EAR, and then view the deployment in the console.

  • Ejb-link not working when i access ejb in different ear

    Hi All
    I am here trying to access ejb's which is in different ear, I am providing ejb-link inside web.xml of war file deployed inside deffirent ear file.
    I am using wls8.1sp5. I tried different combination with elb-link name , but its not working . <ejb-ref>
    <ejb-ref-name>ejb/AuditService</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.onstar.audit.ejb.AuditServiceHome</home>
    <remote>com.onstar.audit.ejb.AuditService</remote>
    <ejb-link>ccarenewal.jar#AuditService</ejb-link>
    </ejb-ref>
    <ejb-ref>
         <ejb-ref-name>ejb/AccountService</ejb-ref-name>
         <ejb-ref-type>Session</ejb-ref-type>
         <home>com.onstar.account.ejb.AccountServiceHome</home>
         <remote>com.onstar.account.ejb.AccountService</remote>
         <ejb-link>ccarenewal.jar#AccountService</ejb-link>
         </ejb-ref>
    Exception:weblogic.management.ApplicationException: activate failed for sbwo Module: sbwo Error: weblogic.management.DeploymentException: Could not setup environment - with nested exception: [weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ccarenewal.jar#AuditService' declared in the ejb-ref or ejb-local-ref 'ejb/AuditService' in the application module 'accountadj.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.] weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ccarenewal.jar#AuditService' declared in the ejb-ref or ejb-local-ref 'ejb/AuditService' in the application module 'accountadj.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct. at weblogic.deployment.EnvironmentBuilder.addEJBLinkRef(EnvironmentBuilder.java:658) at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:467) at weblogic.servlet.internal.CompEnv.init(CompEnv.java:123) at weblogic.servlet.internal.WebAppServletContext.activate
    I will appreciate any help.
    Rajiv

    Rob,
    Thanks for your reply.
    Below is all deployment descriptor entries i have(ejb-jar.xml, weblogic-ejb-jar.xml, web.xml, weblogic.xml)
    please correct me if i have wrong entries any where.
    ejb-jar.xml
    ejb-ref>
    <description />
    <ejb-ref-name>ejb/AccountService</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.onstar.account.ejb.AccountServiceHome</home>
    <remote>com.onstar.account.ejb.AccountService</remote>
    <ejb-link>AccountService</ejb-link>
    </ejb-ref>
    weblogic-ejb-jar.xml
    <ejb-reference-description>
    <ejb-ref-name>ejb/AccountService</ejb-ref-name>
    <jndi-name>cca/AccountService</jndi-name>
    </ejb-reference-description>
    web.xml
    <ejb-ref>
    <ejb-ref-name>ejb/AccountService</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.onstar.account.ejb.AccountServiceHome</home>
    <remote>com.onstar.account.ejb.AccountService</remote>
    <ejb-link>ccarenewal.jar#AccountService</ejb-link>
    </ejb-ref>
    weblogic.xml
    <ejb-reference-description>
    <ejb-ref-name>ejb/AccountService</ejb-ref-name>
    <jndi-name>cca/AccountService</jndi-name>
    </ejb-reference-description>
    I appreciate your help.
    Thanks
    Rajiv

  • Re: EJB Control not working with methods that contain arguments

    John,
    I'm not qualified to answer your EJB control question, but before you
    become too disillusioned with page flows I'd like to mention that the
    request scoped data form and and the return-to="page" issues you
    mentioned have been addressed for the next service pack. We've
    introduced the ability to specify a page flow scoped form bean which
    lives for the life of the page flow, and we've clarified the return-to
    values to include both "currentPage" and "previousPage" which should
    clarify the expected behavior.
    I hope you give it a try.
    Thomas
    John Hundley wrote:
    Oh well guess you guys gave up on this one. Thats ok, I have utilized a workaround
    that forgoes your non working controls just like I have workarounds for your dataforms
    that do not maintain their data between pages, your retrun to page that does not
    work etc.... At this rate I should have just used struts and JBoss.
    "John Hundley" <[email protected]> wrote:
    oop's attached the wrong one here is the right one.
    "John Hundley" <[email protected]> wrote:
    Ok I have attached one of my beans.
    "Anurag" <[email protected]> wrote:
    John,
    For a stateless session bean, the ejbCreate() method is called for
    every
    individual method call. This is because the bean instance is returned
    to the
    pool after every method call, it does not hold any state.
    I am still surprised about the behaviour you are seeing.
    Can you just attach your stateless session bean. You need not sendthe
    dependent files, since we only want to sniff the call made to the stateless
    EJB method, and are not concerned with the implementation.
    Regards,
    Anurag
    "John Hundley" <[email protected]> wrote in message
    news:[email protected]...
    Anurag,
    I am using the GA release. My control looks identicle toTraderEJBControl.jcx
    except of course it is extending a different home and bean interface.The
    bean
    itself does not exacly match the traderbean but it does look very
    similar
    to MusicBean.java
    in the tutorialsApp. One thing that has me a bit confused is the
    fact
    the
    create()
    method is being called every time I make a method call on the control.Shouldn't
    the bean only be created once at the first method call and persistfor the
    life
    of the session?
    John
    "Anurag" <[email protected]> wrote:
    John,
    Have you tried running the ejbControl/TraderEJBClient.jws in SamplesApp.
    It
    does involve calling methods on the stateless EJB TraderEJB through
    an
    EJB
    control, which accept parameters and run fine.
    Could you also confirm that you are using the 8.1 GA release, andnot
    the
    beta.
    Regards,
    Anurag
    "John Hundley" <[email protected]> wrote in message
    news:[email protected]...
    Raj,
    I cannot attach them here. I am not sure how you would test them
    anyway
    as I
    would have to send you my Oracle schema and you would have to
    set
    up
    a
    database
    instance. There is no way I can do that. If you could please
    send
    me an
    e-mail
    I can attach the relevant files in reply and you could take a
    look
    at them
    and
    see if you see any obvious problems.
    Thanks,
    John
    "Raj Alagumalai" <[email protected]> wrote:
    John,
    Can you attach the ejb jar, the jcx and the jws files that you
    have
    created.
    I will test and get back to you.
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "John Hundley" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I have created an EJB control on a stateless session bean.
    For
    some
    reason when
    I attempt to call a method on my control that takes any number
    of
    arguments I
    get a java.lang.IllegalArgumentException yet if I call a method
    that
    takes
    no
    arguments everything works fine. I used the debugger to walk
    through
    the
    code
    and have discovered that every time I call any method on the
    control
    the
    create()
    method gets called, this is exactly where the error is occurring.It is
    almost
    like the control is trying to pass my method args to the create()
    method
    instead
    of the method I am calling. I have tested all of the methods
    in
    the
    ejb
    by manually
    coding everything (getInitialContext ejb.create etc) in a .jsp
    and
    calling
    all
    of the methods within that .jsp. There they all work fine
    so
    I
    am
    pretty
    sure
    the control is doing something funky. Any ideas as to what
    is
    going
    on
    and how
    I can fix it?
    Thanks,
    John

    Was this issue ever resolved ? We are running into the same problem.
    The last response is "I'm not qualified to answer your EJB control question."
    Can this be escalated to someone who can please ?
    Regards
    Shahriar

  • EJB Jar not getting Build

    Hi All,
    I created a DC EJB and a DC EAR. I was able to create Projects successfully. Suddently when i create a new DC EJB, the jar is not getting generated when i build the ejb and because of which i cannot deploy the ejb. Also i am unable to build a DC Webdynpro Project too. But i am not getting any error on build of the project.
    What could be the problem. Y suddenly i am unable to build DC Components? Request you to provide me with solution in this regard.
    Thanks and Regards,
    Divya.

    Hi sunaina,
    I have done the same. But still when i build the webdynpro dc or ejb dc, it is not getting build.
    Regards,
    Divya

  • Put common functionality in EJB or not?

    There is a java program at my job which generates an HTML form "<form>...</form>" based on some criteria it received. This program is written as Stateless Session Bean. Lets call it "HTML Form Generator".
    Now the module I am working on needs to call the "HTML Form Generator". My module has couple of Stateless Session Beans from where I needs to call the "HTML Form Generator".
    Right now I am doing EJB to EJB call which is giving me the following warning in JBoss:
    11:13:02,070 WARN [TxConnectionManager] Prepare called on a local tx. Use of local transactions on a jta transaction with more than one branch may result in inconsistent data in some cases of failure.
    Any way to resolve this issue? I am thinking that the "HTML Form Generator" dont have to be in an EJB. Instead it can be in normal classes. What advantages I going to loose any thing if I recommend this approach?
    Thanks

    We have some rules which I cannot clasify whether
    they belong in business layer or presentationlayer.
    For example I have a rule that if the Status of arow
    displayed is "Approved" or "Not Approved" thenmake
    the whole row read-only. Now it appears to me a
    business rule but the businees layer is sendingDTOs
    to presentation layer. How can I sepcify suchtypes
    of rule so that presentation layer knows what todo?
    In your DTO bean, put in a method isReadOnly(). Your
    business layer sets the value, and your view layer
    interprets it and acts accordingly.Thanks. This makes sense. But there are some times complex rules: like if control 1's value is A then the control 2's value can only be C,D else X,Y,Z. OR if the User is not a Manager then hide the employee's Baes Rate. Stuff like that.
    If one property in DTO bean represents one column of the web page then there can be potentially numerous proprties of that column. Does that mean every property in DTO bean is another class?
    Another concern I have is how the DTO will match up with the HTML. Let me explain:
    Suppose we have two different test cases: one is Employee and another one is Shift. We create EmployeeDTO and Shift DTO.
    The business layer will create Lists of specific DTO type. So in 1st test case the business layer will return a List of EmployeeDTO type. In 2nd test case the business layer will return a List of ShiftDTO type.
    Suppose the HTML Generator class have 1 method to generate HTML:
    public String generateHTML(String pageName, List list);
    where pageName is the name of the Page as defined in the database. Now I have 2 concerns:
    1) how to know that which control in database belongs to which property in class?
    2) when looping through the List and converting it to specific type will be a problem. How will i know that i have to convert to EmployeeDTO in first test case and ShiftDTO in second test case?
    Thanks

  • Javax.ejb.Inject not found

    I'm working with jdeveloper 10.1.3 in S.O. XP
    build a proyect template JSP,EJB3,TOPLINK
    import javax.ejb.Inject;
    Error: Inject not found
    Tanks

    Add EJB 3.0 Library to project libraries.

  • SAS9.1 Persistence and EJB lookups (not registered in JNDI?)

    I am trying to deploy a very basic EJB3 module to test my learning. The module deploys via the Admin Console without apparnet error. Unfortunately, when using the generated test page for the web-service, I am having total failure which seems to be around the persistence unit and EJBs not being created in the JNDI.
    I have an @Stateless/@WebService bean:
    package com.flexit.buslogic;
    import java.util.logging.Level;
    import javax.ejb.Stateless;
    import javax.ejb.EJB;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import com.flexit.persistence.eao.OwnerFacade;
    @WebService
    @Stateless
    public class CreateOwner {
         @EJB
         private OwnerFacade ownerFacade;
         public CreateOwner(){}
         @WebMethod
         public Integer addOwner (
                   @WebParam(name="Name") String name){
             LogUtil.log("Add owner request " +
                        "received for "+name,
                        Level.INFO, null);
            return ownerFacade.findAll().size();
    }The OwnerFacade EJB injection fails with avax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJBIf I instantiate a 'normal' reference to OwnerFacade (ie OwnerFacade ownerFacade = new OwnerFacade(); I get a similar error in the OwnerFacade EJB in relation to an attempt to inject an EntityManager:
    package com.flexit.persistence.eao;
    import java.util.List;
    import java.util.logging.Level;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import com.flexit.persistence.LogUtil;
    import com.flexit.persistence.Owner;
    @Stateless
    public class OwnerFacade implements OwnerFacadeLocal, OwnerFacadeRemote {
         // fields
         @PersistenceContext(unitName="FlexIBuildPU")
         private EntityManager entityManager;
         public OwnerFacade () {
              if (entityManager == null) {
                   LogUtil.log("unable to get an Entity Manager Instance", Level.SEVERE, null);
    ...The constructor logs that the entityManager is, indeed, null.
    I have tried the code on SAS9 and 9.1 and using the default JavaDB and a MySQL connection pool (successful ping) and datasource (named 'jdbc/FlexDBDS') created through the Admin Console. The persistence unit is defined in a persistence.xml file in the META-INF folder:
    <?xml version="1.0" encoding="UTF-8"?>
         <persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
             http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
              <persistence-unit name="FlexIBuildPU" transaction-type="JTA">
                   <jta-data-source>jdbc/FlexDBDS</jta-data-source>
              </persistence-unit>
    </persistence>Can anyone please save me from tearing my hair out (more)?

    Have managed to resolve. There were two problems
    First I was attempting to access a session bean directly rather than via an interface (eejit!) - ie:
    @EJB OwnerFacade ownerFacadewhen it should have been:
    @EJB OwnerFacadeLocal ownerFacadeSecond, the persistence unit wasn't created properly. In playing around with persistence.xml I moved from:
    <?xml version="1.0" encoding="UTF-8"?>
         <persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
             http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
              <persistence-unit name="FlexIBuildPU" transaction-type="JTA">
                   <description>This unit manages BMS units, owners, offers, and acceptance.</description>
                   <jta-data-source>jdbc/FlexDBDS</jta-data-source>
                   <properties>
                          <property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
                          <property name="toplink.ddl-generation" value="create-tables"/>
                     </properties>
              </persistence-unit>
    </persistence>to:
    <?xml version="1.0" encoding="UTF-8"?>
         <persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
             http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
              <persistence-unit name="FlexIBuildPU" transaction-type="JTA">
                   <description>This unit manages BMS units, owners, offers, and acceptance.</description>
                   <jta-data-source>jdbc/FlexDBDS</jta-data-source>
                   <properties>
                          <property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
                          <property name="toplink.application-location" value="C:\ddl\flexdb\"/>
                          <property name="toplink.create-ddl-jdbc-file-name" value="create.sql"/>
                          <property name="toplink.drop-ddl-jdbc-file-name" value="drop.sql"/>
                          <property name="toplink.ddl-generation.output-mode" value="both"/>
                          <property name="toplink.ddl-generation" value="create-tables"/>
                     </properties>
              </persistence-unit>
    </persistence>It seems the very action of writing the sql to file helps with the binding. It seems so extraordinary that I think I must of made another mistake which was corrected along the way. In any event, the properties specifying output files may prove useful to others. :)

  • EJB reference not bound

    I'm running JBoss 3.0.1 with Tomcat 4.0.4 bundle. I have successfully deployed a EJB to Jboss and created 2 clients (java & JSP client).
    For some reasons, I'm able to run the java client but when I try the JSP client (served by Tomcat) I get this error message
    javax.servlet.ServletException: Name greetings is not bound in this Context
    Below is the code for the 2 clients & web.xml
    <----------- jsp client -------------->
    <%@ page import="javax.naming.*,
    java.util.*,
              java.util.Hashtable,
              javax.rmi.PortableRemoteObject,
    com.stardeveloper.ejb.session.*"%>
    <%
    long t1 = System.currentTimeMillis();
    InitialContext ctx = new InitialContext();
    Object ref = ctx.lookup("ejb/First");
    FirstHome home = (FirstHome) PortableRemoteObject.narrow (ref, FirstHome.class);
    First bean = home.create();
    String time = bean.getTime();
    bean.remove();
    ctx.close();
    long t2 = System.currentTimeMillis();
    %>
    <html>
    <head>
    <style>p { font-family:Verdana;font-size:12px; }</style>
    </head>
    <body>
    <p>Message received from bean = "<%= time %>".<br>Time taken :
    <%= (t2 - t1) %> ms.</p>
    </body>
    </html>
    <----------- java client ------------->
    import javax.naming.*;
    import com.stardeveloper.ejb.session.*;
    import java.util.Hashtable;
    import javax.rmi.PortableRemoteObject;
    import com.stardeveloper.ejb.session.*;
    class firstEJBclient {
         public static void main(String[] args) {
              try {
                   long t1 = System.currentTimeMillis();
                   InitialContext ctx = new InitialContext();
                   System.out.println("Got CONTEXT");
                   Object ref = ctx.lookup("ejb/First");
                   System.out.println("Got REFERENCE");
                   FirstHome home = (FirstHome) PortableRemoteObject.narrow (ref, FirstHome.class);
                   First bean = home.create();
                   String time = bean.getTime();
                   bean.remove();
                   ctx.close();
                   long t2 = System.currentTimeMillis();
                   System.out.println("Message received from bean = "+time+" Time taken : "+(t2 - t1)+" ms.");
              catch (Exception e) {
                   System.out.println(e.toString());
    <----------------- web.xml -------------------->
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <session-config>
    <session-timeout>
              1800
    </session-timeout>
    </session-config>
    <welcome-file-list>
         <welcome-file>
              firstEJB2.jsp
    </welcome-file>
    </welcome-file-list>
    <ejb-ref>
         <description>A reference to an entity bean</description>
         <ejb-ref-name>ejb/First</ejb-ref-name>
         <ejb-ref-type>Stateless</ejb-ref-type>
         <home>com.stardeveloper.ejb.session.FirstHome</home>
         <remote>com.stardeveloper.ejb.session.First</remote>
    </ejb-ref>
    </web-app>
    Why is it not bound?

    Please Ignore my other Message(My META-INF was not in Root and now I am able to get my beans bound).
    I am using Jboss 3.0
    I am able to access service of my HelloWorld Session Bean through a jsp.
    But not able to do so using a java client.
    my directory structure is :
    com\ideas\users\<Bean classes(Remote Interface,home interface,Bean)>
    com\ideas\users\<Bean client(a java client)>
    My java client program is :
    import javax.rmi.*;
    import javax.naming.*;
    import java.util.*;
    import com.ideas.users.*;
    public class HelloWorld {
    public static void main( String args[]) {
    try{
    Properties p = new Properties();
              p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
              p.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
              p.put("java.naming.provider.url","localhost");
              InitialContext ctx = new InitialContext(p);
              //Lookup the bean using it's deployment id
              Object obj = ctx.lookup("users/Hello");
    //Be good and use RMI remote object narrowing
    //as required by the EJB specification.
    HelloHome ejbHome = (HelloHome) PortableRemoteObject.narrow(obj,HelloHome.class);
    //Use the HelloHome to create a HelloObject
    Hello ejbObject = ejbHome.create();
    //The part we've all been wainting for...
    String message = ejbObject.sayHello();
    //A drum roll please.
    System.out.println( " run successfully and message is :" + message);
    } catch (Exception e){
    e.printStackTrace();
    I am able to compile but when i try to Run I get the following error message
    javax.naming.CommunicationException. Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ClientContainer (no security manager: RMI class loader disabled)
    at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
    at java.io.ObjectInputStream.inputClassDescriptor(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.io.ObjectInputStream.inputObject(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.io.ObjectInputStream.inputClassFields(Unknown Source)
    at java.io.ObjectInputStream.defaultReadObject(Unknown Source)
    at java.io.ObjectInputStream.inputObject(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.rmi.MarshalledObject.get(Unknown Source)
    at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:449)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at HelloWorld.main(HelloWorld.java:25)
    Please help me out .
    Thanks in advance
    Sujith

  • Basic auth interop problem, servlet WS works, EJB WS not (Sun AS 8)

    After spending some time I managed to add HTTP basic auth to a simple web service. I have implemented two variants, an JAX-RPC servlet web service and an EJB web service.
    A (Sun) JAX-RPC client works pretty well against both web services. I do the required steps with the stub (set user/pwd) and things work. I do get the correct principal in the server side, fine.
    When I do NOT set the authentication properties at the stub, the servlet based WS responds something like HTTP error 403 (?) or so, which leads to "authentication required". The EJB based response is not that adequate, it's something like "internal server error, EJBLocalAccessException or so" but from the given message you could get the idea what's wrong.
    Anyway, I got the impression that this stuff
    return HTTP error to flag "auth required"
    is not happening for some reason in my EJB based web service. I found this problem in Sun AS 8 and I think it's the same problem when I test stuff with Oracle's OC4J ...
    Some client implementations have obviously problems to get the idea that user authentication is required. In other words, the clients cannot invoke the EJB WS. I tried it with Perl Soap::Lite, MS SOAP Toolkit 3.0 and MS .Net 1.1 stuff. All this clients work well (with authentication) when I consume the servlet based web service. But the EJB based web service is not working at all. I do get there just "not allowed" and the SOAP client runtime is not handing over any user credentials (because it's obviously not correctly asked for it by an appropriate AS response).
    Anyone else experienced this problems with EJB WS???
    Interesting question: why is the JAX-RPC client working? Is it sending the properties set at the stub in any case? Or do they "handle" the internal error coming from Sun AS explicitly or so? Strange, in a way. :-)
    Thanx for any help here!
    Merten

    I guess the reason was that I wrote
    <login-config>
    <auth-method>Basic</auth-method>
    </login-config>
    instead of required
    <login-config>
    <auth-method>BASIC</auth-method>
    </login-config>
    At deploy time, I got no error message. At usage time, I just got this AccessLocalException. That's not really nice ...
    Merten

  • JavaEE5 tutorial  ejb example  not working!

    I have downloaded latest javaee5 tutorial example and i downloaded latest netbeans 6.9 and tried to run ejb cart example but i am getting
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
    at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
    Caused by: java.lang.NoClassDefFoundError: cart/util/BookException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.glassfish.appclient.client.acc.FacadeLaunchable.getMainClass(FacadeLaunchable.java:256)
    at org.glassfish.appclient.client.acc.AppClientContainer.setClient(AppClientContainer.java:317)
    at org.glassfish.appclient.client.acc.AppClientContainerBuilder.createContainer(AppClientContainerBuilder.java:174)
    at org.glassfish.appclient.client.acc.AppClientContainerBuilder.newContainer(AppClientContainerBuilder.java:161)
    at org.glassfish.appclient.client.AppClientFacade.createContainerForAppClientArchiveOrDir(AppClientFacade.java:458)
    at org.glassfish.appclient.client.AppClientFacade.createContainer(AppClientFacade.java:420)
    at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:256)
    at org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClientContainerAgent.java:75)
    FATAL ERROR in native method: processing of -javaagent failed
    ... 6 more
    Caused by: java.lang.ClassNotFoundException: cart.util.BookException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at org.glassfish.appclient.client.acc.ACCClassLoader.findClass(ACCClassLoader.java:211)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
    Exception in thread "main" Java Result: 1
    please help
    Edited by: vinaysb on Sep 1, 2010 3:29 AM

    there is not much help to give. Java already says what the problem is: the cart/util/BookException class is not on the application's classpath. That can indicate a missing library or bad deployment settings. Hard to say what it exactly is.
    All I can say is: learn how a JEE application is properly packaged and deployed and with that knowledge try and figure out where the mistake is.

  • EJB Control not working with methods that contain arguments

    Hi,
    I have created an EJB control on a stateless session bean. For some reason when
    I attempt to call a method on my control that takes any number of arguments I
    get a java.lang.IllegalArgumentException yet if I call a method that takes no
    arguments everything works fine. I used the debugger to walk through the code
    and have discovered that every time I call any method on the control the create()
    method gets called, this is exactly where the error is occurring. It is almost
    like the control is trying to pass my method args to the create() method instead
    of the method I am calling. I have tested all of the methods in the ejb by manually
    coding everything (getInitialContext ejb.create etc) in a .jsp and calling all
    of the methods within that .jsp. There they all work fine so I am pretty sure
    the control is doing something funky. Any ideas as to what is going on and how
    I can fix it?
    Thanks,
    John

    Oh well guess you guys gave up on this one. Thats ok, I have utilized a workaround
    that forgoes your non working controls just like I have workarounds for your dataforms
    that do not maintain their data between pages, your retrun to page that does not
    work etc.... At this rate I should have just used struts and JBoss.
    "John Hundley" <[email protected]> wrote:
    >
    >
    >
    oop's attached the wrong one here is the right one.
    "John Hundley" <[email protected]> wrote:
    Ok I have attached one of my beans.
    "Anurag" <[email protected]> wrote:
    John,
    For a stateless session bean, the ejbCreate() method is called for
    every
    individual method call. This is because the bean instance is returned
    to the
    pool after every method call, it does not hold any state.
    I am still surprised about the behaviour you are seeing.
    Can you just attach your stateless session bean. You need not sendthe
    dependent files, since we only want to sniff the call made to the stateless
    EJB method, and are not concerned with the implementation.
    Regards,
    Anurag
    "John Hundley" <[email protected]> wrote in message
    news:[email protected]...
    Anurag,
    I am using the GA release. My control looks identicle toTraderEJBControl.jcx
    except of course it is extending a different home and bean interface.The
    bean
    itself does not exacly match the traderbean but it does look very
    similar
    to MusicBean.java
    in the tutorialsApp. One thing that has me a bit confused is the
    fact
    the
    create()
    method is being called every time I make a method call on the control.Shouldn't
    the bean only be created once at the first method call and persistfor the
    life
    of the session?
    John
    "Anurag" <[email protected]> wrote:
    John,
    Have you tried running the ejbControl/TraderEJBClient.jws in SamplesApp.
    It
    does involve calling methods on the stateless EJB TraderEJB through
    an
    EJB
    control, which accept parameters and run fine.
    Could you also confirm that you are using the 8.1 GA release, andnot
    the
    beta.
    Regards,
    Anurag
    "John Hundley" <[email protected]> wrote in message
    news:[email protected]...
    Raj,
    I cannot attach them here. I am not sure how you would test them
    anyway
    as I
    would have to send you my Oracle schema and you would have to
    set
    up
    a
    database
    instance. There is no way I can do that. If you could please
    send
    me an
    e-mail
    I can attach the relevant files in reply and you could take a
    look
    at them
    and
    see if you see any obvious problems.
    Thanks,
    John
    "Raj Alagumalai" <[email protected]> wrote:
    John,
    Can you attach the ejb jar, the jcx and the jws files that you
    have
    created.
    I will test and get back to you.
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "John Hundley" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I have created an EJB control on a stateless session bean.
    For
    some
    reason when
    I attempt to call a method on my control that takes any number
    of
    arguments I
    get a java.lang.IllegalArgumentException yet if I call a method
    that
    takes
    no
    arguments everything works fine. I used the debugger to walk
    through
    the
    code
    and have discovered that every time I call any method on the
    control
    the
    create()
    method gets called, this is exactly where the error is occurring.It is
    almost
    like the control is trying to pass my method args to the create()
    method
    instead
    of the method I am calling. I have tested all of the methods
    in
    the
    ejb
    by manually
    coding everything (getInitialContext ejb.create etc) in a .jsp
    and
    calling
    all
    of the methods within that .jsp. There they all work fine
    so
    I
    am
    pretty
    sure
    the control is doing something funky. Any ideas as to what
    is
    going
    on
    and how
    I can fix it?
    Thanks,
    John

  • EJB Bean not being called

    HI
    I have a session bean deployed on Weblogic 8.1, when I try to call a method on bean from a simple class (out side of server context) it is just calling the method on the remote object but not Bean object.
    I made a jar file and deployed it through weblogic console, It worked fine when I test with Test this EJB link on the Testing Tab on console.
    client class was not part of jar.
    weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>Create</ejb-bean>
    <jndi-name>java/CreateHome</jndi-name>
    </weblogic-enterprise-bean>ejb-jar.xml
    <ejb-jar>
    <enterprise-beans>
    <session>
      <ejb-name>Create</ejb-name>
    <home>CreateHome</home>
    <ejb-class>CreateBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>container</transaction-type>
    </session>
    </ejb-jar>client code
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory")"
    InitialContext ctx = new InitialContext(ht);
    Object obj = ctx.lookup("java/CreateHome");
    CreateHome home =   
          (CreateHome)PortableRemoteObject.narrow(obj,CreateHome.class);
    Create remote = home.create();
    remote.callSomemethod();any help will be appreciated, thank you

    Sorry guys please ignore my post.
    It was working fine, I was not looking at weblogic Server logs for my ejb printouts , instead I was looking at logs for the Client code in Net beans.
    sounds stupid right ?

Maybe you are looking for

  • How to place a servlet file in Tomcat 5.0?

    Hi, i'm using Apache Tomcat 5.0 as myweb server.i don't know how to set the class path and where to place my servlet and html files,and how to run my servlet file.if anybody knows plz give me a detailed description abt this topic.

  • Cleanly "Starting Over" with the Desktop Software (non-BES)

    Hi there, With the advances in the RIM Desktop Software, there have been many posts about the upgrade process resulting in less than functional situations. The process I recommend is to cleanly start completely over, cleaning all remnants of the Desk

  • Problem with windows media player

    hallo, mine is hp pavilion entertainment pc model:dv5-1110eg i have a problem regarding windows media player when i use to click on it it is showing an error message like this  Windows Media Player Error Message HelpYou've encountered error message C

  • How do i repair a corrupt hard drive and i lost my install disk

    My Macbook started acting up....when rebooting there was a flashing file folder with a ? inside. Finally got to reboot, ran Disk Verfiy and my hard drive is corrupt. We just moved and I have no install disc. How do I repair my hard drive?

  • Angry birds on Nokia E6!

    Hi! Last couple a days I'm having problems with angry birds on my E6! The touch screen doesn't respond! Has anybody have the same problem!? Have some suggestions what to do?