Architecture J2EE

Hi,
Im building a simple application and are planning on doing soo in J2EE (Im a complete newbie on the topic). Therefore Im doing some self-study. The application Im trying to build is the foolowing:
1. There are 2 objects, user and result. Where the User can have many results.
2. Through a JSP page the user can change their settings.
3. An application will run ones a day and search a database depening on the user settings and find result wich will be stored along with the user.
This is how Im building it:
1. Using eclipse J2EE plugin. Creating a Enterprise application containing web module (jsp), ejb module (using xdoclet to build ejb).
2. Exporting ear and deploying it on Jboss
3. MySQL with hibernate to store data
Now to my questions:
1. How should I use EJBs in concern of user-login and persist objects? What sort of EJB should be used when? Does anyone know of any good tutorials?
I have currently created one EJB (Stateless session bean), TestBean, which Im having trouble calling:
String s = "none";
try
TestLocalHome testLocalHome = (TestLocalHome)new InitialContext().lookup("Test");
TestLocal testBean = testLocalHome. create();
s = testBean.sum(10,10);
catch (Exception e)
s=e.toString();
The result on jboss is a list of the files and directories in my web-app ("Test" is the JNDI name in jboss.xml).
2. How can I build my app that will scan a database ones a day and make it run within JBoss? Does anyone know how the "client application module" in eclipse is used?
Any input is greatly appreciated!
Kind regards

You may want to look at Java EE 5/j2ee 1.4 samples which illustrate many types of ejbs and other resources.
http://java.sun.com/javaee/reference/code/
- sreeni

