Advanced techniques  Debug Java components

Chapter 11: Creating CORBA Java Components

Deploy Java components

This section describes how to deploy a Java component to a server for the first time for development testing. Deployment to production servers is typically performed by exporting and importing EAServer packages, as described in “Deploying components”.

StepsDeploying Java components to EAServer

  1. Determine the Java code base directory from which EAServer will load your component’s classes. To allow refresh of the component, use the EAServer java/classes subdirectory, and add necessary classes and JAR files to the Java Classes tab in the Component Properties dialog box. See “Custom class lists for Java and EJB components” for more information.

    NoteFor security reasons, it is preferable to deploy Java components to the java/classes subdirectory or some other directory that is not accessible to HTTP downloads. See “Security considerations for deployment” for more information. Deploying to this directory also allows your component to be refreshed, and allows you to deploy classes in JAR files without mofifying the server’s CLASSPATH environment variable.

  2. Under the code base directory, copy the Java component and skeleton class files. When copying class files, preserve the package subdirectory structure.

  3. Copy other class files and JAR files that your component depends on to the same codebase. For example, you may need to copy utility classes that are in your component’s package.

Security considerations for deployment

Your application may have a potential security hole if Java component implementation classes are deployed under the EAServer html directory. An unauthorized user can implement a program that connects to EAServer’s HTTP port and downloads the component’s implementation classes. The user can then decompile the classes and gain access to potentially sensitive information such as database passwords. To close this security hole, Sybase recommends one of the following approaches:

Refreshing Java components

You can refresh a component’s implementation classes while the server is running. You do not need to shut down and restart the server. All classes that can be refreshed must be deployed under the EAServer java/classes subdirectory. Classes loaded from a different code base directory will not be reloaded. EAServer only reloads the component’s implementation class, the skeleton class, and any classes on the Java Classes tab in the Component Properties Dialog box. “Custom class lists for Java and EJB components” describes how to configure the custom class list.

StepsRefreshing a component

  1. Copy new versions of the changed class or JAR files to the EAServer java/classes subdirectory. If you are adding new classes or JAR files, you may need to add them to the custom class list as described in Chapter 30, “Configuring Custom Java Class Lists.”

  2. In EAServer Manager, select the component, or to refresh all components in a package, select the package.

  3. Choose File | Refresh from the menu.

If the property is set to false (the default is true), the component cannot be refreshed. This property must be set on the Advanced tab in the Component Properties window. See “Component properties: Advanced” for more information.

Disabling component refresh

In some cases, you may want to disable refresh for Java components. You can do so by setting the component property to false.

When refresh is disabled, all Java classes that your component depends on must be deployed under a Java code base that is specified in the server’s CLASSPATH environment variable. If the component uses classes in a JAR file, you must add the JAR file to the server CLASSPATH variable.

If you deploy your component files to the class tree that starts in the EAServer java/classes or html/classes subdirectory, they will be in the server CLASSPATH by default. If you deploy to another location, add this location to the CLASSPATH setting for the server process.

Copyright © 2005. Sybase Inc. All rights reserved. Debug Java components