Adobe 38000382 Getting Started Guide

Adobe 38000382 - Macromedia JRun - Mac Manual

Adobe 38000382 manual content summary:

  • Adobe 38000382 | Getting Started Guide - Page 1
    Getting Started with JRun
  • Adobe 38000382 | Getting Started Guide - Page 2
    M Logo & Design, Macromedia Flash, Macromedia Xres, Macromind, Macromind If you access a third-party website mentioned in this guide, then you do so at your own risk. Macromedia provides © 2002 Macromedia, Inc. All rights reserved. This manual may not be copied, photocopied, reproduced, translated,
  • Adobe 38000382 | Getting Started Guide - Page 3
    do next 14 CHAPTER 2 JRun Programming Model 15 Enterprise application architecture 16 Enterprise application design 16 J2EE application architecture 16 JRun support for the three-tier model 18 JRun programming environment 19 JRun servers 20 Using JRun servers 20 Starting and stopping JRun
  • Adobe 38000382 | Getting Started Guide - Page 4
    35 J2EE Connector API 1.0 35 Java Authentication and Authorization Service 1.0 36 Java Naming and Directory Interface 36 Common Object Invoking servlets 38 Servlet benefits 39 Creating servlets 40 JRun support for servlets 40 JRun support for JSPs 40 Servlets and JSPs 41 HTTP requests and
  • Adobe 38000382 | Getting Started Guide - Page 5
    EJB types 49 Session beans 49 Entity beans 50 Message-driven beans 51 Using EJB in JRun 52 Stubless deployment 52 Deployment options 52 EJB clustering 52 XDoclet 53 The Enterprise Deployment Wizard 53 CHAPTER 6 Developing Web Applications 55 Introduction to web applications 56 The
  • Adobe 38000382 | Getting Started Guide - Page 6
    the code for the order EJB 94 Summary 95 Tutorial lessons summary 95 What's next 95 LESSON 4 Web Services Tutorial 97 Using JRun web services 98 TravelNet web services application 98 Setting up the development environment 99 Getting started with JRun 100 Adding a JRun server 101 Deploying
  • Adobe 38000382 | Getting Started Guide - Page 7
    consisting of Java Servlets, JavaServer pages, Enterprise JavaBeans, and Web Services. Part I of this book provides a general introduction to JRun and and Macromedia resources, such as websites, documentation, and technical support. Contents • Developer resources viii • About JRun documentation ix
  • Adobe 38000382 | Getting Started Guide - Page 8
    Developer resources Macromedia, Inc. is committed to setting the standard for customer support in developer education, documentation, technical support, and professional services. The Macromedia website is designed to give you quick access to the entire range of online resources. The following table
  • Adobe 38000382 | Getting Started Guide - Page 9
    documentation provides support for all services. JRun Assembly and Deployment Describes how to assemble and deploy the Guide components of a J2EE application. JRun SDK Guide versions of all JRun books as Adobe Acrobat Portable Document Format (PDF) files. The PDF files are included on the JRun
  • Adobe 38000382 | Getting Started Guide - Page 10
    , Second Edition Jason Hunter and William Crawford O'Reilly & Associates, 2001 ISBN: 0596000405 http://www.servletguru.comJava Servlets Developer's Guide/a Karl Moss McGraw-Hill/Osborne Media, 2002 ISBN: 0-07-222262-X http://www.sourcestream.comInside Dustin R. Callaway Servlets: Server
  • Adobe 38000382 | Getting Started Guide - Page 11
    Core JSP Damon Hougland and Aaron Tavistock Prentice Hall, 2000 ISBN: 0130882488 JSP: Javaserver Pages (Developer's Barry Burd Guide) Hungry Minds Inc., 2001 ISBN: 0764535358 Enterprise JavaBeans http://www.middleware-company.c omMastering Enterprise JavaBeans, Second Edition/a Ed
  • Adobe 38000382 | Getting Started Guide - Page 12
    /j2ee/download.html#blueprints/a ) Building Java Enterprise Systems with J2EE Paul Perrone and Venkata S.R. "Krishna" .R. Chaganti Sams, 2000 ISBN: 0672317958 J2EE: A Bird's Eye View (e-book) Rick Grehan Fawcette Technical Publications, 2001 ISBN: B00005BAZV Java Message Service Richard Monson
  • Adobe 38000382 | Getting Started Guide - Page 13
    Server Side Dot Com Builder Servlet Forum http://www.theserverside.comhttp://www.theserversid e.com/a http://dcb.sun.comhttp://dcb.sun.com/a http://www.servletforum.com/http://www.servletforum .com/a Other resources xiii
  • Adobe 38000382 | Getting Started Guide - Page 14
    offers a range of telephone and web-based support options. Go to http://www.macromedia.com/support/http://www.macromedia .com/support//a for a complete description of technical support services. You can make postings to the JRun Support Forum (http://webforums.macromedia.comhttp://webforums.macrom
  • Adobe 38000382 | Getting Started Guide - Page 15
    PART I Introduction This part contains an introduction to JRun and J2EE. Welcome to JRun...3 JRun Programming Model 15 Introduction to J2EE 29 Using Servlets and JSP 37 Introduction to EJB ...47 Developing Web Applications 55
  • Adobe 38000382 | Getting Started Guide - Page 16
  • Adobe 38000382 | Getting Started Guide - Page 17
    CHAPTER 1 Welcome to JRun This chapter contains an overview of Macromedia JRun and JRun architecture. It describes many of the features and tools that you use during application development and deployment. It also includes a description of different types of JRun users and pointers to the JRun
  • Adobe 38000382 | Getting Started Guide - Page 18
    for developing applications composed of Java Servlets, JavaServer pages (JSP), Enterprise JavaBeans (EJB), Java Message Service (JMS), Macromedia Flash files, HTML pages, images, and other resources. JRun supports a variety of Windows and UNIX platforms. Its open design lets JRun work with a variety
  • Adobe 38000382 | Getting Started Guide - Page 19
    of Java's inherent portability and can be run on all platforms supported by JRun. J2EE offers a number of benefits for application programmers, including the following: • Rich set of standard APIs and services • High performance • Integration with backend infrastructure, such as Relational
  • Adobe 38000382 | Getting Started Guide - Page 20
    are message listeners that run in the EJB container and can use container services, such as security and transactions. J2EE Connector Architecture (JCA) 1.0 Defines a standard architecture that supports integration of J2EE servers with enterprise information systems, such as Enterprise Resource
  • Adobe 38000382 | Getting Started Guide - Page 21
    that are shared across all the components and features of the server. The backbone provides flexibility through its ability to accommodate various services. Services extend the core server by adding functionality, independently of each other. In JRun, the core server backbone is the server kernel
  • Adobe 38000382 | Getting Started Guide - Page 22
    (MBeans) and plug them into the JRun kernel. All JRun services can take advantage of the clustering capabilities built into the JRun kernel. For more information on JRun architecture, see JRun Administrator's Guide. JRun features JRun 4 provides many new and changed features, including the following
  • Adobe 38000382 | Getting Started Guide - Page 23
    in JRun. For more information, see JRun Programmer's Guide. JRun Server Tags (JST) JST technology supports JSP 1.2 and recursion. JST lets you write custom server objects, such as EJBs, JNDI trees, or any clusterable custom service. The object state (for example, the state of a stateful EJB)
  • Adobe 38000382 | Getting Started Guide - Page 24
    of failure. For more information, see JRun Administrator's Guide. Security JRun supports the JAAS 1.0 specification, which includes the following levels groups from Windows domains. For more information, see JRun Administrator's Guide or the JMC online Help. • Web application security To address
  • Adobe 38000382 | Getting Started Guide - Page 25
    deployment descriptors). For more information, see JRun Programmer's Guide. Pointbase database server JRun includes a restricted version of the agent that sells trips from Compass travel. This application illustrates JSP and web services programming, and is delivered as an enterprise application
  • Adobe 38000382 | Getting Started Guide - Page 26
    web services programming. Programming techniques described in this book. The techniques application uses the samples database, accessing it through the samples data source, which you can view through the JMC. Flash movies and Flash Gateway adapters, which illustrate how to write Flash applications
  • Adobe 38000382 | Getting Started Guide - Page 27
    a console window to the jrun_root/lib directory and issue the following command: java -jar jrunwizard-installer.jar For a list of currently supported IDEs, see the Release Notes. The Enterprise Deployment Wizard features a context-sensitive online Help system. For usage information, see the online
  • Adobe 38000382 | Getting Started Guide - Page 28
    flexible and scalable J2EE application. In the last tutorial lesson, you use web services to access data in a JRun sample application. The following table shows the Java Servlets, custom tag libraries, or JavaBeans. JRun Programmer's Guide Java Servlet and tag Develops servlets in Java, and also
  • Adobe 38000382 | Getting Started Guide - Page 29
    and deploying J2EE enterprise applications. This chapter describes the JRun programming model, the major components of JRun, and JRun support for J2EE enterprise applications. Contents • Enterprise application architecture 16 • JRun programming environment 19 • JRun servers...20 • Web servers...25
  • Adobe 38000382 | Getting Started Guide - Page 30
    able to interoperate with other systems, using their services and providing services to them, particularly existing information assets, including legacy design patterns, see JRun Programmer's Guide. Dividing an enterprise application into tiers supports an enterprise application's design goals with
  • Adobe 38000382 | Getting Started Guide - Page 31
    from other tiers and often encapsulates some user interaction control. In web service scenarios, other applications take the place of the client programs, accessing a data tier. Other tiers access the data tier with a driver supporting the JDBC API, and access non-database EIS resources with J2EE
  • Adobe 38000382 | Getting Started Guide - Page 32
    whereby you can deploy server-side application logic (enterprise beans) using EJB-compliant application servers. JRun EJB support includes transaction and object persistence, and a security service to control bean access. For more information on creating EJBs, see Chapter 5, "Introduction to EJB" on
  • Adobe 38000382 | Getting Started Guide - Page 33
    • JRun server Provides the necessary services and web services to process J2EE applications containing servlets server connectors, see JRun Administrator's Guide. • Web server Receives a you can use with JRun. For a complete list of supported web servers, see Installing JRun. JRun also provides its
  • Adobe 38000382 | Getting Started Guide - Page 34
    components. JRun servers A JRun server provides the services necessary for a web server to process J2EE web servers A single installation of JRun supports multiple JRun servers. One reason to information on authentication, see JRun Administrator's Guide. Using JRun servers JRun provides utilities
  • Adobe 38000382 | Getting Started Guide - Page 35
    a UNIX platform, you must manually start each JRun server after starting your system. If you do not run JRun as a service, it runs as an application. For more information on starting and stopping a JRun server, see JRun Administrator's Guide or the JMC
  • Adobe 38000382 | Getting Started Guide - Page 36
    Using the command line You can start and stop JRun using the jrun.exe and jrun shell script command-line utilities. Use the following syntax: jrun {options} {server-name} The following table describes the options: Option -start -stop -restart -status -nohup -config path-to-jvm.config -version -
  • Adobe 38000382 | Getting Started Guide - Page 37
    .http.WebService" name="WebService"> 8000 * For more information on JRun ports, see JRun Administrator's Guide. Admin server The admin JRun server executes all the administrative applications shipped with JRun
  • Adobe 38000382 | Getting Started Guide - Page 38
    http://localhost:8200: Application Compass travel TravelNet World music Web services Programming techniques Flash gateway SmarTicket Java PetStore Description A simple online travel agent trip reservation system. This application illustrates JSP, servlet, and EJB programming and is delivered as an
  • Adobe 38000382 | Getting Started Guide - Page 39
    interfaces, supporting NES, IIS, and Apache web servers for each JRun supported hardware architecture and sends its reply to the connection module service. For example, each JRun server listens to connection and tuning parameters, see JRun Administrator's Guide. JRun Web Server JRun provides a ready
  • Adobe 38000382 | Getting Started Guide - Page 40
    for J2EE applications JRun completely supports the latest industry standards for developing J2EE applications, including the following J2EE modules: • Web applications • EJBs • Enterprise resource adapters • Enterprise applications JRun lets you deploy
  • Adobe 38000382 | Getting Started Guide - Page 41
    runs as a stand-alone tool or you can install it in your Java Integrated Development Environment (IDE). For more information, see JRun Assembly and Deployment Guide or the Enterprise Deployment Wizard online Help. JRun support for J2EE applications 27
  • Adobe 38000382 | Getting Started Guide - Page 42
    XDoclet to support the JRun-specific deployment descriptors, and provides automatic compilation and deployment. For more information, see JRun Programmer's Guide. About components, to which JRun provides a complete set of services and handles many details of application behavior automatically, such
  • Adobe 38000382 | Getting Started Guide - Page 43
    CHAPTER 3 Introduction to J2EE This chapter familiarizes you with the Java 2 Platform, Enterprise Edition (J2EE) and its related technologies. Contents • J2EE environment 30 • J2EE platform technologies 31 • J2EE APIs...33 • Additional resources 36 29
  • Adobe 38000382 | Getting Started Guide - Page 44
    , laptops, PDAs, cell phones, and other devices. Client-side user interfaces can use HTML and Java applets. J2EE also supports stand-alone Java application clients. • Middle tier Supports client services through web containers (includes Java Servlets and JSPs) and business logic components and
  • Adobe 38000382 | Getting Started Guide - Page 45
    for each component in the J2EE application and for the application itself. Container settings customize the underlying support provided by the J2EE server, including services such as security checks, transaction management, Java Naming and Directory Interface (JNDI) lookups, and remote connectivity
  • Adobe 38000382 | Getting Started Guide - Page 46
    deployment, see JRun Assembly and Deployment Guide. Containers provide all application components with The J2EE specification requires support for the following types Protocol (IIOP). • Messaging technologies Includes Java Message Service (JMS), JavaMail, and JavaBeans Activation Framework (JAF).
  • Adobe 38000382 | Getting Started Guide - Page 47
    Standard Edition (J2SE). J2SE includes the base Java support and various libraries with support for applets and applications. A J2EE compliant application standard container services, an EJB container provides a range of transaction and persistence services and access to the J2EE service and
  • Adobe 38000382 | Getting Started Guide - Page 48
    a process can be offline when a message is initially sent and respond to messages whenever it is convenient. Java Transaction API 1.0 and Java Transaction Service A transaction is a unit of work that makes a set of guarantees about its execution. For example, one guarantee is that any code executing
  • Adobe 38000382 | Getting Started Guide - Page 49
    required in the code. JavaMail 1.2 The J2EE platform includes the JavaMail API with a JavaMail service provider that application components can use to send Internet mail. J2EE includes JavaMail to support applications such as e-commerce websites for its ability to send order confirmations and other
  • Adobe 38000382 | Getting Started Guide - Page 50
    framework that extends the Java 2 platform security architecture to support user-based authorization. Java Naming and Directory Interface Java Naming and Directory Interface (JNDI) is a standard for naming and directory services. Applications rely on JNDI for looking up distributed components (EJBs
  • Adobe 38000382 | Getting Started Guide - Page 51
    CHAPTER 4 Using Servlets and JSP This chapter introduces servlet development using Java and JSPs. It highlights concepts and objects common to both environments. It includes sample code for a Java Servlet and a JSP, as well as a summary of changes in the servlet API. Contents • Using Java Servlets
  • Adobe 38000382 | Getting Started Guide - Page 52
    programming language, including portability-the "write once, run anywhere" feature of Java. Servlets are ideally suited for web-based applications because they support the HTTP request/response protocol. The following figure shows the basic processing model of a Java Servlet: As you can see in this
  • Adobe 38000382 | Getting Started Guide - Page 53
    servlet request. • Portability Using JRun, servlets adhere to the industry-standard servlet specification and are portable to any other web server that supports the servlet standard or uses JRun. Portability is important for servlet vendors because they do not have to maintain a different version of
  • Adobe 38000382 | Getting Started Guide - Page 54
    a client browser. This book describes both methods of servlet creation. JRun support for servlets One of the primary reasons to use JRun to work with ) that improve portability and better support authoring tools For more information, see JRun Programmer's Guide. 40 Chapter 4 Using Servlets and JSP
  • Adobe 38000382 | Getting Started Guide - Page 55
    example, WAR files and DTDs) The following pages introduce these objects. For detailed information about using these objects, see JRun Programmer's Guide. HTTP requests and responses Servlets are invoked when an HTTP request references the servlet, either directly as a Java Servlet, or indirectly
  • Adobe 38000382 | Getting Started Guide - Page 56
    response object before the client receives it from the server. • Change the content of the response. For more information on using filters, see JRun Programmer's Guide. 42 Chapter 4 Using Servlets and JSP
  • Adobe 38000382 | Getting Started Guide - Page 57
    the following: • Logging • Managing sessions • Tracking application server resources For more information on using event listeners, see JRun Programmer's Guide. Handling exceptions Exceptions are errors detected within your servlet. Exceptions can occur when JRun translates a JSP to a Java class
  • Adobe 38000382 | Getting Started Guide - Page 58
    client. This inability to track clients and their navigation through a website makes it difficult to do any complex transactions on a website. However, JRun supports a session object, which you can use to track a user during the entire interaction with the web server. With the session object, you
  • Adobe 38000382 | Getting Started Guide - Page 59
    You can access application information in the following ways: • In a Java Servlet, use the javax.servlet.ServletContext object. • In a JSP, use the implicit JSP application object. Accessing configuration information JRun passes configuration information to a servlet when it is initialized. This
  • Adobe 38000382 | Getting Started Guide - Page 60
    an example of a servlet written in Java. JRun also supports a second method for developing servlets that relies less on Java more information on JSP syntax and on choosing your scripting language, see JRun Programmer's Guide. When a JSP file is requested for the first time, JRun translates it into
  • Adobe 38000382 | Getting Started Guide - Page 61
    5 Introduction to EJB This chapter describes fundamental Enterprise JavaBean (EJB) elements and concepts and JRun-specific EJB features. JRun Programmer's Guide explains these features in detail. Contents • EJB Overview ...48 • Container services 49 • EJB types...49 • Using EJB in JRun 52 47
  • Adobe 38000382 | Getting Started Guide - Page 62
    . For more information, see "Container services" on page 49. An application server that supports EJBs lets Java developers concentrate on implementing semantics that describe an EJB and the services it requires. For more information, see JRun Programmer's Guide. 48 Chapter 5 Introduction to EJB
  • Adobe 38000382 | Getting Started Guide - Page 63
    or, in the case of session beans, from the bean itself. EJB supports authentication and role-driven access control. JRun 4 features a security system based on Java Authentication and Authorization Service (JAAS). EJB types The EJB specification defines three types of enterprise beans: session
  • Adobe 38000382 | Getting Started Guide - Page 64
    client on the following invocation. When used in a clustered environment, JRun supports failover by maintaining stateful session-bean state across the cluster. For more information, see JRun Programmer's Guide. Entity beans Entity beans represent objects that persist through a server shutdown. The
  • Adobe 38000382 | Getting Started Guide - Page 65
    this book includes a list of these books. For more information on EJB 2.0 support, see JRun Programmer's Guide. Support for EJB 1.1 CMP EJB 1.1 CMP support in JRun 4 is different from CMP support in earlier versions of JRun. Previously, you specified persistence information using environment entries
  • Adobe 38000382 | Getting Started Guide - Page 66
    in the jrun-ejb-jar.xml file to false. Note: JRun does not enable EJB clustering for local beans. For more information see JRun Administrator's Guide. 52 Chapter 5 Introduction to EJB
  • Adobe 38000382 | Getting Started Guide - Page 67
    , web applications, and JSP tag libraries. Many application servers are adding support for XDoclet and EJBs that are written using basic XDoclet tags, which are on using XDoclet with an EJB, see JRun Programmer's Guide. The Enterprise Deployment Wizard The JRun Enterprise Deployment Wizard
  • Adobe 38000382 | Getting Started Guide - Page 68
    54 Chapter 5 Introduction to EJB
  • Adobe 38000382 | Getting Started Guide - Page 69
    CHAPTER 6 Developing Web Applications This chapter describes the structure of a web application and how JRun processes a web application and the resources in it. It also describes how to create, package, and deploy a web application. Contents • Introduction to web applications 56 • About the web
  • Adobe 38000382 | Getting Started Guide - Page 70
    You can develop a web application using JRun and deploy the application on any other web application server that supports this specification. JRun also completely supports the latest industry standards for developing enterprise-level J2EE applications, so your web applications can take advantage of
  • Adobe 38000382 | Getting Started Guide - Page 71
    " on page 62 and "Deploying web applications" on page 65. Also, see JRun Programmer's Guide and JRun Assembly and Deployment Guide. Using web applications A single JRun server can support multiple web applications. Web applications can reference resources in other applications on the same server and
  • Adobe 38000382 | Getting Started Guide - Page 72
    About the web application directory structure The following figure shows the directory structure of a web application: The application root directory, web_app in the figure, functions as the document root for serving application files. The web_app directory is often the WAR filename. This directory
  • Adobe 38000382 | Getting Started Guide - Page 73
    . You can add directories to the application for items such as Flash SWF files, HTML files, images, and other application resources. These of web.xml, so it is not specific to JRun. All platforms that support J2EE-compliant web applications, recognize and interpret the contents of a web.xml file
  • Adobe 38000382 | Getting Started Guide - Page 74
    standard web.xml file, see the Java Servlet 2.3 specification. For more information on JRun-specific deployment descriptors, see JRun Assembly and Deployment Guide. Web applications, JRun servers, and web servers One of your tasks when developing a web application is to deploy your application on
  • Adobe 38000382 | Getting Started Guide - Page 75
    with one. For example, /compass maps request URLs that include /compass to the compass application. For more information on understanding application mappings, see JRun Programmer's Guide. Web applications, JRun servers, and web servers 61
  • Adobe 38000382 | Getting Started Guide - Page 76
    application components" on page 62. Adding web application components A complete web application can be composed of servlets, JSPs, HTML pages, Flash (.swf ) files, images, tag libraries, JavaBeans, Enterprise JavaBeans, and other application resources. As part of developing a web application, you
  • Adobe 38000382 | Getting Started Guide - Page 77
    Adding HTML pages The application root directory functions as the document root for serving application files. Add HTML pages for your application under the application root, or in any subdirectory of the application root except under the WEB-INF directory. For example, for a web application located
  • Adobe 38000382 | Getting Started Guide - Page 78
    handlers, a TLD file, Tag Extra Information (TEI) classes, and other supporting classes into a JAR file. This JAR file is typically located in WEB-INF/lib directory. For more information on tag libraries, see JRun Programmer's Guide. Adding EJBs In order for a web application to access an EJB, the
  • Adobe 38000382 | Getting Started Guide - Page 79
    -use. For more information, see JRun Assembly and Deployment Guide. Deploying a web application across a cluster JRun also automatically archive file in a cluster deploy directory. This feature does not support deploying expanded directories. The default cluster deploy directory is jrun_root/servers
  • Adobe 38000382 | Getting Started Guide - Page 80
    top level of the staging directory: jar cvf web_app.war where web_app is the web application name. For more information, see JRun Assembly and Deployment Guide. 66 Chapter 6 Developing Web Applications
  • Adobe 38000382 | Getting Started Guide - Page 81
    , JavaBeans, and EJBs. You learn how to combine these elements to produce a flexible and scalable J2EE application. In the final tutorial lesson, you use web services to access data in a JRun sample application. Servlet Tutorial...69 JSP Tutorial ...83 EJB Tutorial ...89 Web
  • Adobe 38000382 | Getting Started Guide - Page 82
  • Adobe 38000382 | Getting Started Guide - Page 83
    LESSON 1 Servlet Tutorial The following tutorial lessons show you how to develop, deploy, and run a simple J2EE application consisting of servlets, JavaServer Pages (JSPs), JavaBeans, and Enterprise JavaBeans (EJBs). In this lesson, you set up the development environment, add a JRun server for the
  • Adobe 38000382 | Getting Started Guide - Page 84
    development environment: 1 Install the following software: Software Web server Text editor JRun 4 Requirements • JRun-supplied web server (JWS) • Supported external web server (optional) • Any text editor • Java integrated development environment (IDE) • HTML editor, such as Macromedia Dreamweaver
  • Adobe 38000382 | Getting Started Guide - Page 85
    with the admin web server port number, which you can find in the jrun_root/servers/admin/SERVER-INF/jrun.xml file, in the following lines: 8000 *
  • Adobe 38000382 | Getting Started Guide - Page 86
    JMC. When adding or removing JRun servers, be aware that the servers require unique ports. For more information on understanding JRun ports, see JRun Administrator's Guide. 72 Lesson 1 Servlet Tutorial
  • Adobe 38000382 | Getting Started Guide - Page 87
    and manage server clusters. JRun automatically deploys applications to all members of the cluster and provides connector-based load balancing and failover services to ensure high availability for your web servers and JRun servers. In the following procedure, you add a JRun server for the tutorial
  • Adobe 38000382 | Getting Started Guide - Page 88
    2 Keep the default Host Name (localhost), enter the JRun Server Name for the tutorial application, tutorial, and the JRun Server Directory (added automatically when you enter the server name, {jrun.home}/servers/tutorial): The server creation process replaces the symbolic variable {jrun.home} with
  • Adobe 38000382 | Getting Started Guide - Page 89
    5 After the JMC refreshes, you see the tutorial server listed in the Available Servers table on the JMC home page and in the left pane. Start 6 Start the tutorial server by clicking its start icon. The server status changes from Stopped to Running. Deploying the tutorial enterprise application An
  • Adobe 38000382 | Getting Started Guide - Page 90
    In the JMC, you see the compass tutorial application deployed on the tutorial server: Tutorial application The following figure shows the JRun directory structure, expanded beneath the tutorial server, containing the deployed tutorial (compass) enterprise application: jrun_root tutorial jrun_server
  • Adobe 38000382 | Getting Started Guide - Page 91
    To add a new JDBC data source: 1 In the left pane in the JMC, expand the tutorial server menu, expand Resources, and click JDBC Data Sources. The JDBC Data Sources window appears: 2 In Data Source Name, enter compass. Select Pointbase Server in the Database Driver drop-down list box. Click Add. The
  • Adobe 38000382 | Getting Started Guide - Page 92
    4 Click Submit. The compass data source is added in the JDBC Data Sources table: 5 Start the compass (tutorial) database: • (Windows) Open the jrun_root/pointbase directory and double-click on compassdb.bat. • (Linux/UNIX) Run the compassdb shell script. 6 Restart the tutorial server in one of the
  • Adobe 38000382 | Getting Started Guide - Page 93
    8 Verify the application deployment by opening a web browser to the following URL: http://localhost:8101/compass/logon.jsp Note: Use 8101 or the web server port number that JRun assigned when you created the tutorial server. View the tutorial application login page: In subsequent tutorial lessons,
  • Adobe 38000382 | Getting Started Guide - Page 94
    Compass Travel J2EE application The Compass Travel tutorial application lets users browse adventure trip descriptions, booking information, and make trip reservations. You use HTML, servlets, JSPs, Java Beans, and EJBs to create the static and dynamic portions of the application. Coding the logon
  • Adobe 38000382 | Getting Started Guide - Page 95
    String firstName=""; String lastName=""; String sql= "SELECT password, first_name, last_name FROM user WHERE user_id=?"; Connection connection=null; PreparedStatement ps=null; ResultSet rs=null; boolean validLogon=false; try { InitialContext ctx=new InitialContext(); DataSource ds=(DataSource) ctx.
  • Adobe 38000382 | Getting Started Guide - Page 96
    3 Copy the following code and save it as jrun_root/servers/tutorial/compass-ear/ compass-war/WEB-INF/jrun-web.xml: true true 4 Restart the tutorial server in one of the following ways: • In
  • Adobe 38000382 | Getting Started Guide - Page 97
    LESSON 2 JSP Tutorial In this lesson, you code JavaServer Pages (JSPs) that comprise the body of the Compass Travel tutorial application. You build a JSP with embedded Java code to access database information and develop a JSP that uses a JavaBean. Contents • Creating a home page JSP 84 • Accessing
  • Adobe 38000382 | Getting Started Guide - Page 98
    Creating a home page JSP JSPs let you create dynamic pages containing a combination of HTML, Java, and scripting code. JSPs deliver high performance because the first time that a client requests a JSP, the page is translated into a Java Servlet and compiled. At runtime, you execute the compiled
  • Adobe 38000382 | Getting Started Guide - Page 99
    stmt=connection.createStatement(); trips=stmt.executeQuery(sql); while (trips.next()){ %>
  • Adobe 38000382 | Getting Started Guide - Page 100
    Accessing a JavaBean A JavaBean is a particular type of a Java class that conforms to a set of design standards specified in the JavaBean API. A JavaBean does not inherit from any particular base class or interface but must provide methods for accessing its properties. A JavaBean is different from
  • Adobe 38000382 | Getting Started Guide - Page 101
    To examine the JavaBean code: • Open the file TripBean.java located in jrun_root/servers/tutorial/compass-ear/ compass-war/WEB-INF/classes/compass and look at the following Java code: − Public class TripBean with several private fields declared − Public accessor (get) methods for all of the private
  • Adobe 38000382 | Getting Started Guide - Page 102
    4 Review the code in tripsummary.jsp, also located in jrun_root/servers/tutorial/ compass-ear/compass-war. It uses a JSP action to instantiate and reference the TripBean JavaBean to provide trip summary information: The reservation
  • Adobe 38000382 | Getting Started Guide - Page 103
    LESSON 3 EJB Tutorial In this lesson, you use EJBs to coordinate the process of booking a trip reservation, including validating a credit card payment and creating an order. You learn how to invoke an EJB from a JSP and how to write an EJB that invokes other EJBs. Contents • Using EJBs ...90 •
  • Adobe 38000382 | Getting Started Guide - Page 104
    oriented business applications using Java. An application server that supports EJBs allows Java developers to concentrate on implementing the • Message-driven beans Combine features of an EJB and a Java Message Service (JMS) listener. The following constructs are available to access an EJB:
  • Adobe 38000382 | Getting Started Guide - Page 105
    Invoking an EJB from a JSP In the next procedure, you code a JSP scriptlet to access the reservation EJB, a session bean. Then you examine the code for the remote interface, the remote home interface, and the bean's implementation class. To access an EJB from a JSP: 1 Open the file reservationaction
  • Adobe 38000382 | Getting Started Guide - Page 106
    any MM/YY in the Expiration field. Reservation.jsp displays a confirmation ID if the reservation is successful, or an error message, if a problem occurred: You often use session beans to coordinate interactions between EJBs and perform complex manipulations to accomplish tasks. You use session beans
  • Adobe 38000382 | Getting Started Guide - Page 107
    Booking a trip reservation To book a trip reservation, you must validate a credit card and create an order for the trip. The reservation EJB is a workflow session bean that coordinates the trip booking transaction. The reservation EJB calls the credit card EJB and the order EJB: • The credit card
  • Adobe 38000382 | Getting Started Guide - Page 108
    Examining the code for the credit card EJB You can review the Java source code for the credit card EJB located in the tutorial_root/ compass-ear/creditcard/compass directory. Open and look at the code in the following files: • CreditCardRemote.java This EJB has only one business method called
  • Adobe 38000382 | Getting Started Guide - Page 109
    8200. Examine the application files in jrun_root/servers/samples/compass-ear. You can proceed to the next lesson, Lesson 4, "Web Services Tutorial" on page 97, to deploy a web application that uses web services to access and book adventure trips from the Compass Travel sample application. Summary 95
  • Adobe 38000382 | Getting Started Guide - Page 110
    96 Lesson 3 EJB Tutorial
  • Adobe 38000382 | Getting Started Guide - Page 111
    Tutorial In this tutorial lesson, you deploy a web application called TravelNet that uses a web service to access and book adventure trips from the Compass Travel sample application. You can do the web services tutorial lesson without having completed the servlet, JSP, or EJB tutorial lessons in the
  • Adobe 38000382 | Getting Started Guide - Page 112
    functionality in their application. For more information on JRun web services, see JRun Programmer's Guide. TravelNet web services application In the tutorial lesson, you deploy TravelNet, a web service client application that a travel agent could use to sell and book adventure trips. TravelNet
  • Adobe 38000382 | Getting Started Guide - Page 113
    Setting up the development environment You can do the web services tutorial lesson without having completed the servlet, JSP, server Text editor JRun 4 Requirements • JRun-supplied web server (JWS) • Supported external web server (optional) • Any text editor • Java integrated development
  • Adobe 38000382 | Getting Started Guide - Page 114
    with the admin web server port number, which you can find in the jrun_root/servers/admin/SERVER-INF/jrun.xml file, in the following lines: 8000 *
  • Adobe 38000382 | Getting Started Guide - Page 115
    JMC. When adding or removing JRun servers, be aware that the servers require unique ports. For more information on understanding JRun ports, see JRun Administrator's Guide. In the following procedure, you add a JRun server for the tutorial application. Getting started with JRun 101
  • Adobe 38000382 | Getting Started Guide - Page 116
    for the tutorial application, tutorial, and the JRun Server Directory (added automatically when you enter the server name, {jrun.home}/servers/tutorial): 102 Lesson 4 Web Services Tutorial
  • Adobe 38000382 | Getting Started Guide - Page 117
    The server creation process replaces the symbolic variable {jrun.home} with the directory in which you installed JRun. 3 Click Create Server. The Port Settings window appears: Note: Make a note of the web server port number. You use it to access the TravelNet application on the tutorial server. 4
  • Adobe 38000382 | Getting Started Guide - Page 118
    :8101/travelnet/home.jsp Note: Use 8101 or the web server port number that JRun assigned when you created the tutorial server . 104 Lesson 4 Web Services Tutorial
  • Adobe 38000382 | Getting Started Guide - Page 119
    of the Java implementation class, and methodName is the name of the allowed methods. TravelNet, running on the tutorial server, consumes these web services from the Compass Travel application, running on the samples server. To examine the WSDD code: • Open the file jrun_root/servers/samples/compass
  • Adobe 38000382 | Getting Started Guide - Page 120
    WSDL file also describes the methods that you can invoke and their data types. With JRun, you can generate a WSDL document for a published web service by appending ?WSDL to its endpoint URL. In the next tutorial procedure, you generate a WSDL file from the Compass Travel application on the samples
  • Adobe 38000382 | Getting Started Guide - Page 121
    in the jrun_root/servers/tutorial/travelnet-ear/travelnet-war/WEB-INF/ classes directory. 6 Enter the following URL in your web browser: http://localhost:8200/compass/services/Reservation?WSDL The Reservation.wsdl document appears: Generating WSDL from a published web
  • Adobe 38000382 | Getting Started Guide - Page 122
    /WEB-INF/ classes directory. You use the WSDL files to generate a proxy client for the Trip and Reservation web services. Generating a web service proxy client Proxy clients invoke web service operations. A proxy client calls methods on a local proxy generated from the WSDL file for a specific web
  • Adobe 38000382 | Getting Started Guide - Page 123
    For descriptions of the WSDL2Java command-line switches, see JRun Programmer's Guide. In the jrun_root/servers/tutorial/travelnet-ear/travelnet-war/WEB-INF/classes the Axis client API to make the web service call. The class name is derived from the service binding name plus the suffix Stub. Trip
  • Adobe 38000382 | Getting Started Guide - Page 124
    using a JSP-based proxy client After you create proxy code, you must write a proxy client that invokes the target web service operations by instantiating a web service proxy object and calling its methods. In the next procedures, you create a JSP-based proxy client by performing the following steps
  • Adobe 38000382 | Getting Started Guide - Page 125
    (tripId); Tripdetail.jsp displays detailed information about the trip selected in home.jsp by invoking the getInfo method of the Trip web service provided by Compass. 3 Open the file jrun_root/servers/tutorial/travelnet-ear/travelnet-war/ reservationaction.jsp. Add the following code where indicated
  • Adobe 38000382 | Getting Started Guide - Page 126
    Number field. • Enter any MM/YY in the Expiration field. Reservation.jsp displays a confirmation ID if the reservation is successful, or an error message if a problem occurred. 112 Lesson 4 Web Services Tutorial
  • Adobe 38000382 | Getting Started Guide - Page 127
    Java proxy code. • Write a JSP-based proxy client to invoke a web service method. For more practice using web services, look at the JRun web service sample application on the samples server at http://localhost:8200. For more information on web services, see JRun Programmer's Guide. Summary 113
  • Adobe 38000382 | Getting Started Guide - Page 128
    114 Lesson 4 Web Services Tutorial
  • Adobe 38000382 | Getting Started Guide - Page 129
    architecture 52 overview 48 parts of 48 session beans 49 specification 33 XDoclet, using with 28 enterprise applications definition 19 design 16 JRun support for 18, 28 Enterprise ARchive (EAR) file. See EAR files enterprise beans 33, 48 Enterprise Deployment Wizard EJBs, using with 27, 53 starting
  • Adobe 38000382 | Getting Started Guide - Page 130
    Platform Enterprise Edition (J2EE). See J2EE Java Authentication and Authorization Service (JAAS). See JAAS Java Database Connectivity (JDBC). See JDBC Java new features 8 overview 4 programming model 19 starting and stopping 21 support for web servers 4 user types 14 web servers 25 jrun command 22
  • Adobe 38000382 | Getting Started Guide - Page 131
    server, adding 73 JSP tutorial 83 JSPs, coding 84 proxy client, generating 108 servlet tutorial 69 servlets, coding 80 TravelNet application 98 web services tutorial 97 WSDL2Java 109 U URL pattern 63 user types 14 W WAR files about 57 web applications 27, 57 web applications about 27 application
  • Adobe 38000382 | Getting Started Guide - Page 132
    118 Index
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132

Getting Started
with JRun