When tomcat is added as a server under Eclipse thw logs are displayed on the console and it never comes under the logs of tomcat neither in eclipse workspace.
It can be configured to do so by
Double Clicking the newly added server in the Servers menu
1. In General Information
Click Open Launch Configurations - >
-> Add the required arguments in the argument tab ,
-> and in the Common tab you can mention weather the output the to be on the console or piped int o any other log file ion the disk.
Refer this to enable JULI logging on the Server Instance
http://wiki.eclipse.org/WTP_Tomcat_FAQ#How_do_I_enable_the_JULI_logging_in_a_Tomcat_5.5_Server_instance.3F
2. In the Server Location - you can choose User Tomcat Installation which will take control on the tomcat installation directory and all application under it will also be deployed
Tuesday, April 7, 2009
Configuring Logging for Tomcat on Eclipse
Enabling Access Logs on Tomcat 6
Tomcat 6 has a new feature which logs access logs. This can be easily enabled by uncommenting the required code in the conf/server.xml.
<valve classname="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="common" resolvehosts="false">
</valve>
This can be embedded for the Host or per context basis
Tuesday, March 31, 2009
Using Spring Container to instantiate Struts Action Classes
In Spring ApplicationContext.xml add this
<bean id="personAction" scope="prototype" class="quickstart.action.PersonAction">
<constructor-arg ref="personService">
</constructor-arg>
This is the instance of the action class which needs to be created .
In Struts struts.xml add this
<constant name="struts.objectFactory" value="spring">
This ensures the struts spring integration
Add this also
<action name="xxx" method="yyy" class="personAction">
<result>pages/list.jsp</result>
<result name="input">pages/list.jsp</result>
</action>
In the above configuration, in the class field the name of the spring bean is
directly mentioned.
By doing so the spring container creates the action class instance for struts which is a prototype.
An other alternative to do the same is using Aspect J Weaving.
Monday, March 23, 2009
LightStreamer - Server Push Technology
Lightstreamer is a scalable and reliable Server for pushing live data to Rich Internet Applications
Based on the AJAX-Comet paradigm, it streams real-time data to any Web browser, without installing anything on the client. Both HTML and Flex applications can receive live data from Lightstreamer, as well as traditional thick clients.
Lightstreamer is a “Push Engine”, i.e. a server software that is able to push (or stream) any textual data in real-time to any types of clients across the Internet. Lightstreamer hides all the complexity of pushing data in a scalable, efficient, reliable and portable way.
Lightstreamer is useful for any application that requires the efficient delivery of real-time data through the Internet. Examples of possible applications include: financial market data distribution (stock quotes, news); online betting and gaming; live bids for e-auctions; Web-based monitoring consoles; online communities with live user interaction (messaging, chat, presence).
LightStreamer runs as a separate process which stays connected with the client to push data.The technology behind this is once the client page completes its refresh a final request is sent from the client to the lightstreamer server which is held without sending a response.The response is sent only when the item which is displayed on the client has been updated on the server.
Sample HelloWorld Program :
http://www.lightstreamer.com/r/hello-cometdaily
Saturday, March 21, 2009
Protobuf - Data Interchange Format
It is a language-neutral, platform-neutral, extensible way of serializing structured data for use in communications protocols, data storage etc
Protocol Buffers are a way of encoding structured data in an efficient yet extensible format.Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats.
You define how you want your data to be structured once, then you can use special generated
source code to easily write and read your structured data to and from a variety of data streams
and using a variety of languages
You specify how you want the information you're serializing to be structured by defining protocol
buffer message types in .proto files. Each protocol buffer message is a small logical record of
information, containing a series of name-value pairs.Once you've defined your messages, you run
the protocol buffer compiler for your application's language on your .proto file to generate data
access classes.
These data access classes can be in any of the languages such as C , Java ,Python etc.These provide simple accessors for each field as well as methods to serialize/parse the whole
structure to/from raw bytes. These generted classes can be shipped along with any client where
serialisation or deserialsation is required.
You can even update your data structure without breaking deployed programs that are compiled
against the "old" format.
Protocol buffers have many advantages over XML for serializing structured data.
Protocol buffers:
* are simpler
* are 3 to 10 times smaller
* are 20 to 100 times faster
* are less ambiguous
* generate data access classes that are easier to use programmatically
Ref : http://code.google.com/p/protobuf/
Java DataBases - Derby(Java DB) & HSQLDB
These are those two 100% Java databases, Derby and HSQLDB.
Apache Derby is developed as an open source project under the Apache 2.0 licence.
Derby was previously distributed as IBM Cloudscape.It is currently distributed as
Sun Java DB and comes packaged along with Java.
HSQLDB (Hyperthreaded Structured Query Language Database) is a relational database
management system written in Java.
Derby aims to be a fully functional relational database, and as such could be considered
as an alternative to "grown up" databases like Oracle and MySQL in some cases.
HSQL is more like a "toy database", providing a subset of the features of a fully
functional databases. But that subset of functionality may be all you need.
Benefits of HSQL over Derby.
- light weight (smaller libraries, less complex)
- supports in memory databases
- Simple to use
Benefits of Derby over HSQL
- much larger development community
- secured future (is part of JDK, is sponsored by IBM and Sun)
- More complete feature set (e.g. proper handling of transactions, encryption...)
- Scalability
- Performance with large Data Set
Memory Use
Derby is setup like a traditional database system where data is stored
on disk and a subset of that data is cached in a buffer cache or pool.
HSQL by default uses MEMORY tables (for standard CREATE TABLE
statements), this always stores the entire data in memory. Thus this is
fast, but obviously consumes memory. It is useful to look a process
sizes as well as absolute times when running benchmarks.
Ref:
http://hsqldb.org/
http://db.apache.org/derby/
http://developers.sun.com/javadb/
SQLite - LightWeight DB
SQLite is a software library that implements a self-contained, serverless,zero-configuration, transactional SQL database engine.It is opensource.
It is used by Firefox,Adobe,google,Microsoft etc
SQLite is different from most other SQL database engines in that its primary design goal is to be simple:
* Simple to administer
* Simple to operate
* Simple to embed in a larger program
* Simple to maintain and customize
It has Zero-Configuration, is Server Less ,Single Database File ,Stable Cross-Platform Database
File and gives easy user friendly APIs to write into and access from the database.
Situations Where SQLite Works Well
Embedded devices and applications
Websites
Replacement for ad hoc disk files
Low Concurrency
SQLite home page http://www.sqlite.org
.jpg)