Similar Messages

  • Setting Up a Java Web Server on Linux

    Greetings,
    After a lot of reading, I've decided to learn Java server-side technologies (I already know Java (desktop)
    but with little experience) in order to develop my database driven dynamic website projects.
    However, I'm completed lost between the hundreds of acronyms related to Java and the "thousands" of technologies involved.
    Google hadn't help me understand what they really are and how they relate with each other.
    Even though is easy to find what they stand for and some faqs/descriptions, it hasn't been enought to clear my mind.
    I want my webserver application to do, among other things, the following:
    Retrieve Data from a database, do generate dynamic html files.
    Story Data on the database, from html forms.
    Send automaticly emails for multiple users. (newsletter for example)
    E-Commerce.
    Html graber/parser (I don't know if this is the right word, I mean a program that for example, goes to a URL with an html
    table, and stores that information in a database table, as long as the format didn't change).
    Real Time Chat feature.
    Database connection pooling, caching, and other important optimizations.
    I'm not asking for how to develop or configure this features nor what components and programs, must be installed.
    At the moment, I only want to know how to set up a Java solution that will support them when they are needed.
    *** Linux ***
    I want to set up my webserver on a linux distribution.
    In that respect, I don't know if I should choose RedHat or Fedora Core.
    I've heard that fedora is better for a webserver (having in mind that Red Hat Enterprise AS/ES aren't free).
    But I've read in several sun turorials/webpages references to RedHat (on a J2EE context).
    So I'm wondering if is better to go for Fedora or RedHat. Are there pros & cons? They equally support Java?
    *** Technologies ***
    Then in starts the acronyms problem.
    What do I need to install, in what order, for what?
    Some aconyms and technologies, I have read about but don't fully understand are the following:
    Apache
    J2EE
    J2EE 1.4 SDK
    SUN Java System Application Server Platform Edition 8
    J2SE 1.4.2 SDK
    SUN Java Enterprise System
    Tomcat
    Struts
    Cocoon
    JBoss
    I already know J2EE is only a specification. What implements that specification? Sun Java System Application Server?
    J2SE SDK? or Tomcat?
    What is the role of each technology, namely Apache, Tomcat, Sun Application Server?
    What is the Sun Java Enterprise System?
    How do Struts, Cocoon, JBoss relate to Java?
    Which of these technologies are mutually exclusive (analogous)?
    *** Doubts ***
    Then, I have some doubts that are keeping me from starting to study seriously the important techonologies, because I don't
    want to lose lot's of time and effort learning them to after a dillusion start everything again with PHP (the language
    which make me think and read a lot before going for Java). To keep this from happening, I would like to know the following:
    I want to use Java for developing websites with commercial/profitable use for my company, in some throught e-commerce,
    and in other by banners. I want to do everything by the book, with required licenses.
    ------ Java is Free?
    Is Java Completely Free or it might be possible that at a certain point, when I need some component or library,
    multi-machine webserver, performance or security for high-traffic I will see "buy now" instead of "download now"?
    For what they may "ask for money"? and what are the disavantages if I can't buy?
    For example, "Java System Application Server Standard Edition 8.1 2005Q1" and
    "Java System Application Server Enterprise Edition 8.1 2005Q1" cost $2.000 and $10.000 respectively. That is money.
    (http://www.sun.com/software/products/appsrvr/index.xml). What are the disavantages if stick to the free edition?
    Features like (from sun site)
    Standard Edition:
    Extends the capabilities of the Platform Edition to provide secure, remote, multi-instance, multi-machine management.
    It is aimed at high-volume applications and Web services.
    Enterprise Edition:
    Further extends the capabilities of the Standard Edition to provide continuous availablity for applications and
    Web services. It is aimed at business critical, high value applications and Web services.
    Suppose I achive lots of traffic and I keep the free platform edition.
    I won't be able to have a multi-machine webserver set up correctly?
    What are the drawbacks? How big are the performance penalties?
    ------ Technologies Availability
    Finnaly, I have the idea (I don't know if it's accurate) that there are Sun versions and Open-Source Free versions
    of doing or supporting the same Java related thing.
    Despite the way I choose to set up a Java webserver, I will always have all J2EE techonolies like:
    Java API for XML-Based RPC (JAX-RPC), JavaServer Pages, Java Servlets, Enterprise JavaBeans components,
    J2EE Connector Architecture, J2EE Management Model, J2EE Deployment API, Java Management Extensions (JMX),
    J2EE Authorization Contract for Containers, Java API for XML Registries (JAXR), Java Message Service (JMS),
    Java Naming and Directory Interface (JNDI), Java Transaction API (JTA), CORBA, and JDBC data access API.
    I really appreciate some help. I could learn the basics of all this "stuff" before asking. But the point why I'm asking
    is precisely not starting to learn something I may won't use. Obviously, I will have to make a lot of reading during maybe
    months before writing the first line of code of my projects, but being certain that it will fit my needs.
    I will be very thankful if you can enlightme in my fedora/redhat, setup, free/cost and technologies avaibility issues.
    Thanks Beforehand,
    Pedro Vaz

    Apache is a free Web-server.
    Tomcat is a servlet (and JSP) container. It can be stand-alone or can be used together with a Web server (like Apache).
    J2EE's scope is much wider than the servlet stuff, but a standalone Tomcat is a good starting point to servlets and JSP.
    One of our "real-world" applications is run by a standalone Tomcat using POI and Velocity. I did not regret this architectural decision.

  • Deploying an EAR File

    Hi,
    I want to move my J2EE system from one machine to another.
    Is everything contained within the .ear file, or do i need to move the jar/war files as well?
    Thanks in advance.
    PS: When I move them, will they work on any architecture / j2ee server?

    Only ear files are sufficient and that's the purpose of having jar and war packaged in an ear.
    They are ideally suppposed to work on any J2EE compliant app server , provided they are version compliant.
    Regards,
    Ashoke Bhowmick

  • J2EE Architectural Design Solution Needed

    Hi,
    I am coming up with an issue in designing the application architecture. It would be great if some one suggest solution for the problem.
    The basic flow of application:
    1. Client initiates a transaction from a Portlet.
    2. Portlet invokes business service component (Coarse grained Stateless Session Bean) by passing XML document.
    3. Corse grained SLSB process the incoming XML and invoke local session beans by passing relevant Document objects built by using service API.
    4. Based on Incoming Message, message splits and placed on multiple destinations (Linked by Message Queues) hosted on Enterprise Service Bus (ESB).
    5. A Message driven bean listens to the incoming request at Queue and invokes external services/Web services
    6. Response xml is built and placed Response Queue in ESB by invoking business service API.
    6. A MDB listening to the Response Queue will process outgoing messages which needs to be routed to original request invoker.
    The Messages are linked with correlation ID and request and response are tied by some rules and business logic.
    The design problem I am facing now is, how do my client waits till response comes from response queue as application need to give response to the client in synchronous manner.
    The other issue is some of the incoming requests need to be executed (placing in queue) in orderly fashion and run in a transaction. (Which I am trying to process them as command Lists in prototype using Message sets and flows in MQ, but is there any implications if try to push this logic to J2EE container)
    Thanks,
    Madhu Palutla

    I think that you need not worry about the client waiting for the response..since this is a simple request response cycle and is synchronous...thus the invoker need to wait for the response anyway.
    Secondly, I hope that you would definitely carry the points 4,5, and 6(the actual 6
    ) in a transaction, the option to choose the programmatic or declarative always remains on you.

  • Java & J2EE Architecture & Development

    can soomebdy provide me a link to a pdf on Java and J2EE architecture and development in XI .
    Thanks in advance ,
    divya

    Hi,
    XI-J2EE for Java programmer
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70ada5ef-0201-0010-1f8b-c935e444b0ad
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7bf6e190-0201-0010-83b7-cc557eb76abe
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ee7fa790-0201-0010-5aac-a0b2f0e94982
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c1311203-0701-0010-dba2-9f42e9a74ea9
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0482c490-0201-0010-cc9c-91c5a538a0a6
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/13926f23-0a01-0010-149c-c1170e7a25db
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/423f5046-0a01-0010-2698-b2dc7c3185f1
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7ac6ae90-0201-0010-50b4-f71fa2cc271a
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0332d790-0201-0010-46b1-a0530fe87c1fhttps://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c75ee690-0201-0010-7baf-af868a642918https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/13d02057-0601-0010-abba-be4a86d47f9e
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0f00c890-0201-0010-beb2-c96050edc426
    Regards
    Chilla..

  • J2EE Connector Architecture(Omni Portlet)

    Hello,
    In the Developer Guide ,(http://download-west.oracle.com/docs/cd/B14099_10/portal.1012/b14134/pdg_matrix.htm#CEGFBJEC)
    it is mentioned about J2EE Connector Architecture as a data source. In the omni portlet data source type it is not listed. How can I configure and use it for data source?
    I am using 9.0.4 version of Portal
    Any help is highly appreciable.
    Thanks

    We are trying to do a JCA Adapter and are running into the same type of questions as you. Clearly, no one is watching this topic. Have you found a reference application to test the RA against?
    Please feel free to contact me at [email protected]

  • J2ee architecture/framework books/pointers

    hello,
    can you suggest me some good j2ee architecture as well as books/pointers?
    thanks

    There are more than one way to do all this, depending on your particular application:
    - servlet's init() method, if it's a Web application
    - JMX MBeans
    - EJB Timer service or some other job scheduling like Quartz
    - batch programming (Unix shell + cron, or Win batch)
    - etc...
    Also, EJB is merely one technology inside the J2EE stack. You can use J2EE without EJB, and in many cases, this is the best option.
    Sun's J2EE tutorial.

  • J2EE Architecture!

    Hi All,
    I know that J2EE architecture is multitiered distributed architecture consisting of Client tier, Business component( Web components + EJB) and EIS or database at the back end. Looking at this architecture, the Client is nothing more than a user's Browser that is, IE or Netscape etc. Now why do we consider these IE or Netscape or any browsers as a client tier as if we develop them? I would appreciate if you could educate me.
    thanks.

    Hi All,
    I know that J2EE architecture is multitiered distributed architecture consisting of Client tier, Business component( Web components + EJB) and EIS or database at the back end. Looking at this architecture, the Client is nothing more than a user's Browser that is, IE or Netscape etc. Now why do we consider these IE or Netscape or any browsers as a client tier as if we develop them? I would appreciate if you could educate me.
    thanks.

  • Emails Architecture for big J2EE Applications

    Hi all !
    Need some inputs regarding design of email sending mechanism in huge J2EE applications.
    We are having a medium based application (say 2 lakh subscibers) but may have a increase in
    subsciber base sooner. Its a 3-tier application using Struts (JSP), EJB & Database is Oracle 8i.
    Till now we are using Oracle jobs for submitting emails (asynchronus), it works fine for small subscriber
    base but increase in subscriber base will increase load on database and we want to avoid that.
    Concerned points are :
    1. What architecture is followed in big J2EE applications for sending emails asynchronously ?
    2. How much feasible is using JMS provided with weblogic app server for huge applications ?
    3. Does using messaging queues at app server end will degrade performance considerably ?
    Please see if anyone can help out in this..
    Puneet Gandhi

    I've used JMS + Weblogic (2 quad processor servers in cluster) and JMS in a system that took between 5,000 & 10,000 new users per day. It held up fine.
    I'm not an architect (more of a developer), but I would create a serializable NotificationBean, send it to a MessageBean, and let the MessageBean send the email. Providing your queues are persisting and that you limit the number of MessageBeans to something reasonable, I don't see why you should have performance problems.
    Alternatively if you use MQ I believe it has an email node that you can send messages to. Don't know much about this though.

  • How Weblogic used in Integration using J2EE Connector architecture??? need more info

              Hi xperts,
              Would like to know more about weblogic integration in EAI zone using J2EE
              I checked on
              http://java.sun.com/j2ee/connector/
              http://java.sun.com/j2ee/white/connector.html
              Can anyone elaborate more on it? give me relevent more links??
              thnxs in advance
              --harshal
              

    http://www.bea.com/solutions/integration/index.shtml
              Harshal Pendse wrote:
              > Hi xperts,
              >
              > Would like to know more about weblogic integration in EAI zone using J2EE
              >
              > I checked on
              > http://java.sun.com/j2ee/connector/
              > http://java.sun.com/j2ee/white/connector.html
              >
              > Can anyone elaborate more on it? give me relevent more links??
              >
              > thnxs in advance
              > --harshal
              

  • Oracle Report in a J2EE Architecture

    Dear All,
    I have for this architecture:
    - Database Layer Oracle 8i in future 9i
    - Application Server Tomcat
    is possible to integrate this architecture with a Oracle Report Server?
    If yes how to transform the architecture?
    Thank's bye

    Hi,
    Download samples of Web Services SDK code from link below
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm
    Web Services SDK -
    > Business Objects Web Services Java and .NET Code Samples-----> Download the Java code samples
    and go for sample code "viewReportWebi".
    This should help up.
    Thanks,
    Praveen.

  • Appreciating J2EE Architecture

    I was asked a question in an Interview, I did not give a convincing answer. I request for a Convincing answer:
    Question: How do you appreciate J2EE Architecture

    Just putting my thoughts..
    The ultimate goal of this is Customer Satisfaction. Customer can be Software architects, Developers or the most important END USER. J2EE has advatages in all the three category.
    For architects..
    Nothing much to say, cuz I am developer and I haven't yet designed a complete system yet. Since the Containers take care of the complex issues like resource pooling, Transaction management, Security Issues and other low level jobs, it just give enough time to concentrate on business logic. Also the componentisation and platform independace helps in concentrating on specialising in software development roles like Web Component Developers, assembler, administrator and so on.
    Watch out for Web-Services, this will introduce one more specialisation area for Software Vendors.
    For Developers...
    Java is easy to learn, tame and use. :)
    J2EE, each component development, EJB, JSP, Beans, Servlets and so on..is a specialised job and although they are integrated, we can make them independent entities during development stage. Efforts to learn each of them, nothing more than few weekends. :)
    For End Users...
    XML, the back-bone of future IT. will make Any One, Any time and Any where usage of end products. J2EE has advantage in this end since it can be easily used for this scenario along with XML and related Technologies. We can have wide range of Clients i.e. users like thick client, browser, mobile, plamtop, and even land line phone. But the Back end application is SAME for all these.
    So I feel J2EE applications is just not "Write once and Run anywhere"... its Write Once, Run Anywhere, and Feel Everywhere. :)
    Cheers.

  • J2EE applicaions architecture...

    Hello,
    I cannot use CMP because I have very complex queries, and I cannot alter database structure. But I read that BMP are even worse (if you read multiple BMPs, only primary keys are read and afterwards rest data will be read). As I understand. If so it's quite slow.
    I don't know what about statless and stateful beans. I am reading about them and trying them now.
    But as I understand when I invoke remote method that returns object, object that was returned will be local and cannot use server functionality (I mean directly). For instance in DCOM when object returned its methods will be invoked remotely (if it isn't stated otherwise), I mean I can use server functionality (all objects that cross process boundary will use stub-proxy stuff).
    I can use two ways to solve this:
    1) I can use Objects with data as a C (language) structs and session beans as functions. This is a funny thing but after everybody sad that C is an extremely uncomfortable technology we returned to a kind of it in Java.
    2) I can use wrappers. Client will have wrapper that will hide this by invoking session beans itself. The huge disadvantage is that I have to write a lot of wrappers.
    -- I want to hear that do you think about these problems.
    -- Can anyone give me some examples of large systems that use J2EE (at least 50-200 concurrent users)?
    P.S. I am new to J2EE and quite perplexed with reality after I read so many goot articles about J2EE.
    With regards,
    Pavel Krupets
    Evaluating JBoss/J2EE

    Entity beans are meant to be simple, just as objectsare meant to be simple.
    I am not against simple objects. But objects ment to
    provide data and actions on that data. And some
    actions can be performet only at server side. And J2EE
    turns objects into structures with get... and set..
    methods (EJBs) and functions collections (Session
    Beans).Yes, Entities are meant to be a logical layer over the underlying data structure, they provide you security, data integrity acess speed while decoupling the rest of your application from your data base schema. And objects must provide actions since the acton is consistent with the the object, or to be mor strict, with its data, when you use an entity to provide actions that spans all across your application data, you are loosing the meaning of that object.
    I'm not saying that you can't have methods other than acessors in your entities, nor i 'am sayng that the acessors must be a direct translation from fields on your data base, just don't miss the point of the them, do not try to smugle business logic into it, entities are logical units that represents the data your sistem uses, as such they function as a facade for your system to view your underlyng DB, if in your A&D you found that some data from your BD have more meaning as an entity, and that same data is found in diferent tables of your system, great!
    Just build an entity over views or multiple selects, some day when you decide to change your data base schema, your system will not change, for the sistem views the data through the entities.
    If your queries are too complex, they should not be.It's easy to say that, but it's impossible to achive.
    Can EJB be stored in multiple tables (some are
    optional)? Can EJB load data partly from views
    (database contains some tables that store
    precalculated data - I cannot omit that)? And I CANNOT
    CHANGE database schema.1) Yes, Entities can load from multiple tables and even from no table at all, you can have entities that loads data from legacy sistems or even more mistycal sources.
    2) It's never impossible to refactor, and in some cases it's well worthy the effort.
    It's a bad thing to say: J2EE will solve all our
    problems and we can create database that best suits
    EJBs (it's okay with small apps but it's impossible to
    achive good performance in enterprise applications).
    In my case there is an ordinary database (OLTP) as
    well as OLAP. And database schemash are quite complex
    (a lot of data stored in db).A loaded data base does not equals to a complex data base schema, and as I said above, the entities function to hide the db schema from the application, so it does not matter if it is complex or not.
    A good way to think the beans architeture is to think that the your entities are the interface with the system data, your session are your interface with the outside world..
    May the code be with you.

  • J2EE Architecture (EJB)

    I have become increasing disillusioned with J2EE and EJB�s in particular. I am no longer sure what they are trying to achieve and how the �objectives� are implemented. Writing the simplest EJB by hand is time consuming. Using something like XDocolet produces mountains of �Pseudo-Code� in comment blocks. The very idea of using comments in code to write code seems perverse to me. Surely comments are for comments and code is for code. After all this what is generated? The simplest of SQL statements. What are the benefits ? More efficient code ? More robust code ? Easier to maintain code ? More portable code ?
    Would somebody care to point out what I am missing ?

    Excellent thoughts, Annie, as usual.
    Performance and learning curve seem to be the biggest complaints about J2EE and EJBs.
    I think stateless session and message beans are winners. Entity beans are the red-headed stepchildren: nobody seems to like them much, even with local interfaces. There is so much disagreement about how to handle persistence in Java (e.g., raw JDBC, JDO, O/R mapping, CMP, etc.) that how to "best" handle it is still open to question.
    I'm not aware of the same level of thrashing in the .NET community. (I'm not aware of much in the .NET community.) How have they solved the O/R impedence mismatch to everyone's satisfaction?
    Scott Ambler wrote some terrific papers about O/R mapping. I'll have to go back and re-read them to see if I can figure out which of the competing persistence technologies best address the problem.
    The whole point of J2EE and its containers, IMO, is that the smart developers who write the container relive mere mortal programmers like me from writing a lot of difficult plumbing. The container worries about threading, transactions, persistence, clustering, security, and all sorts of other things that I'd have to write a lot of code to reproduce without it. (Or worse, just leave it out and hope for the best.) I think that's still a worthy thing to do. The trick is to take as much advantage of the container as you can without distorting your application's design or compromising its performance.
    EJB 3.0 is debating this again. POJOs sound like they'll be much more prominent. It'll be interesting to see where this goes.
    Personally, I'm astonished at how complex entity beans and persistence are in J2EE. Entity beans map to database rows, but that's not a good match for the set-like SQL and relational databases. Remote entity beans are a disaster: Do I really need a remote call for each and every field? Local interfaces help, but we still need the Session Facade Pattern, DTOs, all kinds of machinery just to get a bloody value out of a database and into a JSP. How much layering is too much?
    %

  • J2EE architecture question

    Suppose you have a distributed application consisting of a number (max 100) of webservers (Servlets/JSPs technology) which send information (e.g. a random number) to one central system (using EJBs). The central system receives the random numbers through a session facade and adds the contributions from the various webservers. When the total reaches a certain level, the central system needs to inform all contributing webservers of the new total.
    My question:
    - What is the best (simple, low-cost, easy to implement) way for the central system to inform the webservers?
    Options I've thought of:
    1. messaging (probably too complicated?)
    2. polling from the webservers (too much traffic?)
    3. central system invoking a Servlet on each webserver (is this practical?)
    Any comments will be greatly appreciated!

    1. messaging (probably too complicated?)Actually quite easy, especially since your app server probably already has a JMS provider. And, if all of your Servlet servers are basically running the same application (e.g. same deployments), you'll only have to write one MessageListener to be placed in the application.
    2. polling from the webservers (too much traffic?)Too much traffic, threading issues, wasteful of processing power - a whole host of problems with that approach.
    3. central system invoking a Servlet on each webserver
    (is this practical?)Then your main EJB application would have to "know" the address of each and every webserver - which gets you into a maintenance nightmare. Not practical at all...

Maybe you are looking for