Directory problem with tomcat
Hi, i face a problem when trying to deploy my apps in tomcat4. Because my URL that point to my servlet is very long e.g.:
http://222.222.222.222/abc/def/ghi/jkl/myServlet
because of some constraint i need to put the myServlet in /jkl folder instead of /abc folder under webapps..... but in tomcat server.xml and web.xml for the apps i can't find the correct tag to set so that this is enabled..... is there any method to configure this??
Thanx in advance for the help. :)
http://222.222.222.222/abc/def/ghi/jkl/myServlet
because of some constraint i need to put the
myServlet in /jkl folder instead of /abc folder underI don't understand what kinda constraint would make someone tie to a long URL? Okay if abc is the web-app root directory, then you could place the servlet in the def.ghi.jkl package and configure the web.xml accordingly.
***Annie***
Similar Messages
-
Problems with Tomcat & Eclipse on MacOSX
Hi everybody. I have a problem with Tomcat and Eclipse. I must make an application with JSF for my dissertation and i even become a new Mac user so i have some problems. I have installed Eclipse 3,3 Europe on Mac OSX 10,4, also I have installed Tomcat 5,5 setting up environment variable and users of Tomcat. Well, when I try to connect them creating a new server in Eclipse and select Tomcat as server and relative folder of origin, the problems begin. When I try to run on server a JSF project(naturally I have imported all the necessary libraries) it give this error to me: Could not load the Tomcat incomplete serveur configuration at /Servers/Tomcat v5.5 serveur at localhost-config.The configurator mau be corrupt or. Reason: Could not load the Tomcat incomplete serveur configuration at /Servers/Tomcat v5.5 serveur at localhost-config.The configurator mau be corrupt or incomplete. On what it can depend? It is possible that is a JRE problem? I do not find the folder jre on my file system(are novice with the mac). Thanks to all.
This seems like a question that would be better put to an Eclipse forum.
-
Datasource Configuration problem with Tomcat-4.0.3
Hi All !
When I trying to open connection to my DB2 database in tomcat -4.0.3,
I have put db2java.jar in /usr/local/jakartha-tomcat-4.03/common/lib directory
when I am trying to connect Database through my servlet getting expections
java.lang.NullPointerException: at DataSource ds = (DataSource)envContext.lookup("jdbc/SmsDBDS");
here is my dbconnection class
package com.ebizon.util.jdbc;
import java.sql.*;
import java.util.*;
import javax.naming.*;
import javax.sql.*;
public class DBUtil {
/* Ebizon DB Connection for Tomcat */
public static Connection getEbizDBConnection() throws NamingException, SQLException {
Connection conn = null;
try {
InitialContext initCtx = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/SmsDBDS");
conn = ds.getConnection();
} catch (NamingException ne) {
throw ne;
} catch (SQLException se) {
throw se;
return conn;
And my resource definition in server.xml (/usr/local/jakartha-tomcat-4.0.3/conf/server.xml)
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/SmsDBDS"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/SmsDBDS">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- DB2 dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>smsdb</value>
</parameter>
<parameter>
<name>password</name>
<value>smsdb</value>
</parameter>
<!-- Class name for mm.mysql JDBC driver -->
<parameter>
<name>driverClassName</name>
<value>COM.ibm.db2.jdbc.app.DB2Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:db2:smsdb</value>
</parameter>
</ResourceParams>
</Context>
this is my Web Application descriptor /WEB-INF/web.xml
<resource-ref>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<res-ref-name>
jdbc/EmployeDB
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
Please look at once above , Do i missing any thing?
Anyhelp is greatly appreciate
Many thanks in advance
With Regards
Madhu ReddyI don't see any problem with your files, so unfortunately I can't help. Since this forum is about the J2EE SDK, people may not have that much experience with standalone Tomcat. You may want to try the Tomcat user mailing list for a question about Tomcat: http://jakarta.apache.org/site/mail2.html
-
Eclipse problem with Tomcat when running jsp
when I start tomcat from CMD, it starts normally and display http://localhost:8080/ properly
but when I start tomcat from Eclipse, it starts the server normally,
but it can't display http://localhost:8080/ properly,
I guess that the problem with the java classpath isn't defined correctly in Eclipse
but but I've tried it before, and it doesn't work
here the error msg from Eclipse console:
[INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on http-8080
Starting service Tomcat-Standalone
Apache Tomcat/4.1.31
[INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
[INFO] PropertyMessageResources - -Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true
[INFO] Http11Protocol - -Starting Coyote HTTP/1.1 on http-8080
[INFO] ChannelSocket - -JK2: ajp13 listening on /0.0.0.0:8009
[INFO] JkMain - -Jk running ID=0 time=0/120 config=C:\jakarta-tomcat-4.1.31\conf\jk2.properties
Error compiling file: C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\_\/index_jsp.java [javac] Compiling 1 source file
[javac] Modern compiler not found - looking for classic compiler
Info: Compile: javaFileName=C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\_\/index_jsp.java
classpath=C:/jakarta-tomcat-4.1.31/shared/classes/;C:/jakarta-tomcat-4.1.31/common/classes/;C:/jakarta-tomcat-4.1.31/common/endorsed/xercesImpl.jar;C:/jakarta-tomcat-4.1.31/common/endorsed/xmlParserAPIs.jar;C:/jakarta-tomcat-4.1.31/common/lib/activation.jar;C:/jakarta-tomcat-4.1.31/common/lib/ant-launcher.jar;C:/jakarta-tomcat-4.1.31/common/lib/ant.jar;C:/jakarta-tomcat-4.1.31/common/lib/commons-collections.jar;C:/jakarta-tomcat-4.1.31/common/lib/commons-dbcp-1.1.jar;C:/jakarta-tomcat-4.1.31/common/lib/commons-logging-api.jar;C:/jakarta-tomcat-4.1.31/common/lib/commons-pool-1.1.jar;C:/jakarta-tomcat-4.1.31/common/lib/jasper-compiler.jar;C:/jakarta-tomcat-4.1.31/common/lib/jasper-runtime.jar;C:/jakarta-tomcat-4.1.31/common/lib/jdbc2_0-stdext.jar;C:/jakarta-tomcat-4.1.31/common/lib/jndi.jar;C:/jakarta-tomcat-4.1.31/common/lib/jta.jar;C:/jakarta-tomcat-4.1.31/common/lib/mail.jar;C:/jakarta-tomcat-4.1.31/common/lib/naming-common.jar;C:/jakarta-tomcat-4.1.31/common/lib/naming-factory.jar;C:/jakarta-tomcat-4.1.31/common/lib/naming-resources.jar;C:/jakarta-tomcat-4.1.31/common/lib/servlet.jar
cp=C:\jakarta-tomcat-4.1.31\shared\classes
cp=C:\jakarta-tomcat-4.1.31\common\classes
cp=C:\jakarta-tomcat-4.1.31\common\endorsed\xercesImpl.jar
cp=C:\jakarta-tomcat-4.1.31\common\endorsed\xmlParserAPIs.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\activation.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\ant-launcher.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\ant.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\commons-collections.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\commons-dbcp-1.1.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\commons-logging-api.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\commons-pool-1.1.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\jasper-compiler.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\jasper-runtime.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\jdbc2_0-stdext.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\jndi.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\jta.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\mail.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\naming-common.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\naming-factory.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\naming-resources.jar
cp=C:\jakarta-tomcat-4.1.31\common\lib\servlet.jar
work dir=C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\_
srcDir=C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\_
include=index_jsp.java
Exception compiling Cannot use classic compiler, as it is not available. A common solution is to set the environment variable JAVA_HOME to your jdk directory.
Exception:
Cannot use classic compiler, as it is not available. A common solution is to set the environment variable JAVA_HOME to your jdk directory.
at org.apache.tools.ant.taskdefs.compilers.Javac12.execute(Javac12.java:72)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:942)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:282)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:328)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:479)
Cannot use classic compiler, as it is not available. A common solution is to set the environment variable JAVA_HOME to your jdk directory.
at org.apache.tools.ant.taskdefs.compilers.Javac12.execute(Javac12.java:72)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:942)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:282)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:328)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:479)
Here are my system settings :
Eclipse 2.1.3
plugin : tomcatPluginV21, lomboz.213
Jakarta-tomcat-4.1.31
JAVA_HOME : C:\jdk1.3.1_15
CATALINA_HOME : C:\jakarta-tomcat-4.1.31
Here are my Eclipse settings :
http://server2.uploadit.org/files/marvelousgame-01.JPG
http://server3.uploadit.org/files/marvelousgame-02.JPG
http://server2.uploadit.org/files/marvelousgame-03.JPG
http://server3.uploadit.org/files/marvelousgame-04.JPG
http://server2.uploadit.org/files/marvelousgame-05.JPG
http://server3.uploadit.org/files/marvelousgame-06.JPG
thx!!!I would suggest updating your software to the latest versions - java 1.4.2 or higher, tomcat 5 or higher, Eclipse 3. That should fix any incompatibilities you are experiencing.
As to your problem, it seems the tomcat you are trying to run from Eclipse wants a newer Java version (1.4.2 most likely). -
Problem with Tomcat 5.0
Hi there,
I have a .java file inside \WEB-INF\classes\ directory. This .java file has a "public static void main" method that calls al the other methods in the class.
I want to know if its possible for me to create an JSP file to call this .java file. If so how can i do it?
Thanks!!NerdVix wrote:
Hi there,
I have a .java file inside \WEB-INF\classes\ directory. Wrong. .java files do you no good in that directory. Only .class files belong there.
This .java file has a "public static void main" method that calls al the other methods in the class.Fine - for testing on a command line.
I want to know if its possible for me to create an JSP file to call this .java file. If so how can i do it?What part don't you understand? Writing JSPs? Calling methods? What is a person so ignorant doing with Tomcat anyway?
It's possible to call main, but not a good idea.
% -
Hi guys,
I am with a very strange problem with my job here.
We had a server working with Tomcat 5 and it didn't have problem, but wanted to changed to Tomcat 6.
So.. we changed and it ran normal and well.
The problem is when we stress the server with one or more big queries, execptions is showed that didn't show with Tomcat 5:
java.lang.Exception: [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed
Using SQL Server 2000
java.lang.Exception: The connection is closed.
Using SQL Server 2005
java.lang.Exception: I/O Error: socket closed.
Using SQL Server 2005 with jTDS driver
It happens with Oracle too.
Can anybody help me?
Thanks!hi i'm having a similar problem launching a servlet in eclipse. I did the above changes and still nothing:
instead i keep getting :
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class DataServlet or a class it depends on -
Problems with tomcat 4.0.1
hello,
i�ve written some servlets using forte 3.0 with tomcat 3.2.
everything works fine as long as I don�t run the servlets with tomcat 4.0.1.
i use the request dispatcher / forward method - which dosn�t work reliable.
it�s a list on which the user has to select one topic. the strange thing about it is that it works when you choose "back" after the error (dispatcher = null) has occured and select a different topic on that list - only the first choice makes en error.
running on tomcat 3.2 with forte it works fine. but i get the following message in the tomcat output window:
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key dispatcher.forwardException
and
2002-01-13 11:40:05 - Ctx( /lg002234 ): Exception in: R( /lg002234 + /eingaben + null) - javax.servlet.ServletException: cannot find message associated with key : dispatcher.forwardException
can somebody help?
is use the dispatcher three times in that post-method - ist that a problem?...sorry
it�s not a problem with the requestdispatcher,
problem is, that with tomcat 4.0.1 a parameter
sometimes gets lost - but not with tomcat 3.2
critical code is:
String tierartAuswahl = request.getParameter("tierartAuswahl");
is that a known bug of tomcat 4.0.1?? -
Im running examples of the include:
<jsp:include page="xxx.jsp" flush="true">
and received error:
org.apache.jasper.JasperException: No se puede compilar la clase para JSP
An error occurred at line: 17 in the jsp file: /jsp/include/include.jsp
Generated servlet error:
/Programas/Tomcat4/work/localhost/examples/jsp/include/include$jsp.java:79: Method include(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, javax.servlet.jsp.JspWriter, boolean) not found in class org.apache.jasper.runtime.JspRuntimeLibrary.
JspRuntimeLibrary.include(request, response, "/jsp/include/foo.html" + jspxqStr, out, true);
^
Please Help me Im running this equal with:
<%@ include file="xxx.jsp" %>
and runnig fine....The two means of including files are different in their approach.
Using <jsp:include .../> compilation of the included jsp is done at run -time not during compilation.
Using <%@ include .../> compiles at compile time.
Looking at the error it seems that the method JspRuntimeLibrary.include is not being found which suggests that you may have a classpath problem. Check that there is not a servlet.jar in the classpath that is from a earlier spec than the one provided with Tomcat.
Dave -
Hi,
I'm just writing to inform you about a problem with the Oracle 9i database I found out.
I have downloaded and installed the release 2 enterprise/standard/personal edition for Windows NT/2000/XP.
After doing that I could not start my Tomcat server any more. Although I have tested the situation with many different releases of the Apache Tomcat server it did not work.
Then I've deleted the Oracle database and just installed the client release. And now it works!
I'd be grateful if one of you could tell me what's the problem and how I can solve it.
Thanks for your help.
Best regards,
Steffithe localhost.log file shows
02-Jun-2008 13:57:36 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
02-Jun-2008 13:57:36 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
02-Jun-2008 13:58:23 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
02-Jun-2008 13:58:23 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
and the catalina.log file shows..
02-Jun-2008 13:58:24 org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
i couldnot understand anything..how to rectify that..
thanks in advance -
DB2 Configuration problem with Tomcat-4.0.3
When I trying to open connection to my DB2 database in tomcat -4.0.3,
I have put db2java.jar in /usr/local/jakartha-tomcat-4.03/common/lib directory
when I am trying to connect Database through my servlet getting expections
java.lang.NullPointerException: at DataSource ds = (DataSource)envContext.lookup("jdbc/SmsDBDS");
here is my dbconnection class
package com.ebizon.util.jdbc;
import java.sql.*;
import java.util.*;
import javax.naming.*;
import javax.sql.*;
public class DBUtil {
/* Ebizon DB Connection for Tomcat */
public static Connection getEbizDBConnection() throws NamingException, SQLException {
Connection conn = null;
try {
InitialContext initCtx = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/SmsDBDS");
conn = ds.getConnection();
} catch (NamingException ne) {
throw ne;
} catch (SQLException se) {
throw se;
return conn;
And my resource definition in server.xml (/usr/local/jakartha-tomcat-4.0.3/conf/server.xml)
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/SmsDBDS"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/SmsDBDS">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- DB2 dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>smsdb</value>
</parameter>
<parameter>
<name>password</name>
<value>smsdb</value>
</parameter>
<!-- Class name for mm.mysql JDBC driver -->
<parameter>
<name>driverClassName</name>
<value>COM.ibm.db2.jdbc.app.DB2Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:db2:smsdb</value>
</parameter>
</ResourceParams>
</Context>
this is my Web Application descriptor /WEB-INF/web.xml
<resource-ref>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<res-ref-name>
jdbc/EmployeDB
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
Please look at once above , Do i missing any thing?
Anyhelp is greatly appreciate
Many thanks in advance
With Regards
Madhu ReddyHi,
I have same problem. But unfortunately there does not exist a solution.
You can read the explanation of this topic at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html#Non%20DBCP%20Solutions
Non DBCP Solutions. I understand Tomcat supports only MySQL, PostgreSQL, and Oracle 8i but not DB2.
DataSource ds = (DataSource)envContext.lookup("jdbc/SmsDBDS");
Up to now everything is fine, ds is not null, but inside ds (password, url, username...) all of them are null
So when you execute conn = ds.getConnection(); there will be exception.
If you find any solution please inform me.
[email protected] -
A problem with Tomcat (Can't run tomcat as a service.).
Hi
May be you can help me (please).
I do the following steps, as described in many documents I've found.
1. Downloaded the jk_nt_service.exe and put it into jdk1.3.1jre\bin\classic
2. configured wrapper.properties:
wrapper.tomcat_home=C:\tomcat324 wrapper.java_home=C:\work\jdk1.3.1
3. Run:
C:\>jk_nt_service.exe -i tomcat C:\tomcat324conf\wrapper.properties
C:\>jk_nt_service.exe -s tomcat
C:\>net start tomcat
In this step I get the following error:
A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.
I've got the same error on other computers and using Alexandria's program.. As I understood it's not only my problem, others have it too.
Thanks in advance.Hi,
First U should check if IIS and Tomcat are running together then Tomcat won't start coz both use the 80 port. u have shut down IIS and use Tomcat and enable Tomcat to start with the services, If shutting down IIS is not a problem.
If u need both IIS and Tomcat to run together then u have change the server http port u can do it in the following manner
drive:\Apache Tomcat 4.0\conf directory.
Edit the sever.xml file
In the server.xml file u will have to change the port in the following piece
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="60000"/>
<!-- Note : To disable connection timeouts, set connectionTimeout value
to -1 -->
Change the port 8080 to 808x where x is any number between 0 to 9
Restart the machine and this should work
Good Luck
Bye,
MAX -
Query Active Directory + Problem with thumbnailPhoto
Hi<o:p></o:p>
I have a problem and I don’t know if it is my SQL Query, so here goes
<o:p></o:p>
I have a view on my SQL server that Queries our Active Directory. I can see that there is data in the table.<o:p></o:p>
But when I try to use the Image in some C# code I get an error on 60% of the images with the exception header missing or corrupted.
My view is built with this Query:
select
* from
openquery
ADSI,'SELECT sAMAccountName, mail, title, displayName, telephoneNumber, mobile, sn, givenName, department, thumbnailPhoto
FROM ''LDAP:[REMOVED]''
WHERE objectCategory = ''Person''
Do you have any idea where the problem is? The photos shows up fine in Outlook, SharePoint, lync etc. I’m pretty sure that the C# code works correctly. Hope you can help.
Regards
If only I had time to learn everything I wanted ...Hi Latheesh
I've tried with this script:
SELECT ISNULL(ROW_NUMBER() OVER ( ORDER BY department ), -999) 'id' ,
CONVERT(NVARCHAR(25), givenName) AS Fornavn ,
CONVERT (NVARCHAR(50), sn) AS Efternavn ,
CONVERT(CHAR(5), UPPER(SUBSTRING(mail, CHARINDEX(mail, N'@'),
CHARINDEX(N'@', mail)))) AS 'initialer' ,
CONVERT(NVARCHAR(255), mail) AS Mail ,
CONVERT(NVARCHAR(75), title) AS Stilling ,
CONVERT(NVARCHAR(120), department) AS Afdeling ,
CONVERT(NVARCHAR(13), telephoneNumber) AS Fastnet ,
CONVERT(NVARCHAR(13), mobile) AS Mobil ,
CASE WHEN userAccountControl = 2 THEN 'Account is Disabled'
WHEN userAccountControl = 16 THEN 'Account Locked Out'
WHEN userAccountControl = 17
THEN CONVERT (VARCHAR(48), 'Entered Bad Password')
WHEN userAccountControl = 32
THEN CONVERT (VARCHAR(48), 'No Password is Required')
WHEN userAccountControl = 64
THEN CONVERT (VARCHAR(48), 'Password CANNOT Change')
WHEN userAccountControl = 512 THEN 'Normal'
WHEN userAccountControl = 514 THEN 'Disabled Account'
WHEN userAccountControl = 544
THEN 'Account Enabled - Require user to change password at first logon'
WHEN userAccountControl = 8192
THEN 'Server Trusted Account for Delegation'
WHEN userAccountControl = 524288
THEN 'Trusted Account for Delegation'
WHEN userAccountControl = 590336
THEN 'Enabled, User Cannot Change Password, Password Never Expires'
WHEN userAccountControl = 65536
THEN CONVERT (VARCHAR(48), 'Account will Never Expire')
WHEN userAccountControl = 66048
THEN 'Enabled and Does NOT expire Paswword'
WHEN userAccountControl = 66050
THEN 'Normal Account, Password will not expire and Currently Disabled'
WHEN userAccountControl = 66064
THEN 'Account Enabled, Password does not expire, currently Locked out'
WHEN userAccountControl = 8388608
THEN CONVERT (VARCHAR(48), 'Password has Expired')
ELSE CONVERT (VARCHAR(248), userAccountControl)
END AS 'Disabled' ,
CONVERT(NVARCHAR(75), givenName + ' ' + sn) AS 'DisplayName' ,
CONVERT (VARBINARY(MAX), thumbnailPhoto) AS 'Photo'
INTO ##adTemptable
FROM openquery
ADSI,'SELECT sAMAccountName, mail, title, displayName, telephoneNumber, mobile, sn, givenName, department, thumbnailPhoto,userAccountControl
FROM ''[REMOVED]''
WHERE objectCategory = ''Person''
WHERE department IS NOT NULL
But i still gets the same error on MANY rows
OLE DB provider 'ADsDSOObject' for linked server 'ADSI' returned truncated data for column '[ADsDSOObject].thumbnailPhoto'. The actual data length is 6846 and truncated data length is 4000.
OLE DB provider 'ADsDSOObject' for linked server 'ADSI' returned truncated data for column '[ADsDSOObject].thumbnailPhoto'. The actual data length is 7006 and truncated data length is 4000.
OLE DB provider 'ADsDSOObject' for linked server 'ADSI' returned truncated data for column '[ADsDSOObject].thumbnailPhoto'. The actual data length is 6496 and truncated data length is 4000.
If only I had time to learn everything I wanted ... -
Problem with TOMCAT again !
I�m trying to deploy to TOMCAT 5028. with .war that has no access to database no problem it works fine.
but whem my .war has to access a database i got:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.faces.FacesException: Can't instantiate class: 'test.Page1'.. class test.Page1 : javax.faces.FacesException: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
root cause
javax.faces.FacesException: javax.faces.FacesException: Can't instantiate class: 'test.Page1'.. class test.Page1 : javax.faces.FacesException: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:308)
com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:78)
com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:125)
com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
com.sun.jsfcl.app.ViewHandlerImpl.setupPageBean(ViewHandlerImpl.java:271)
com.sun.jsfcl.app.ViewHandlerImpl.createView(ViewHandlerImpl.java:126)
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:164)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
I deploy the .war to application server and it works just fine.
and i configure the tomcat with:
JNDI Name: jdbc/test
Data Source URL: jdbc:mysql://192.168.0.2:3306/test
JDBC Driver Class: org.gjt.mm.mysql.
User Name: root
Password: admin
Max. Active Connections: 20
Max. Idle Connections: 20
Max. Wait for Connection: 5000
the only thing different in application server is the the Jdbc Driver Class.
And I am using Creator update 7 to generate the .war
am i missing something ????
Regards
Marlos RodriguesI found a simple way to deploy on Tomcat.
*** Copy standard.jar, jstl.jar and mysql-connector-xxx.jar (if you are using mysql otherwise the drivers jar for the DB you are using).
*** Edit the Tomcat conf/context.xml config file and add a WatchedResource :
<WatchedResource>META-INF/context.xml</WatchedResource>
*** Add your context.xml to META-INF of your war :
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
</Context>This will create a config file in conf/Catalina/localhost with the context path name, so in this case DBTest.xml
Hope that helps! That's how I got it working... -
Migration problems with Tomcat 4.1.10. Please help.
Product: Java Web Application
Operating system: Redhat Linux 7.3
Web Server: Apache 1.3.x
Application server: Tomcat 4.1.10
Database server: MySQL 3.23.x
Java Architecture: JSP (presentation) + Java Bean (Business logic)
JDK version: 1.3.1_04
Hi,
When we tried to migrate our application from Tomcat 4.0.4 to Tomcat 4.1.10, we found that the relative path references like ../xyz/ab.jsp are not properly interpreted by Netscape and the url seen on the address bar is something like this (http://www.sww.com/../xyz/ab.jsp. Also dynamic jsp forwarding support seems to have changed. While forwarding, the dynamic parameters attached are automatically url encoded. We have tested our application on Tomcat 4.0.4, there were no such issues. Since we have used these sort of things in many places in our application it will be difficult for us to change in all those places. Can anybody tell us what we can do about it?
thanks in advance,
Srikanth. S.Hi,
http://www.xyz.com/swiz/test.jsp:
<%
response.sendRedirect("../sebase/common_login.jsp");
%>
When I run http://www.xyz.com/swiz/test.jsp with the above code, the url is displayed http://www.xyz.com/swiz/../sebase/common_login.jsp in Netscape address bar when the application is run on tomcat 4.1.10. With Internet explorer and opera, it reads http://www.xyz.com/sebase/common_login.jsp. But on Tomcat 4.0.4, there is no problem even with Netscape. Since we are tracking the urls in many places in our application, we are having problem because of the above said type of url interpretation.
thanks in advance,
Srikanth. S. -
J2SE 1.4 Logger configuration problems with Tomcat 4.0
I'm using Tomcat 4.0 as a servlet container and I'm trying out the new J2SE 1.4 logging API.
Its working fine with the standard settings, which sets the level to INFO on the console handler.
I would like to set the level to FINER to show some debugging info, but can't seem to get it going.
I have tried setting the default level in my %JAVA_HOME%\jre\lib\logging.properties file, but it doesn't want to display log records of level FINER.
I have also change the console handler to FINER by setting java.util.logging.ConsoleHandler.level = FINER
I have also specified the config file parameter to point to a config file explicitly using the -Djava.util.logging.config.file=%CATALINA_HOME%\conf\logging.properties parameter in the catalina.bat script.
Anyone got this working?
--KimSolved it. Isn't that always the way, you get frustrated enough to post a message, then you solve it 5 minutes later.
It was a simple problem of the higher level overriding the lower levels.
--Kim
Maybe you are looking for
-
After scanning from my Photosmart 7510 to my iPad via the HP AiO Remote app for months, I suddenly cannot scan. The printer sounds like it is scanning and "Processing..." shows on my iPad and control panel but the scan never completes. The print func
-
Email will not setup "Do you want to try setting up the account without SSL"
email will not setup, get message "Do you want to try setting up the account without SSL"
-
Time capsule problems - please help...
Hi. Have got a new 3 tb capsule and after I've set it up it appears they it works as a switch, not as a router... Could please anyone help me set it up as router please...? :/
-
Why do I not have 'Save as' and 'Versions' in Mountain Lion 10.8.2
I know these features were brought back in Mountain Lion but I don't seem to have it. I think I didn't have it when I was running 10.8.1 as well. Most of my iWork software does a strange thing by saving the file with a '~' at the end of the name, whe
-
Raster Effects Settings and Effects Size Relationship
Hi, I've noticed when one of my colleagues has created a concept file with RES set to 72dpi, when I go to change the settings to 300dpi, the size of the effects changes. This kinda makes sense to me so I just go in and multiply the effects by 4 to ge