Solved

Basic Question: Dynamic Java Classloading

Posted on 2010-11-13
4
443 Views
Last Modified: 2012-05-10
Hi there,

i have a basic question, because i'm a java beginner:
Im working on a web project and my servlet needs to access some data from some "information-provider".
I want to write my servlet independend to the information-provider so i'm building a "info-bridge" bean which implements an interface.

I want to use an XML file, where i can configure what "info-bridge" java bean should be used (a bit like the spring-bean config stuff).

So i have the following XML:
<config>
  <information-interface class="myJavaPackage.myProject.bridges.provider1Bridge" />
<config>

What is the best way to load the class from my servlet? Is it Java Reflection or is there any other technique (because i read that java reflection is not very fast) or is there maybe any built-in feature of apache tomcat? What is common??


thx for your help and best regards
manuel
0
Comment
Question by:mesX
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
Comment Utility
Reflection is fine - you shouldn't have to load the class very often anyway
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
Comment Utility
0
 

Author Closing Comment

by:mesX
Comment Utility
Thx for your quick responses and Tips!


regards!
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
:)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 84
java set up 1 44
unix in java example 9 36
eclipse package explorer vs project explorer view 2 27
Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now