Weird tomcat problem (class reloading)

i have very weird problem with tomcat 3.2.3.
for example i have html page which calls servlet.
everything is fine when i start tomcat. now when i
recompile servlet and try to call it again, this is
what i get:
Internal Servlet Error:
java.lang.IllegalStateException: Can't happen -
classname is null, who added this ?
     at
org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:261)what kind of error is this and what causes it? it
happens even if i try to refresh html page after
compiling.
is there any way to fix this because it is realy
tiring to restart tomcat each time i recompile
servlet.
thanx for help

Tomcat has to be restarted after recompiling any
servlet-class that was already invoked by tomcat.It's
the price you have to pay for a free server.
I think that this is not right. You can specify that an application context is "reloadable" in the server.xml file. This means that the servlet classes will be reloaded if the servlet has changed. This doesn't work for regular classes such as beans because they use a different class loader. (But Tomcat 4.0 is supposed to have something like this.) So just specify your servlets in web.xml and make sure reloadable="true" in the context in server.xml.

Similar Messages

  • Weird Tomcat Problem -

    I know this is not a tomcat forum, but have always been able to find help with issues @ forum.java.sun.com.
    So here's my problem on Apache Tomcat/5.5.4:
    I'm in the process of switching web-site to another host and during testing, I'm getting the following:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    Only a type can be imported. xxx.yyy.ZxxxZxxxZxxx resolves to a packageIf I refresh page, then the jsp get's complied. If I refresh again, then maybe complied or maybe not complied.
    Code/site works fine on other host(except horrendous host up-time) and internally.
    Any suggestions would be great.
    Thanks.

    Is xxx.yyy.ZxxxZxxxZxxx a package like the error suggests? If so, try xxx.yyy.ZxxxZxxxZxxx.* if not then no clue....

  • Stupid weird tomcat problem...

    what does this mean? i'm at the end of the road with tomcat, it works when i first install it, but after restart it gives me this crap, i'm going mad about it and need help, plz spend a few seconds helping me...
    error:
    Catalina.start: LifecycleException: null.open: java.net.BindException: Address
    already in use: JVM_Bind:8080
    LifecycleException: null.open: java.net.BindException: Address already in use:
    JVM_Bind:8080
    at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConne
    ctor.java:1130)
    at org.apache.catalina.core.StandardService.initialize(StandardService.j
    ava:454)
    at org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
    a:553)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:780)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
    ----- Root Cause -----
    java.net.BindException: Address already in use: JVM_Bind:8080
    at org.apache.catalina.connector.http.HttpConnector.open(HttpConnector.j
    ava:950)
    at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConne
    ctor.java:1128)
    at org.apache.catalina.core.StandardService.initialize(StandardService.j
    ava:454)
    at org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
    a:553)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:780)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

    Ok here's the list of ports i get:
    C:\>fport /i
    FPort v2.0 - TCP/IP Process to Port Mapper
    Copyright 2000 by Foundstone, Inc.
    http://www.foundstone.com
    Pid Process Port Proto Path
    8 System -> 1027 TCP
    8 System -> 139 TCP
    8 System -> 445 TCP
    396 svchost -> 135 TCP C:\WINNT\system32\svchost.exe
    452 tomcat -> 5252 TCP E:\Apache_Tomcat\bin\tomcat.exe
    452 tomcat -> 8008 TCP E:\Apache_Tomcat\bin\tomcat.exe
    452 tomcat -> 8009 TCP E:\Apache_Tomcat\bin\tomcat.exe
    784 MSTask -> 1025 TCP C:\WINNT\system32\MSTask.exe
    1320 msmsgs -> 10581 TCP C:\Program Files\Messenger\msmsgs.exe
    1348 loadqm -> 1187 TCP C:\WINNT\loadqm.exe
    8 System -> 137 UDP
    8 System -> 138 UDP
    8 System -> 445 UDP
    220 services -> 1026 UDP C:\WINNT\system32\services.exe
    232 lsass -> 500 UDP C:\WINNT\system32\lsass.exe
    396 svchost -> 135 UDP C:\WINNT\system32\svchost.exe
    1320 msmsgs -> 1190 UDP C:\Program Files\Messenger\msmsgs.exe
    1320 msmsgs -> 1191 UDP C:\Program Files\Messenger\msmsgs.exe
    1320 msmsgs -> 9837 UDP C:\Program Files\Messenger\msmsgs.exe

  • Dynamic class reloading in modular web application

    Hi.
    My web application has these requirements:
    A. Functional modularization (like plug-ins). Modules will be simple jars containing application logic classes: dto beans, business logic services, dao (jpa), framework stuff (Struts2), etc...
    B. At runtime and without restarting the application "class loading" must be aware of classes inside new, changed and removed modules.
    C. Some of these jars will be outside the web application folder (WEB-INF/lib), possibly outside the container itself too.
    My question:
    1. Can I achieve all or some of my requirements with a Java web application?
    2. How should I manage the modules?
    3. Do I need some special web container feature (maybe osgi)?
    4. Can I use a custom class loader in my application?
    The architecture objectives are:
    I. Provide scalability.
    II. Efficient development process (independent deployment and no application restart required).
    III. Better production support (no application restart required for changes).
    More on the architecture:
    a). Functional scalability, meaning this that my application may functionally grow up to an indeterminate number of small functional modules.
    b). Modules will be developed, deployed and maintained independently so the application discovers and loads classes on demand.
    c). Avoid a big .war file containing all the small modules because a small change in one module would involves deploying all the other modules (possibly hundreds o even thousands of them) and restarting the application.
    d). Above point involves dynamic class reloading.
    I guess this is addressed by OSGI (looks like heavy to deal with), Jigsaw (still under development) and maybe others. I think the key point is the class loader. I will develop a custom class loader but maybe you have some advice for me before starting to develop.
    Thanks and regards.

    Classes maintained by the container should not be loaded by an application. You want the container to read those classes and react accordingly. Most of those classes are read when the container starts up a container restart will be required. Trying to leverage another container within a container does not sound like it will be worth (if you can get it to work).
    Perhaps you should state the problem that you are trying to solve with these modules so that others may suggest more feasible solutions to achieve your target goals.

  • Dynamic Class Reloading

    As I know that setting has to be made to the application server to enable the class reloading features, so that the changes to the components (such as enterprise beans, servlets, and JSP files) to a running server can be deployed without having to stop the application server process and start it again.
    I'm just wondering, for those Web Hosting Company that offer JSP-compatible Web Servers services, are they forced to have the Class Reloading Feature enabled for their Web Server?? else how they can provided 7 x 24 service, as no downtime are allowed, please advise?

    "... else how they can provided 7 x 24 service, as no downtime are allowed, please advise?"
    Most large organisations wishing to redeploy an application but maintain service would not use class reloading (which would be a path to chaos!) but would use their load balancers or clustering software to disable connections to some (half?) of their servers. They'd then load the updated software onto the out-of-service servers, swich the live traffic onto them and then update the remaining servers before bringing them back into service.
    This kind of redeployment can also be achieved by running more than one instance of the app server on each box, with only one instance 'live' at any one time. Updates are made to the off-line instances and then connections redirected to them. This has the advantage that the old code is still in place so fall-back is easy if there's a problem with the redeployed code.

  • Weird internet problem / ssl connection error, site loads in safari not in firefox or other way around

    I really can't figure out this problem. Search the internet tried all kinds of things, nothing help so far.
    I have a Macbook Pro (Lion originally installed) running on Mavericks (all latest updates). SSD installed and the DVD tray is replaced by the original HDD.
    The laptop wasn't running very smooth anymore so decided to give it a fresh Mavericks install (even though I know it's not really necessary for mac, it helped, everything is much faster except a weird internet problem came up).
    After freshly installing Mavericks I couldn't get into my google account anymore, just wouldn't load. Tried Safari (use this normally) and Firefox and Chrome, this last was gave a SSL connection error, both Safari and FF said the website couldn't be loaded because the server didn't respond. For Gmail I use Mailplane which is just stuck on a white page. I tried repairing the keychain, repaired disk and disk permissions, cleaned browsers, turned off firewall and antivirus (Shopos) started in safe mode, checked time settings which were all good. Nothing of this helped. I even ended up creating a usb bootdisk for Mavericks, formatted the disk and reinstalled from the start just Mavericks and nothing else, started Safari, still the same problem. As even this didn't help I figured it's not worth reinstalling all software so put back my backup.
    Now I ended up somehow only being able to use Gmail normally in Firefox, Chrome still gives SSL error and Safari can load the inbox, but I can't open any messages. I get the error there is a problem with the connection. If I try in Basic HTML mode it surprisingly does work.
    You would say, just use Firefox, finished...but the thing is that sometimes random websites won't load in Firefox, when I load the same site in Safari it works perfectly.
    O yes, I also tried the connect to my iPhone and use the Cellular data network, then it's no problem using Gmail in Safari normally. You would say it's a router problem, but I have another Macbook Pro (just one model later running Mountain Lion) this one works perfectly with every browser. Also my iPhone does everyting logged into the WiFi network.
    You can understand I really have no clue what's going on here, I don't see any logic. I can only think of a hardware problem in my Macbook, but don't see how that could cause these problems.
    I hope someone is ably to help me ?

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your documents or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this behavior; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Please take this step regardless of the results of Step 1.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of Steps 1 and 2.

  • Error in problem  class important

    Hi Gurus,
    we are facing problem while activating the transferstructure
    when are activating using the program:
    RS_TRANSTRU_ACTIVATE_ALL
    we are getting
    error in problem class important.
    All Thaughts are considered.
    Regards,
    Ajay.

    Need tyo make sure the problem is with the query/workbook are general issue with all workbooks/query.
    1. Make sure the base query of work book is still executable. RRMX/RSRT.
    2. Execute the work book in Bex/Excel and look for definition of workbook; there might be some thing in the workbook referencing other than base query.
    3. If other workbook are also not working? need to check if other users have same issue.?
    Hope this will help to narrow the problem.
    Gopi

  • Problem class important error while executing Query from favorites

    Hi Experts,
    1. I have tried execute the query from favorites it is showing the error message. " Problem class important"
        In the message text: logs showing error message [Attached the message screenshot].
    2. From "Query Designer" Execute [Ctrl+R] gives the error "500 Internal Server Error" [Attached the screenshot]
    3. Able to execute the reports from RRMX.
    No ST22 dumps. Can any one suggest about...how to rectify the errors.
    Thanks in advance...Surya

    Need tyo make sure the problem is with the query/workbook are general issue with all workbooks/query.
    1. Make sure the base query of work book is still executable. RRMX/RSRT.
    2. Execute the work book in Bex/Excel and look for definition of workbook; there might be some thing in the workbook referencing other than base query.
    3. If other workbook are also not working? need to check if other users have same issue.?
    Hope this will help to narrow the problem.
    Gopi

  • Weird audio problem during calls

    I have a weird audio problem and was wondering if anyone else has had a similar problem or could help...
    My wife and I both have iPhone 5's and sometimes (not all the time) when she calls me (or I call her), it connects, but no matter which audio input I choose (phone, bluetooth, speaker, headphones), I cannot hear her, but she can hear me... I hang up, call back (and when I call, there is no dialing sound, nor any other phone sounds) and it's the same thing. Sometimes restarting the phone works, other times I have to restart it 3-4 times before it'll work again.  I try different things during these calls, like turning on/off bluetooth and/or wifi (pretty much anything I can think of that would make a difference), but nothing seems to help.
    The (other) weird part is that after the last time of this happening, I tried calling my iPhone with my office phone and it worked fine, so then I immediately call my wife back with my iPhone and it was doing the same thing again. I called her back using my office phone and could talk to her fine...
    This problem has been going on for a few months now and I have tried restoring the phone a couple times (and I am on the latest iOS) and sadly, that hasn't done anything to help... Does anyone have any ideas what is going on? I'd make an appointment for the problem, but since it doesn't do it all the time, I don't know what good it would do... But it is getting very frustrating!
    Thanks for any help!
    -Jason

    Thanks for the response!  It happened again yesterday...  It seems to be happening more frequently in the past few weeks now.
    I checked the link and have tried all of the things listed at one point or another over the past few months.  I did just check my Carrier settings and it said it had updated (it's on 14.1), but I am not sure when that happened (could have been today, could have been after my last restore last week, not sure).  I'll keep my fingers crossed that maybe that fixed it...
    If it continues to act up, would you recommend that I bring the phone in to an Apple store or an AT&T store?  I bought the phone through Apple, but my carrier is AT&T (and if you suspect that the problem may be with the cellular conection), maybe the AT&T store would be the better choice?
    I really wish the problem would be more consistant or go away, cause trying to get the problem solved is driving me crazy!

  • Slooow internet and weird mouse problems?

    I recently upgraded my iMac to Leopard (10.5.4) and started having weird mouse problems. At start up, mouse would be frozen in upper left corner. I'd restart, switch mice, restart, over and over. I use a Wacom tablet w cordless mouse plus Apples alum cordless keyboard. Eventually I tried switching USB ports for my Wacom tablet and the mouse was OK. I have learned that when this problem occurs, I need to shut down and unplug everything. That seems to solve it. Anyone know why? ALSO, ever since upgrading I have found the Internet to be appallingly slow. I have 2 GB memory and just upped my internet speed (supposedly) through Embarq.

    hmm, what is a mouse usb or a keyboard usb?
    arent all the usb ports same?
    I really wish to show you how this happens it is really fun, but also annoying. especially when I am playing a game. it is interesting to watch the screen when suddenly all the world starts rotating when you are playing a first person shot'm up.

  • Guru question, class reloading, resolved symbols

    How can I determine all of the class symbols that get
    resolved in a java class file? I want this from java, the
    utility javap doesn't really fit the bill since it doesn't
    give me the information I want.
    BACKGROUND
    I'm creating a class reloader which loads many packages. In order to get the reloading effect, a new
    class loader must be instantiated...which is fine. The usual approach is to reload every class on the class path, but this is too time consuming. I would like to
    be more elegant and only reload the minimum set of class files and delegate appropriately.
    In order to do this I need need to know all of the symbols used by a particular class. For example,
    if a class ABC has a method that uses class XYZ, and
    XYZ gets modified to be XYZ'. I need to reload ABC if
    I reload XYZ', otherwise ABC will use XYZ. This is
    behavior spec'ed in JVM class loader spec (5.3).
    The JVM spec also outlines the format of the
    class file, but I really don't want to parse this myself.
    Are there any utilities to facilitate inspecting class
    files and getting this kind of information.

    The usual approach is to reload every class on the class path...Huh? I was rather certain that classes were loaded as needed, not as found.
    I need to reload ABC if I reload XYZ', otherwise ABC will use XYZ.
    This is behavior spec'ed in JVM class loader spec (5.3).I don't understand this either. You can't 'reload' XYZ. You can load a different class. Or you can use a different class loader and load the a class with the same name (although the jvm will treat it as a different class.) Or you can wait for the jvm to collect the class loader (which means no instances of XYZ at a minimum) and then load what ever you want. Reloading to me suggests that you are some how replacing the existing class and that can't happen.
    If the only reference in ABC is a method (local and not static) then I don't believe the class will be loaded until the method is called.
    Whatever class loader loaded ABC and XYZ will not be gc'd until there are no instances of the classes it loaded. So if both use the same class loader then by definition when you load ABC, when you get a chance to load XYZ you can do whatever you want.
    So, given the above, I am not sure I understand the question.

  • KT6V Weird boot problems

    Hi..
    I'm having this weird boot problem (and no it doesn't seem to be the standard one)
    OK..
    I have the following :
    AMD Athlon 2000+
    KT6V LSR mainboard
    2x 256 Crucial PC2700 memory
    IDE Hard Disk (120gb segate)
    Creative 5700ultra Graphics card (AGP)
    Cd Rom
    Chieftec 400w PSU
    WinXP Pro
    If I set my CPU FSB to 100mhz (everything else on auto).. win Xp pro boots fine and all is pretty good except that my chip is now seen as a lowly 1.25ghz..
    If I then set my CPU FSB to 133 or 166 then the machine boots (ie it beeps etc..).. starts to load windows xp (I get the logo and that's when the problem happens)  and either black screens (ie.. nothing and the monitor turns off) or blue screens with the windows message saying that windows has detected a hardware fault and has halted the system..
    I know my memory, chip, heatsink etc all work because just over an hour ago they all worked fine in my KT3 ultra.
    What is going on as I've tried almost everything to try and solve this, with the only option to set the FSb to 100mhz which is incorrect for my CPU.
    How do I fix this.
    I've looked through the forum but this is not the same problem as simple reboots.. this is weird.
    If I can't fix this then I guess it'll be send it back.. which is a shame because I like MSi motherboards.
    Thanks
    Slippery

    Hi..
    I've checked the CPU heatsink.. and nothings wrong !
    (Can't check the voltage but I know the PSU is Ok as I did run it in a custom case with 4 Cd writters, 4 HDs, loads of lights etc.. before I moved to this new plain case tonight)
    What's weird is that set at 100FSb it's fine but at 133 or 166 it just crashes after the loading XP logo is displayed. Up until that point it's all fine.
    But why does it run Ok at 100mhz and not 133mhz ?
    Please help..  before I end up fixing this with a hammer !
    Thanks
    Slippery

  • Problem on reload a JSP file in Tomcat 3.3.1

    I have a problem about Tomcat 3.3.1
    I am developing a JSP application,
    but Tomcat not recompile the JSP file after i modify it.
    I need to "wait" the tomcat recompile it, so i can see the change.
    This make the development really difficult...
    Do I miss some important step on config Tomcat 3.3.1
    how to force it to detect a newer version JSP in every request ??
    Thanks

    I believe there is a way to configure Tomcat to do this, but I don't know what it is.
    Until someone can tell you the configuration steps, here is a workaround. Tomcat keeps the Java source and class files for your JSP code somewhere under its "work" directory. Find those files and delete them, which will force it to re-compile.

  • MySQL connection pooling (tomcat) problem

    Hi all i just started learning servlets and i want to make a program in order to understand database connection pooling in tomcat.My problem is that when i run the servlet i created i get this error :
    java.lang.NullPointerException org.DB.TestDB2.doGet(TestDB2.java:105) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    And that from tomcat log from netbeans :
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 
    .I configured tomcat server.xml file like this :
    <Context path="/DBTest" docBase="DBTest"         debug="5" reloadable="true" crossContext="true">   <Resource name="jdbc/phonebook_db" auth="Container" type="javax.sql.DataSource"               maxActive="100" maxIdle="30" maxWait="10000"               username="*******" password="********" removeAbandoned="true"               removeAbandonedTimeout="120" driverClassName="com.mysql.jdbc.Driver"               url="jdbc:mysql://localhost:3306/test_phonebook_db?autoReconnect=true"/> </Context>   
    This is the resource reference i have in my web app web.xml file :
    <resource-ref>       <description>DB Connection</description>       <res-ref-name>jdbc/phonebook_db</res-ref-name>       <res-type>javax.sql.DataSource</res-type>       <res-auth>Container</res-auth>   </resource-ref> 
    And this is my servlet class :
    package org.DB;  import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import javax.naming.*; import javax.sql.*; public class TestDB2 extends HttpServlet { private Connection conn ; private Statement stat ; private ResultSet rs ; private int counter; private Object rsValue; public void init() {     try {             InitialContext ctx = new InitialContext();             DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/phonebook_db");             conn = ds.getConnection();             }         catch(Exception e) {               e.printStackTrace();         }     }     public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {         try {           stat = conn.createStatement();           rs = stat.executeQuery("SELECT * FROM phones_table");            } catch (SQLException sqle) {         sqle.printStackTrace();         }      response.setContentType("text/html; charset=utf-8");     PrintWriter out = response.getWriter();         String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " + "Transitional//EN\">\n";     out.println(docType +"<HTML>\n" + "<HEAD><TITLE>PhoneBook entries</TITLE></HEAD>\n");         counter = 0;     try {         while (rs.next()) {             out.println("<h4>Entry no. " + (++counter) + "</h4>");             out.println("<table width=\"75%\" border=\"1\">");             out.println("<tr>\n"+ "<td width=\21%\"><b>LastName:</b></td>\n"+ "<td width=\"79%\">");             out.println((((rsValue = rs.getObject("LASTNAME"))==null || rs.wasNull())?                 "":(rsValue.toString())));             out.println("</td>\n</tr>\n" +  "<tr>\n"+                     "<td width=\21%\"><b>FirstName:</b></td>\n"+ "<td width=\"79%\">");             out.println((((rsValue = rs.getObject("FIRSTNAME"))==null || rs.wasNull())?                 "":(rsValue.toString())));             out.println("</td>\n"+ "</tr>\n"+                     "<td width=\21%\"><b>Phone:</b></td>\n"+ "<td width=\"79%\">");             out.println((((rsValue = rs.getObject("PHONE"))==null || rs.wasNull())?                 "":(rsValue.toString())));             out.println("</td>\n" + "</tr>\n" +                     "</table>\n"+ "<br>\n<br>");         }     } catch (SQLException sqle) {         sqle.printStackTrace();     }     out.println("</body>\n"+             "</html>"); } public void destroy() {     try {         rs.close();         stat.close();         conn.close();     } catch (SQLException sqle) {         sqle.printStackTrace();         }     } }{code} Any suggestions?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thank you for your answer.Yes my servlet class is something more worse than horrible(i don't use the database connection correct i don't use the MVC pattern i use out.println() ) but i just tried to take a ready example and try to understand .So i write this servlet myself as a starting point :
    package org.DB;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    import java.sql.*;
    public class DBServlet extends HttpServlet {
        private Connection conn ;
        private Statement stat ;
        private ResultSet rs ;
        private int counter;
        String driver = "com.mysql.jdbc.Driver";
        String dbURL = "jdbc:mysql://localhost:3306/phonebookdb?user=**********&password=************";
        @Override
    public void init() {
         try {
                Class.forName(driver).newInstance();
                conn = DriverManager.getConnection(dbURL);
         }catch(Exception e) {
                  e.printStackTrace();
                  System.err.print("Unable to make connection ");
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try {
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Servlet DBServlet</title>"); 
                out.println("</head>");
                out.println("<body>");
                out.println("<h1>Servlet DBServlet at " + request.getContextPath () + "</h1>");
                out.println("<br /><br /><br />");
                if(conn!=null) 
                    out.println("conn object : "+conn);
                out.println("</body>");
                out.println("</html>");
            } catch(Exception sq) {
                System.out.println("Exception" + sq.getMessage());
                out.close();
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
         public void destroy() {
         try {
             conn.close();
         } catch (SQLException sqle) {
             sqle.printStackTrace();
        @Override
        public String getServletInfo() {
            return "A Simple Servlet";
    }And it work for now.
    Edited by: pavlos555 on Oct 21, 2008 10:21 AM

  • Tomcat servlet class not refreshing

    I just started to work with Tomcat.
    My problem is that once I have compiled and put a servlet in myApps\WEB-INF\Classes directory even after I recompile it the browser displays old version. Only stopping and starting Tomcat shows the new version
    My browser is IE v 6.
    I have done everything as instructed in the book Java for the Web with Servlets... by Kurniawan.
    My web.xml looks like so
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    <servlet>
              <servlet-name>Testing</servlet-name>
              <servlet-class>TestingServlet</servlet-class>
    </servlet>
    </web-app>      
    My CLASSPATH variable looks like so
    c:\j2sdk1.4.2_01\lib;.;c:\1ourfolder\Java Stuff;c:\jakarta-tomcat-4.1.27\common\lib\servlet.jar;C:\IBM\SQLLIB\java\db2java.zip;C:\IBM\SQLLIB\java\db2jcc.jar;C:\IBM\SQLLIB\java\sqlj.zip;C:\IBM\SQLLIB\bin;C:\IBM\SQLLIB\java\common.jar
    Is there something I need to add in the web.xml file? On the comp.lang.java.help forum there was reference to the WEB-INF\classes directory being in classpath and removing that made it work but I don't have that situation AFAIK.
    Thanks

    This must have been answered many times but with the software evolving as it does there must be different ways of doing this. This is what I did
    On your browser go to the manager page.
    http://localhost:8080/manager/html
    You may be prompted for a userid and password
    If you haven't done so already edit the conf\tomcat-users.xml file in the tomcat directory and add a line to set you up as a manager. This is going to be something like this
    <user username="manager" password="tomcat" roles="manager"/>
    Login as manager/tomcat.
    On the resultant webpage you should see a list of applications, myApps will be in that list. Stop it and start it (follow the grid to the right)
    Now your servlet class will be refreshed.
    I looked at other responses in this forum and found this answer
    http://forum.java.sun.com/thread.jsp?forum=33&thread=404559
    "...If it is tomcat 4.1 then you can use its adminitrator jsp page to make your context(webapp) reloadable. This in turn will make chages to your your server file and will add the context back to tomcat without stopping it..."
    At this time I haven't figured out how to do this ;-)
    Oh, and could you use code tags the next time?

Maybe you are looking for

  • How to print list of file contents of a HDD

    Hi Everyone! (Sorry for using a quote---The copy/paste  from my old Text Editor does not work here.... why not?  Only if I am doing a quote) I have a Mac G4 (yes) with Tiger 10.4.11 (yes still)  and I have two backup drives.... They should be evenly

  • In need of a shortcut - does this exist...?

    I view my library by film roll. What I am searching for is a shortcut that allows me to close the roll without having to scroll up to the little triangle and click that. Does this shortcut even esist...? Thanks

  • Internet connection breaks while loading a QuickTime-Stream

    I'm not able to watch a QuickTime-Stream. The video seems to load forever and while loading my interntet connection on my Mac mini breaks. Same situation on any other computer at home. I fear there's a problem with my router. Can you help me?

  • I can't remember the answers to my secret questions when signing into itunes

    I Cannot remember my answers to the secret questions when signing into iTunes to purchase. How do I fix this?

  • Ipod unable to update songs and playlist.

    I've updated all my software, itunes is the lastest and the same with my software on my ipod (its the 30G video ipod) and everytime i plug it in and try to update my music... this is what it says... "Attempting to copy to disk "IPOD" failed. An unkno