Welcome!

IBM Cloud Authors: Elizabeth White, Yeshim Deniz, Pat Romanski, Liz McMillan, Stefan Bernbo

Related Topics: IBM Cloud, Microservices Expo

IBM Cloud: Article

Developing Java and Web Services Applications on Rational Application Developer V6

How to Use Rational Application Developer 6

Free form: You can also use WRD to reduce the complexity of application construction. In this scenario, instead of providing a fully-constructed J2EE application, you place in a directory the individual parts of the application, such as Java Source files that represent Servlets or EJBs, static resources, XML files, and so on. You then configure WRD to construct a J2EE compliant application and deploy that application on a target server. Free form is ideal for initial prototyping of applications or development of library code. However, use caution when using free form development for enterprise applications. Developers can quickly lose control of their build and deployment process. Here is an example of using free form:

  • Configure the WRD workspace:
  1. export WORKSPACE=D:/WRDWorkSpace
  2. $WAS_HOME/bin//wrd-config -project "MyProject" -style "freeform" -runtime "was60" -runtimePath "D:/WebSphere_60/AppServer" -monitor
  • Start the WRD daemon: $WAS_HOME/bin/wrd -monitor
  • Create a Java Servlet or EJB class in the directory using any editor.
For more information on WRD, see the WebSphere V6 Information Center.

Here is an example of the code. These were the only artifacts developed.

HelloServlet.java


package com.wrdtest;

import java.io.*;

import javax.naming.InitialContext;

import javax.servlet.http.*;
import javax.servlet.*;

public class HelloServlet extends HttpServlet {

public void doGet (HttpServletRequest req,
HttpServletResponse res) throws ServletException, IOException {

PrintWriter out = res.getWriter();
try {
InitialContext ctx = new InitialContext();
HelloHome helloHome = (HelloHome)ctx.lookup("ejb/Hello");
HelloRemote hello = helloHome.create();
out.println("Hello, world!");
out.println(hello.getMessage());
out.close();

} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace(out);
out.close();
}

}
MyService.java

package com.wrdtest;

/**
* @author Admin
*
*@ejb.session name="Hello" type="Stateless"
*jndi-name="ejb/Hello"
*local-jndi-name="ejb/Hello"
*/
public class MyService {

/**
*
* @param symbol
* @return
* @throws StockException
*
* @ejb.interface-method view-type="both"
* @ejb.transaction type="Required"
*
*
*
*/
public String getMessage()
{
return "Hello EJB";
}

}
Question: I am working with RAD and WebSphere 6.0. I want to deploy an EAR file with log4j, but an error appears during deployment. What is wrong? The log4j.xml is in the ear file.

[7/25/05 17:39:54:269 CEST] 00000062 ResourceMgrIm I
WSVR0049I: Binding ENT13000 as jdbc/ENT13000
[7/25/05 17:39:54:284 CEST] 00000062 EJBContainerI I
WSVR0207I: Preparing to start EJB jar: TDSLRechercheEJB.jar
[7/25/05 17:39:54:312 CEST] 00000062 EJBContainerI I
WSVR0037I: Starting EJB jar: TDSLRechercheEJB.jar
[7/25/05 17:39:54:904 CEST] 00000062 MDBListenerIm I
WMSG0058I: Listener Port ListenerPortNI will attempt to restart in 60 seconds
[7/25/05 17:39:54:937 CEST] 00000062 ApplicationMg E
WSVR0101W: An error occurred starting, TDSLRechercheJ2EE
[7/25/05 17:39:54:945 CEST] 00000062 ApplicationMg A
WSVR0217I: Stopping application: TDSLRechercheJ2EE
[7/25/05 17:39:54:988 CEST] 00000062 EJBContainerI I
WSVR0041I: Stopping EJB jar: TDSLRechercheEJB.jar
[7/25/05 17:39:55:034 CEST] 00000062 ApplicationMg A
WSVR0220I: Application stopped: TDSLRechercheJ2EE
[7/25/05 17:39:54:770 CEST] 00000062 SystemErr
R log4j:ERROR Could not open [./log4j.xml].
[7/25/05 17:39:54:773 CEST] 00000062 SystemErr
R java.io.FileNotFoundException: ./log4j.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at org.apache.log4j.xml.DOMConfigurator.doConfigure
(DOMConfigurator.java:583)
at org.apache.log4j.xml.DOMConfigurator.configure
(DOMConfigurator.java:687)
at com.tsystems.blt.j2ee.log.TDSLRechercheLogger.<clinit>
(TDSLRechercheLogger.java:17)
at com.tsystems.blt.j2ee.jms.MP_MessageListenerBean.<clinit>
(MP_MessageListenerBean.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0
(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance
(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at com.ibm.ejs.container.EJSContainer.loadBeanMetaData
(EJSContainer.java:1596)
at com.ibm.ejs.container.HomeOfHomes.loadBeanMetaData
(HomeOfHomes.java:659)

Answer: I assume you are packaging the log4j.jar at the EAR level. It seems you are trying to load your logging configuration directly from the file system. I usually tell people to load the log4j configuration file as a classpath resource. This way, you can put it in a WebSphere Application Server shared library or package it in the EAR. You can use something like:

ClassLoader.getSystemResourceAsStream()

Or, you can load a system property with the location of the configuration file.

Acknowledgements
The author would like to thank the following people for their help in preparing this article: Kyle Brown, Keys Botzum, Leigh Williamson, Tom Alcott, and Greg Flurry

More Stories By Roland Barcia

Roland Barcia is a consulting IT specialist for IBM Software Services for WebSphere in the New York/New Jersey Metro area. He is the author of one of the most popular article series on the developerWorks WebSphere site, www-106.ibm.com/developerworks/websphere/techjournal/0401_barcia/barcia.html, and is also a coauthor of IBM WebSphere: Deployment and Advanced Configuration. You can find more information about him at http://web.njit.edu/~rb54

Comments (3)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...
Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (November 12-13, 2018, New York City) today announced the outline and schedule of the track. "The track has been designed in experience/degree order," said Schmarzo. "So, that folks who attend the entire track can leave the conference with some of the skills necessary to get their work done when they get back to their offices. It actually ties back to some work that I'm doing at the University of San...
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...
Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...
If a machine can invent, does this mean the end of the patent system as we know it? The patent system, both in the US and Europe, allows companies to protect their inventions and helps foster innovation. However, Artificial Intelligence (AI) could be set to disrupt the patent system as we know it. This talk will examine how AI may change the patent landscape in the years to come. Furthermore, ways in which companies can best protect their AI related inventions will be examined from both a US and...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
Chris Matthieu is the President & CEO of Computes, inc. He brings 30 years of experience in development and launches of disruptive technologies to create new market opportunities as well as enhance enterprise product portfolios with emerging technologies. His most recent venture was Octoblu, a cross-protocol Internet of Things (IoT) mesh network platform, acquired by Citrix. Prior to co-founding Octoblu, Chris was founder of Nodester, an open-source Node.JS PaaS which was acquired by AppFog and ...
The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...
Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...