Organising code in Tomcat 5.5

Hi,
I'm new to JSP and not all the experienced at Java, but I have a few burning questions about jsp's and Tomcat. I'm developing on a Windows machine before I deploy my code to a Linux machine. I'm using Tomcat 5.5 and building projects using NetBeans IDE 5.0.
I have a few questions.
1. What's the best way to organise my code, as in which directory should I put it in. Currently, every time I start a new 'project' in NetBeans, I put the new project in \Tomcat 5.5\webapps so my code for 'Project A' would be organised as so:
Source for written jsp's: \Tomcat 5.5\webapps\ProjectA\web
but the jsp's also appear in \Tomcat 5.5\webapps\ProjectA\build\web
Source for beans and Java classes: \Tomcat 5.5\webapps\ProjectA\src\java\ProjectAJava
The compiled classes appear in \Tomcat 5.5\webapps\ProjectA\build\web\WEB-INF\classes\ProjectAJava
I was wondering why my jsp source code appeared in two different locations and if there was a better way to do this
2. I want various projects to be able to access the same applications. Where is the best place to put such applications and what is the best way to refer to them (remembering that I'll be re-deploying the code to a new server).
3. Broadly speaking, what's the difference between a bean and a class. Does a bean just set and get variables, or can they contain methods, and if so when does a bean become a class?
OK, they're the burning questions I have.
Thanks for any help you can give me,
Graham

I would suggest that you dont use netbeans to 'build' your project. Usage of the ide to build/deploy projects would severely hamp your knowledge of how the server works which can be a real disadvantage when you want to test/debug/maintain/enhance your applications later. Restrict the use of the ide to help you in code assist, runtime debugging, syntax checking etc. It may be easy initially to have your ide deploy your application, but it sure is going to be a headache later on , especially in your case where you wish to develop on one system and deploy on another.
Now that is out of the way - some other things
1. Dont develop on tomcat - to elaborate the entire source of your application should be on a location outside the tomcat installation.
2. Organize your code into different directories - one for config files, one for jsps, one for html and images, one for java source, one for libraries used by your code etc.
Importantly these directories need not follow the j2ee web packaing structure. For example you can have tlds, web.xml and any other property files all in one folder, say, config.
3. Finally have an ANT (build tool) task, that puts it all together. This build file creates directories that mataches the web application standards, pulls files from your development source, organizes it, compiles java source and simply copies other files to their destinations and builds a war file. Optionally it could also copy the war file to the webapps directory. That's it :)
Note:
Following this process during development may be tedious. Each small change to the code would require building the entire application. For tomcat you can short circuit the process using a context file. Just create an xml file which has the same name as your context and drop it in <tomcat_install>/conf/catalina/localhost
The xml file should have the following content.
<context docBase = "d:/dev/myApp" path = "/myApp" reloadable= "true"/>
Note, this would necessiate a development directory hirearchy exactly sinilar to the web standard (ie web.xml in the WEB-INF folder, compiled source in WEB-INF/classes folder etc)
Hope all this helps,
ram.

Similar Messages

  • Running a servlet code over Tomcat 4.1

    MY HTML CODE THAT CALLS THE SERVLET:
    <html>
    <body>
    <form method="post"action="http://localhost:1234/examples/servlets/program">
    Name : <input type=text name="text1">
    <input type="submit">
    </form>
    </body>
    </html>
    MY SERVLET CODE THAT I HAVE ALREADY SUCCESSFULY EXECUTED ON TOMCAT 3.2.1:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class program extends HttpServlet
    public void service(HttpServletRequest
    req,HttpServletResponse res)throws
    IOException,ServletException
    PrintWriter out= res.getWriter();
    out.println("Hello World!");
    String str= req.getParameter("text1");
    out.println("WElcome:"+str);
    out.close();
    1.==>Any body please tell what all classpaths I have to set here?
    2.==>Do I need to write any xml file for running this code ..if yes then please tell what to write in the xml code and where to save it.
    3.==>Please tell me where to save my servlet code and html code in Tomcat 4.1
    4.==> Do I need any batch file during its execution and lastly how to execute it in Tomcat 4.1...
    I have already successfully executed the program in Tomcat 3.2.1
    5==> Please check if my codes are OK to run over Tomcat 4.1

    You should get in the habit of creating war files ( Web Archive file ).
    You can deploy a war file to any servlet container like tomcat.
    Maven2 is a nice tool that helps you build war files.
    Here is an article on how to get started.
    http://www.javaworld.com/javaworld/jw-12-2005/jw-1205-maven.html

  • How to use JDK5.0 new feature code in tomcat 5.5.9, jsp files

    Hi Everyone:
    I am trying to use JDK5.0 new feature code -- for loop in jsp file , but got compile error , i try the same code in the java file which is working fine. i am wondering is it tomcat jsp compiler problem ?
    following is my code and error msg
    /* jdk 5.0 new feature, but cannot use in this jsp file, tomcat version? or setting problem ?
    for (Thumbnail thumbnail : thumbnailList){
         System.out.println(thumbnail.getAbsolutePath());
    // following is working fine in jsp
    Iterator iter = thumbnailList.iterator();
              while(iter.hasNext()){
                   Thumbnail thumbnail = (Thumbnail) iter.next();
                   out.print(thumbnail.getAbsolutePath()+"<BR>");
         %>
    the error msg is :
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 16 in the jsp file: /test/testImageGallery.jsp
    Generated servlet error:
    Syntax error on token(s), misplaced construct(s)
    An error occurred at line: 16 in the jsp file: /test/testImageGallery.jsp
    Generated servlet error:
    Syntax error on token ")", : expected
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    I am using fedora core 4 x64bit , tomcat 5.5.9,
    java -version
    java version "1.5.0_04"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
    Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_04-b05, mixed mode)
    tomcat settings
    tomcat5/bin/catalina.sh run
    Using CATALINA_BASE: /home/normal/tomcat5
    Using CATALINA_HOME: /home/normal/tomcat5
    Using CATALINA_TMPDIR: /home/normal/tomcat5/temp
    Using JRE_HOME: /home/normal/jdk1.5.0_04

    The JDT compiler that Tomcat installs by default is only 1.4 compliant.
    You can use ant instead:
    remove the common/lib/jasper-compiler-jdt.jar file
    place ant.jar file from the latest Ant distribution in the common/lib folder.
    If you do this, you also need to use the "javac" argument to catalina.sh.
    Documentation reference: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jasper-howto.html

  • How to Setup Organisation Code in Purchasing.

    How do you create an organization code, i have defined an organisation unit, inventory organization and Legal Entity but I am struggle to create an Organization code so the i can have my own item validation to use in Account receivables.
    Thanks

    Navigate to the Order Management Responsiblity
    Setup-->System Parameters
    --> Values
    --> Choose your operating unit
    --> If you scroll down there is 'ITEM VALIDATION ORGANIZATION'
    ==> CHOOSE YOUR INVENTORY ORGANIZATION.
    Once the above done, you will be able to use to define the Items to the Inventory Organization,
    and then only you will be use the Receivables Responsiblity and can do the transactions.
    Srikanth

  • Exception in native code causing Tomcat to crash

    I am running a java servlet on Tomcat and have noticed that it has been unexpectedly terminating quite a bit over the last month or so. Yesterday it happened twice, citing an exception in native code outside the VM. I really have no idea where to start debugging this. Below is what is in the log file that is generated when it terminates. Does anybody know why something like this would be happening? Looking at the stack trace, it looks like a strange place to be terminating? Has anybody come accross anything like this? If you need more information, let me know!
    Thanks!!!
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x77F4200B
    Function=RtlEnterCriticalSection+0xB
    Library=C:\WINDOWS\system32\ntdll.dll
    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.allocConnect(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLAllocConnect(JdbcOdbc.java:114)
    at sun.jdbc.odbc.JdbcOdbcDriver.allocConnection(JdbcOdbcDriver.java:929)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:126)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    - locked <02F7D2F0> (a sun.jdbc.odbc.JdbcOdbcDriver)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    - locked <06A87EB0> (a java.lang.Class)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    - locked <06A87EB0> (a java.lang.Class)
    at com.lmp.iomada.servlets.LMPPersistence.buildObjects(LMPPersistence.java:56)
    at com.lmp.iomada.servlets.LMPServlet.transformHTML(LMPServlet.java:635)
    at com.lmp.iomada.servlets.LMPServlet.doGet(LMPServlet.java:71)
    at com.lmp.iomada.servlets.LMPServlet.doPost(LMPServlet.java:82)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
    at org.apache.tomcat.core.Handler.invoke(Unknown Source)
    at org.apache.tomcat.core.Handler.service(Unknown Source)
    at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
    at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
    at org.apache.tomcat.core.ContextManager.service(Unknown Source)
    at org.apache.tomcat.modules.server.Ajp12Interceptor.processConnection(Unknown Source)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:536)
    Dynamic libraries:
    0x00400000 - 0x00406000 c:\j2sdk1.4.1_03\bin\java.exe
    0x77F40000 - 0x77FFA000 C:\WINDOWS\system32\ntdll.dll
    0x77E40000 - 0x77F34000 C:\WINDOWS\system32\kernel32.dll
    0x77DA0000 - 0x77E30000 C:\WINDOWS\system32\ADVAPI32.dll
    0x77C50000 - 0x77CF5000 C:\WINDOWS\system32\RPCRT4.dll
    0x77BA0000 - 0x77BF4000 C:\WINDOWS\system32\MSVCRT.dll
    0x6D340000 - 0x6D46B000 c:\j2sdk1.4.1_03\jre\bin\client\jvm.dll
    0x77D00000 - 0x77D8F000 C:\WINDOWS\system32\USER32.dll
    0x77C00000 - 0x77C44000 C:\WINDOWS\system32\GDI32.dll
    0x76AA0000 - 0x76ACC000 C:\WINDOWS\system32\WINMM.dll
    0x6D1E0000 - 0x6D1E7000 c:\j2sdk1.4.1_03\jre\bin\hpi.dll
    0x6D310000 - 0x6D31E000 c:\j2sdk1.4.1_03\jre\bin\verify.dll
    0x6D220000 - 0x6D239000 c:\j2sdk1.4.1_03\jre\bin\java.dll
    0x6D330000 - 0x6D33D000 c:\j2sdk1.4.1_03\jre\bin\zip.dll
    0x76F50000 - 0x76F63000 C:\WINDOWS\system32\Secur32.dll
    0x6D2E0000 - 0x6D2EE000 C:\j2sdk1.4.1_03\jre\bin\net.dll
    0x71BB0000 - 0x71BB9000 C:\WINDOWS\system32\WSOCK32.dll
    0x71C00000 - 0x71C18000 C:\WINDOWS\system32\WS2_32.dll
    0x71BF0000 - 0x71BF8000 C:\WINDOWS\system32\WS2HELP.dll
    0x71B20000 - 0x71B63000 C:\WINDOWS\system32\mswsock.dll
    0x71AE0000 - 0x71AE8000 C:\WINDOWS\System32\wshtcpip.dll
    0x6D260000 - 0x6D26B000 C:\j2sdk1.4.1_03\jre\bin\JdbcOdbc.dll
    0x0B3E0000 - 0x0B41A000 C:\WINDOWS\system32\ODBC32.dll
    0x70BC0000 - 0x70C50000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.0.0_x-ww_8A69BA05\COMCTL32.dll
    0x77380000 - 0x77B5D000 C:\WINDOWS\system32\SHELL32.dll
    0x77290000 - 0x772D9000 C:\WINDOWS\system32\SHLWAPI.dll
    0x762B0000 - 0x762F7000 C:\WINDOWS\system32\comdlg32.dll
    0x70AD0000 - 0x70BB6000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.100.0_x-ww_8417450B\comctl32.dll
    0x0B580000 - 0x0B597000 C:\WINDOWS\system32\odbcint.dll
    0x0B720000 - 0x0B73A000 C:\WINDOWS\system32\odbccp32.dll
    0x77160000 - 0x77285000 C:\WINDOWS\system32\ole32.dll
    0x77B90000 - 0x77B98000 C:\WINDOWS\system32\VERSION.dll
    0x76ED0000 - 0x76EF7000 C:\WINDOWS\system32\DNSAPI.dll
    0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll
    0x76F10000 - 0x76F3F000 C:\WINDOWS\system32\WLDAP32.dll
    0x76F80000 - 0x76F85000 C:\WINDOWS\system32\rasadhlp.dll
    0x0FFD0000 - 0x0FFFD000 C:\WINDOWS\system32\rsaenh.dll
    0x76B70000 - 0x76B7B000 C:\WINDOWS\system32\PSAPI.DLL
    0x76C10000 - 0x76C38000 C:\WINDOWS\system32\imagehlp.dll
    0x6D580000 - 0x6D621000 C:\WINDOWS\system32\dbghelp.dll
    Local Time = Tue Jun 01 21:23:49 2004
    Elapsed Time = 5644
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.1_03-b02 mixed mode)

    Library=C:\WINDOWS\system32\ntdll.dll
    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.allocConnect(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLAllocConnect(JdbcOdbc.java:114)
    at sun.jdbc.odbc.JdbcOdbcDriver.allocConnection(JdbcOdbcDriver.java:929)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:126)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    The stack trace points to an error in ntdll.dll, the NT system calls library, while it being used by Sun's standard ODBC driver.
    There are two unfixed bugs against 1.4 in this area. One suggests incorrect usage of the driver by client code. The other suggests that the current Java library has poor handling of exceptions in system code.
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4812268
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4641011
    The latter does not explort the actual cause of exceptions - they will have something to do with your Windows configuration. Applying the latest NT service packs might help. Unfortunately as the bug report indicates, this issue will not be fixed in 1.4.

  • Running a servlet code in Tomcat 4.1 or higher

    MY HTML CODE THAT CALLS THE SERVLET:
    <html>
    <body>
    <form method="post"action="http://localhost:1234/examples/servlets/program">
    Name : <input type=text name="text1"><br><br><br>
    <input type="submit">
    </form>
    </body>
    </html>
    MY SERVLET CODE THAT I HAVE ALREADY SUCCESSFULY EXECUTED ON TOMCAT 3.2.1:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class program extends HttpServlet
    public void service(HttpServletRequest
    req,HttpServletResponse res)throws
    IOException,ServletException
    PrintWriter out= res.getWriter();
    out.println("Hello World!");
    String str= req.getParameter("text1");
    out.println("WElcome:"+str);
    out.close();
    Please tell me the exact class paths to set or any batch file to be made,where to save the servlet and html codes.Also do i need to write any other to execute the above servlet in tomcat 4.1 or higher i.e any xml file etc and if yes then please let me know the code and where to save it.
    Please also verify the method of executing this servlet.

    http://forum.java.sun.com/thread.jspa?threadID=5237132&tstart=15

  • Connecting mysql-4.1.12a-win32 with jakarta-tomcat-3.3.2 using mysql-connec

    hi calverstine here, i have been trying to connect tomcat to mysql using mysql-connector-java-3.1.10, but does not have any clue how to do it, if you guys ask me to refer to :
    http://dev.mysql.com/doc/connector/j/en/cj-classpath.html
    it only told me about installing mysql to unix platform tomcat , not windows xp sp1, is there any tutorial tat's useful for using the mysql-connector-java-3.1.10? where should i place this folder after i unzipped it? what is CLASSPATH as being written in the previous URL that told us to set the environment variable?..anybody care to help?

    You need to place the driver jar in a place that tomcat can access it; if that place is not already in the classpath for Tomcat, then you need to add it.
    After that, you need to supply application code for Tomcat to contain that will use the driver and do whatever it is you want.
    If you don't know how to do any of that, you need to either read the Tomcat documentation, or learn basic Java development.

  • Tomcat 4.1 Bean error (Unable to compile class for JSP)

    Help,
    I am using Tomcat 4.1 with with JDK1.3.1_01. I have a JSP page in which I try to use a Bean, but I get the following error from Tomcat.
    The JSP page is very simple. I am using package names in the import statement. Code below.
    I've put the class files under
    <TOMCAT>\webapps\projectname\WEB-INF\classes under the appropriate packages. What else is missing? I can not figure out what I am doing wrong.
    ***************** START JSP CODE *********************
    <html>
    <head>
    <title>User Information</title>
    </head>
    <%@ page session="true" %>
    <%@ page import="com.xxx.yyy.data.*" %>
    <body>
    <P> </P>
    <P> </P>
    <P> </P>
    <!--
    <jsp:useBean id="user" class="com.xxx.yyy.data.User" scope="session"/>
    -->
    <%
         User user = (User) session.getAttribute("user");
    %>
    UserID = <%= user.getUserID() %><BR>
    User Name = <%= user.getUserName() %><BR>
    Password = <%= user.getPassword() %><BR>
    Password Hint = <%= user.getPasswordHint() %><BR>
    </body>
    </html>
    ***************** END JSP CODE *********************
    ***************** START TOMCAT ERROR MESSAGE *********************
    org.apache.jasper.JasperException: Unable to compile class for JSP
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:477)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 20 in the jsp file: /userInfo.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:7: package com.xxx.yyy.data does not exist
    import com.xxx.yyy.data.*;
    ^
    D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:61: package com.xxx.yyy.data does not exist
    com.xxx.yyy.data.User user = null;
    ^
    An error occurred at line: 20 in the jsp file: /userInfo.jsp
    Generated servlet error:
    D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:63: package com.xxx.yyy.data does not exist
    user = (com.xxx.yyy.data.User) pageContext.getAttribute("user", PageContext.SESSION_SCOPE);
    ^
    An error occurred at line: 20 in the jsp file: /userInfo.jsp
    Generated servlet error:
    D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:66: package com.xxx.yyy.data does not exist
    user = (com.xxx.yyy.data.User) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.xxx.yyy.data.User");
    ^
    An error occurred at line: 25 in the jsp file: /userInfo.jsp
    Generated servlet error:
    D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:77: cannot resolve symbol
    symbol : class User
    location: class org.apache.jsp.userInfo_jsp
         User user = (User) session.getAttribute("user");
    ^
    An error occurred at line: 25 in the jsp file: /userInfo.jsp
    Generated servlet error:
    D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:77: cannot resolve symbol
    symbol : class User
    location: class org.apache.jsp.userInfo_jsp
         User user = (User) session.getAttribute("user");
    ^
    6 errors
         at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
         at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
         at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:326)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
         at java.lang.Thread.run(Thread.java:536)
    ***************** END TOMCAT ERROR MESSAGE *********************

    Hi
    I am running my Tomcat apps (on a Windows dev machine) in an alternate location (ie. not default webapps). The same crap comes to me every time. Unable to install etc. I have tried every trick in the book regarding classpath settings etc.
    When I use 'javap' to check the classpath from any location on my machine, its works and javap returns the signature of my class.
    When I use it though Tomcat (with the import set to include the filename), it get the error. I have heard rumors that using JDK 1.3 in stead of 1.4 helps, but I just want it to work with 1.4 :)
    So if any of you can help me on this, please.
    PS. On my linux server it works just fine, as does every other thing on that machine ;)
    Chris (chris.schuit <at> euronet.nl)

  • Javac command line program can use class, need tomcat to do same

    This may be simple, but any assistance to a newby would be greatly aprreciated. I have a this class file:
    import java.io.*;
    public class OCrypt
    static public String getEncryptedText (String plainText)
    Runtime R;
    String _encryptedText = "";
    char[] someData = new char[16];
    R = java.lang.Runtime.getRuntime();
    try
    java.lang.Process P = R.exec("./OCrypt " + plainText
    InputStreamReader ISR = new InputStreamReader(P.getInputStream());
    ISR.read(someData);
    _encryptedText = new String(someData,0,11);
    catch (Exception e)
    _encryptedText = "***ERROR***";
    return (_encryptedText);
    Where ./OCrypt is a compiled program writtine in C in the same folder. A small test program calls the class and C code and works. Now for the tomcat part, I need to be able to call this code from tomcat. I know it has worked in the past on a much older version of tomcat. I need to figure out how to make it work on tomcat 5.5.9
    Thanks

    Thanks for the reply. Please bare with me. I am reading in the SAMS teach yourself book to know how to create the folder structure. I assumed this folder should be off of my WEB-INF/classes folder. See the full path below.
    Couple of things
    1 - Your class should be in a package. Otherwise you
    will have problems.I added the .class file to a package. Or at least I think I did. I added this line to the top of the code.
    package OCrypt;
    The file is in this folder:
    /var/local/jakarta-tomcat-5.5.9/webapps/ROOT/pss/WEB-INF/classes/OCrypt
    Then I ran 'javac OCrypt' in that folder.
    2 -
    Where ./OCrypt is a compiled program writtine in C
    I always keep the C file in the same location as the class. That may be a problem later when tomcat can resolve the class but then can't find that program. I hope that will generate a completely different error.
    in the same folder.
    In the same folder as what?
    The current working directory for Tomcat is normally
    [TOMCAT]/bin. Is that the folder you mean? I will put it there if I get the class resolved.
    If you want to use this tool, I would say put it in
    the PATH for the machine (so it can be found from
    anywhere) or use an absolute reference to it.I can put a complete path in the .java file before I compile if you think that will help.
    You> can't count on the working directory being where you
    think it is. But right now I would just like to create a simple class like adding two numbers together and returning a result. My larger issue is more of a server configuration. I am using a enterprise wide tomcat server and have been told EACH application folder has it's own classpath. I even attempted to write a JSP that would output my enviroment to a simple page. This didn't work because the env was only for the user, not the env AFTER all the startup scripts run for the server.
    >
    One solution is to use ServletContext.getRealPath().
    Is there any reason you couldn't rewrite the
    encryption into Java - that way you wouldn't have to
    bother with Runtime.exec()
    Another alternative would be to use JNI to get a Java
    interface to the C class.
    http://www-128.ibm.com/developerworks/edu/j-dw-javajni
    -i.html
    I think either of those solutions are preferable to
    using Runtime.exec().

  • Facelets 1.1.14 example with MyFaces 1.2 and Tomcat 6

    Hello,
    I tried to run a little Faceletexample with MyFaces 1.2 (only Core without Tomahawk or something) and facelets 1.1.14.
    I use tomcat 6.0.16.
    Here is my project/ code:
    FaceletsExample
    -- index.xhtml
    -- template.xhtml
    -- META-INF
    -- WEB-INF
    -- faces-config.xml
    -- web.xml
    -- lib
    commons-beanutils-1.7.0.jar
    commons-codec-1.3.jar
    commons-collections-3.2.jar
    commons-digester-1.8 jar
    commons-discovery-0.4.jar
    commons-logging-1.1.1.jar
    el-api-1.0.jar
    el-impl-1.0.jar
    jsf-api-1.2_04-p20.jar
    jsf-facelets.jar
    myfaces-all.jar
    myfaces-api-1.2.2.jar
    myfaces-impl-1.2.2.jar
    portlet.jar
    servlet-api-2.4.jar
    index.xhtml:
    <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:ui='http://java.sun.com/jsf/facelets">
    <body>
    <ui:composition template="template.xhtml">
      <ui:define name="content">
        <h:form>
           <h:outputText value="Halloooo!!!" />
         <h:commandButton value="OK" />
        </h:form>
      </ui:define>
    </ui:composition>
    </body>
    </html>
    {code}
    template.xhtml:
    {code}<html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:ui="http://java.sun.com/jsf/facelets">
    <head>
    <title>Facelets-Test</title>
    </head>
    <body>
    <div>
    <h1>Facelets-Template</h1>
    </div>
    <ui:insert name="content">
       Default Text for content
    </ui:insert>
    </body>
    </html>
    {code}
    web.xml:
    {code}
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">
    <display-name>FaceletsEx</display-name>
    <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       <welcome-file>index.htm</welcome-file>
       <welcome-file>index.jsp</welcome-file>            
    <welcome-file>default.html</welcome-file>                
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    </web-app>{code}
    faces-config.xml:
    {code}<?xml version="1.0" encoding="UTF-8"?>
    <faces-config
        xmlns="http://java.sun.com/xml/ns/javaee"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
        version="1.2">
    <application>    
       <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    </application>
    </faces-config>
    {code}
    When Tomcat starts there appears the following  :
    {code}
    08.04.2008 10:21:09 org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNUNG: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FaceletsEx' did not find a matching property.
    08.04.2008 10:21:09 org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Programme\Java\jdk1.5.0_14\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Programme\Java\jre1.6.0_03\bin\client;C:\Programme\Java\jre1.6.0_03\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\Java\jdk1.5.0_14\bin
    08.04.2008 10:21:09 org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    08.04.2008 10:21:09 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 792 ms
    08.04.2008 10:21:09 org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    08.04.2008 10:21:09 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
    08.04.2008 10:21:09 org.apache.catalina.loader.WebappClassLoader validateJarFile
    INFO: validateJarFile(D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\FaceletsEx\WEB-INF\lib\servlet-api-2.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    08.04.2008 10:21:10 org.apache.catalina.core.StandardContext addApplicationListener
    INFO: The listener "org.apache.myfaces.webapp.StartupServletContextListener" is already configured for this context. The duplicate definition has been ignored.
    08.04.2008 10:21:10 org.apache.catalina.core.StandardContext listenerStart
    SCHWERWIEGEND: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
    java.lang.NoClassDefFoundError: org/apache/commons/el/Logger
         at org.apache.myfaces.util.ClassUtils.<clinit>(ClassUtils.java:41)
         at org.apache.myfaces.config.FacesConfigurator.feedStandardConfig(FacesConfigurator.java:138)
         at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:115)
         at org.apache.myfaces.webapp.StartupServletContextListener.initFaces(StartupServletContextListener.java:63)
         at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:46)
         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
         at org.apache.catalina.core.StandardService.start(StandardService.java:516)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    08.04.2008 10:21:10 org.apache.catalina.core.StandardContext start
    SCHWERWIEGEND: Error listenerStart
    08.04.2008 10:21:10 org.apache.catalina.core.StandardContext start
    SCHWERWIEGEND: Context [/FaceletsEx] startup failed due to previous errors
    08.04.2008 10:21:11 org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    08.04.2008 10:21:11 org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    08.04.2008 10:21:11 org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/47  config=null
    08.04.2008 10:21:11 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 1645 ms
    {code}
    I thought the logging-file were in the project?(--> commons-logging-1.1.1.jar in WEB-INF/lib)
    Where is the mistake?
    After many tries to run this example, I only put one of the.war-files (numberguess.war) from the Faceletdownloadfolder in the webapp-folder from Tomcat.
    If I now start my tomcat, there appear the following errors:
    {code}
    08.04.2008 09:29:26 org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performanc
    e in production environments was not found on the java.library.path: C:\Programm
    e\Java\jdk1.5.0_14\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\W
    INDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\Java\jdk1.5.0_14\bin
    08.04.2008 09:29:27 org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    08.04.2008 09:29:27 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 708 ms
    08.04.2008 09:29:27 org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    08.04.2008 09:29:27 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
    08.04.2008 09:29:27 org.apache.catalina.startup.HostConfig deployWAR
    INFO: Deploying web application archive numberguess.war
    08.04.2008 09:29:28 com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Initializing Sun's JavaServer Faces implementation (1.2-NIGHTLY_20060319)
    for context '/numberguess'
    08.04.2008 09:29:29 com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Completed initializing Sun's JavaServer Faces implementation (1.2-NIGHTLY_
    20060319) for context '/numberguess'
    08.04.2008 09:29:29 org.apache.catalina.core.StandardContext start
    SCHWERWIEGEND: Error listenerStart
    08.04.2008 09:29:29 org.apache.catalina.core.StandardContext start
    SCHWERWIEGEND: Context [/numberguess] startup failed due to previous errors
    08.04.2008 09:29:30 org.apache.catalina.core.StandardContext addApplicationListe
    ner
    INFO: The listener "listeners.ContextListener" is already configured for this co
    ntext. The duplicate definition has been ignored.
    08.04.2008 09:29:30 org.apache.catalina.core.StandardContext addApplicationListe
    ner
    INFO: The listener "listeners.SessionListener" is already configured for this co
    ntext. The duplicate definition has been ignored.
    08.04.2008 09:29:30 org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    08.04.2008 09:29:30 org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    08.04.2008 09:29:30 org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/32  config=null
    08.04.2008 09:29:30 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 3887 ms
    {code}
    Has anybody got an idea?I hope so.
    Many thanks.
    NickiS
    Edited by: NickiS on 08.04.2008 08:45                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    The class org.apache.commons.el.Logger comes from Commons EL project, it is not a part of Commons Logging library. Try adding Commons EL library to your project as it appears MyFaces depends on it.
    http://commons.apache.org/el/

  • A question on tomcat

    This is not about java programming, but still I believe someone can offer clues.
    1 ) I have this URL : http://<host1>:8080/accs/checkTasks.do
    Whenever user raises request to this URL, I want this request to be routed to another URL like http://<anotherhost>:8080/taskManager/manageUserTasks.do.
    I think I need to configure or customize the code of tomcat in host1 in such a way.
    2) Also I want my tomcat to throw exception with different http status code as per configuration. For example, If I set http-status=500 in a property file or something, when request is made to my URL, container throws http 500 error.
    Any clues appreciated.

    baskark wrote:
    Do you want to send the user to the new URL?
    Then just provide a Servlet/Action that issues a redirect (302) to the new URL. There's no need to change the Tomcat code itself.There might be cases where there will not such an action/webapplication itself exist. So I want tomcat to handle this. Hm ... I don't know of a way to get Tomcat itself to do it. I'd simply create a stupid webapp that only does that one thing, if necessary.
    If you'd use Apache as a frontend (as it is often done), then you could solve this using mod_rewrite, but I'm not aware of a similar solution using only Tomcat.
    What? You want tomcat to throw an exception? I don't get what you're asking for here, please try to rephrase your question. You usually don't produce error 500 willingly, as it means "internal server error". If you have some error condition, then you should use one of the many pre-defined status codes (see [RFC 2616|http://www.w3.org/Protocols/rfc2616/rfc2616.html]).
    Yes. correct. This is for simulation. I want to test how my client behaves when http 500 error occurs.I see. I think you can simply use setStatus() or sendError() to force a 500 status code.

  • Lost Tomcat, its database and all JSP and HTML files

    I have mistakably uninstalled Tomcat from my machine, it removed the data I stored in the root including HTML and JSP files, I am using windows XP, Is there any way I can recover htem back, atlest the database and the JSP files? please Help

    Also a good example of why you should develop apps in a separate directory structure and then deploy the WAR file to Tomcat.
    You didn't have all your source code under Tomcat, did you?
    You weren't using a source control system like CVS?
    Oh, my. ;)
    You will from now on, I'll bet.
    %

  • Fetching email with attachments in Tomcat

    I'm trying to process emails with attachments using following code and it works fine in standalone java application, but when I run this code on Tomcat it treates all messages as not multipart. Class of all contents got from messages is SharedByteArrayInputStream.
    I'm using jdk1.6.0_27 and javamail1_4_5
    I put mail.jar in WEB-INF/lib of my war.
    Can anyone help my how to deal with this? What's wrong?
    package test;
    import java.util.Arrays;
    import java.util.List;
    import java.util.Properties;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Session;
    import javax.mail.Store;
    public class Main {
    private static Store store;
    private static Folder folder;
    * @param args
    * @throws Exception
    public static void main(String[] args) throws Exception {
    try {
    List<Message> messages = getMessages("...", "...", "...");
    for (Message mess : messages) {
    System.out.println(mess.getSentDate());
    Object content = mess.getContent();
    if (content instanceof Multipart) {
    System.out.println("miltipart");
    } else {
    System.out.println("plain");
    } finally {
    close();
    public static List<Message> getMessages(String host, String userName, String password) throws Exception {
    if (store != null || folder != null) {
    throw new IllegalStateException("There are open and closed messages exist");
    // create empty properties
    Properties props = new Properties();
    // get session
    Session session = Session.getDefaultInstance(props, null);
    try {
    // get the store
    store = session.getStore("pop3");
    store.connect(host, userName, password);
    // get folder
    folder = store.getFolder("INBOX");
    folder.open(Folder.READ_ONLY);
    // get directory
    return Arrays.asList(folder.getMessages());
    } catch (MessagingException e) {
    throw new Exception("Exception while mail receiving ", e);
    public static void close() throws MessagingException {
    // close connection
    if (folder != null) {
    folder.close(false);
    if (store != null) {
    store.close();
    folder = null;
    store = null;
    }

    But I found another interesting issue.
    When I run my application everything works fine on first iteration. According to my code I get default instance of Session, get Store, get Folder and at last getMessages. After processing messages I close folder and store.
    But if I don't restart my application and try to get messages again all of the SAME messages became plain (SharedByteArrayInputStream) again (as it was earlier).
    If I restart my application first iteration works fine and others fails.
    In both iterations used the same instance of class where I put Thread.currentThread().setContextClassLoader(BaseEmailService.class.getClassLoader());
    What I must reinitialize to make it works on each iteration?

  • Tomcat problem or some other

    i am succesfully running my code in tomcat under Java home with j2sdk.1.3.1_12.but moment i changed Java home to j2sdk1.4.2_07 tomcat stop working .its giving in following error messages in catailna.out
    WARNING: Duplicate name in Manifest: Class-Path
    Catalina.stop: java.net.ConnectException: Connection refused
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at java.net.Socket.<init>(Socket.java:309)
    at java.net.Socket.<init>(Socket.java:124)
    at org.apache.catalina.startup.Catalina.stop(Catalina.java:579) at org.apache.catalina.startup.Catalina.execute(Catalina.java:402) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203).
    hope for a postive respnse from you people.

    You'll need to post it in a JavaScript/VBScript forum.
    Your code is not running at the server (Tomcat) but at the client (the browser).

  • Please help me!!! error in run time about connecting ldap in Tomcat 4

    I had a class which used to connect to ldap which is bellow:
    import java.util.*;
    import javax.naming.*;
    import javax.naming.directory.*;
    public class ADLogin
    protected Hashtable env = new Hashtable();
    String _hostname="sisqn074";
    String _port="389";
    public ADLogin()
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    public boolean authenticate(String username , String password, String domainName)
    boolean b=false;
    try{
    env.put(Context.SECURITY_PRINCIPAL, username.trim() +domainName.trim());
    env.put(Context.SECURITY_CREDENTIALS, password);
    InitialContext ctx = new InitialDirContext(env);
    b=true;
    catch( AuthenticationException e){
    e.printStackTrace();
    b=false;
    catch(NamingException e){
    e.printStackTrace();
    b=false;
    finally{
    //System.out.println("finally");
    return b;
    //set port
    public void setPort(String aport){
    _port=aport;
    //set host name
    public void setHostname(String aName){
    _hostname=aName;
    //initialize
    public boolean initialize(String aHostname,String aPort)
    setPort(aPort);
    setHostname(aHostname);
    env.put(Context.PROVIDER_URL, "ldap://" + hostname + ":" + port);
    return true;
    and I run those codes in tomcat 4.1.21
    now I have a problem , when I use the authenticate method, I use a invalid username which should triger an exception when binding, if the passoword is null , there are no expections and the authenticate would return true on invalid username.
    Those codes is ok in IBM WeBsphere.
    Who can help me ?
    please and thanks.

    hi
    not passing the password, on some directory servers provide u wid an
    annonymous bind and thats what is happening.
    better get this value checked by a javascript for not allowing
    empty password fields
    cheers
    v0d00

Maybe you are looking for

  • DVD Ripp

    *Update* The lastest release of MediaCoder now includes a preset for transcoding for the Zen Vision series players. The encoding used will also work with Vision:M, making it very, very easy to get any video or audio onto your Zen. It also supports tr

  • Hi! help me , my iphone is on but the screen is not showing

    Hi! help me , my iphone is on but the screen is not showing

  • Why is my MB Pro trying to do setup - security issue?

    My MB Pro with OSX Lion was working fine after the most recent software update.   I have it set to require a login at startup but I don't get a login screen.  Instead, I get a setup prompt.  It's as if it's been reset to factory default. I was out of

  • IPhoto Image Properties

    Im totally confused about image properties and the effect on images when downloaded into iPhoto of different releases: I have Canon digital camera. I always shoot at max image and file size...not Raw. I had my MacBook on a vacation in Europe and pull

  • Solenoid valve baseline

    Hi, I know there is a lot of info on solenoid valves on the forums, but I am looking to establish myself a starting point. I need a solenoid valve (or any valve that can be controlled, really) that will allow me to open and close the valve fairly rap