You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by teh j <to...@yahoo.com.au> on 2001/05/07 03:29:42 UTC

Re: log4j and tomcat

Hello there!

I was wondering if anybody could help with a tomcat
and log4j problem?

I have placed my log4j.properties file into my
WEB-INF/classes direcotry but it seems that Tomcat is
not picking it up!

This is the line in my code in my .java file taht
tells me what .properties file to look for

PropertyConfigurator.configure("log4j.properties");

If I put in the full path to the .properties file, it
still does not seem to find it!

It tells me the following the error message: (but the
application in the browser works fine

log4j:ERROR Could not read configuration file
[log4j.properties].
java.io.FileNotFoundException: log4j.properties (No
such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at
java.io.FileInputStream.<init>(FileInputStream.java:64)
        at
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:289)
        at
org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:308)
        at security.security.<init>(security.java:32)
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:237)
        at
java.beans.Beans.instantiate(Beans.java:207)
        at java.beans.Beans.instantiate(Beans.java:51)
        at
jason.security._0002fjason_0002fsecurity_0002flogin_0005fhandler_0002ejsplogin_0005fhandler_jsp_0._jspService(_0002fjason_0002fsecurity_0002flogin_0005fhandler_0002ejsplogin_0005fhandler_jsp_0.java:68)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
        at
org.apache.tomcat.core.Handler.service(Handler.java:286)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484)
log4j:ERROR Ignoring configuration file
[log4j.properties].

any help is appreciated!
Jason

--- Anuj Agrawal <ag...@lucent.com> wrote: > Yes it
can.
> 
> You might want to consider creating a
> log4j.properties file to hold your log4j
> configuration.  Have that file in your
> WEB-INF/classes dir and tomcat would
> automatically pick it up.
> 
> HTH.
> Anuj.
> 
> teh j wrote:
> 
> > I have recently started playing with log4j. Does
> > anybody know if it can be used with Tomcat?
> > I have a a JSP app running on tomcat that has
> several
> > beans and classes and was wondering if I could use
> > log4j as a logging tool
> 


_____________________________________________________________________________
http://store.yahoo.com.au - Yahoo! Store
- It's time you had your business online!

Re: log4j and tomcat

Posted by Winfried Klum <kl...@bison-soft.de>.
Oops, correcting...

String propPath =
conf.getServletContext().getResource("/WEB-INF/classes/log4j.properties").getPath();
 PropertyConfigurator.configure(propPath);
 ...

Re: log4j and tomcat

Posted by Winfried Klum <kl...@bison-soft.de>.
You can try the following:

 String propPath =
conf.getServletContext().getResource("/WEB-INF/classes/log4j.properties");
 PropertyConfigurator.configure(propPath);
 ...

 regards 
 Winfried 
> 
> Hello there!
> 
> I was wondering if anybody could help with a tomcat
> and log4j problem?
> 
> I have placed my log4j.properties file into my
> WEB-INF/classes direcotry but it seems that Tomcat is
> not picking it up!
> 
> This is the line in my code in my .java file taht
> tells me what .properties file to look for
> 
> PropertyConfigurator.configure("log4j.properties");
> 
> If I put in the full path to the .properties file, it
> still does not seem to find it!
> 
> It tells me the following the error message: (but the
> application in the browser works fine
> 
> log4j:ERROR Could not read configuration file
> [log4j.properties].
> java.io.FileNotFoundException: log4j.properties (No
> such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at
> java.io.FileInputStream.<init>(FileInputStream.java:64)
>         at
> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:289)
>         at
> org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:308)
>         at security.security.<init>(security.java:32)
>         at java.lang.Class.newInstance0(Native Method)
>         at java.lang.Class.newInstance(Class.java:237)
>         at
> java.beans.Beans.instantiate(Beans.java:207)
>         at java.beans.Beans.instantiate(Beans.java:51)
>         at
> jason.security._0002fjason_0002fsecurity_0002flogin_0005fhandler_0002ejsplogin_0005fhandler_jsp_0._jspService(_0002fjason_0002fsecurity_0002flogin_0005fhandler_0002ejsplogin_0005fhandler_jsp_0.java:68)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>         at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>         at
> org.apache.tomcat.core.Handler.service(Handler.java:286)
>         at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>         at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>         at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>         at java.lang.Thread.run(Thread.java:484)
> log4j:ERROR Ignoring configuration file
> [log4j.properties].
> 
> any help is appreciated!
> Jason
> 
> --- Anuj Agrawal <ag...@lucent.com> wrote: > Yes it
> can.
> >
> > You might want to consider creating a
> > log4j.properties file to hold your log4j
> > configuration.  Have that file in your
> > WEB-INF/classes dir and tomcat would
> > automatically pick it up.
> >
> > HTH.
> > Anuj.
> >
> > teh j wrote:
> >
> > > I have recently started playing with log4j. Does
> > > anybody know if it can be used with Tomcat?
> > > I have a a JSP app running on tomcat that has
> > several
> > > beans and classes and was wondering if I could use
> > > log4j as a logging tool
> >
> 
> _____________________________________________________________________________
> http://store.yahoo.com.au - Yahoo! Store
> - It's time you had your business online!

"Unsafe path..." - What is Tomcat trying to tell me?

Posted by be...@bellatlantic.net.
I am trying to run Cocoon 1.8.2 with Tomcat 3.2.1 on Win95.  During Cocoon initialization a null pointer exception is thrown and Tomcat issues the following message:

2001-05-03 03:52:02 - Ctx( /cocoon ): Unsafe path C:\jakarta-tomcat-3.2.1\webapps\cocoon \Web-inf\cocoon.properties

It appears that Tomcat will not let Cocoon get at its' properties file.  I tried mucking around with the Tomcat policy file but nothing I tried made any difference.

Any help with this would be appreciated.

Thanks in advance,
--beeky



Re: petstore problem

Posted by "Noel E. Lecaros" <sp...@mozcom.com>.
HI, Swamy

Did you create the datastore by running the "populate" script?

Regards,
Noel Lecaros

Swamy wrote:
> 
> Hi,
>    I have been trying to install the pet store implementation. After jumping
> a few hoops this last one has been testing me for a while now. Here is the
> environment :
> j2sdkee1.2.1,
> jdk1.3.0_02,
> Cloudscape_3.6,
> jboss-tomcat-2.2,
> jps1.1.1 and the patch from jboss
> on
> Windows 2000 server.
> 
> Here is what I do :
> Step 1 : Start Cloudscape using the script in
> j2sdkee1.2.1\bin\cloudscape.bat -start
> Step 2 : Start jboss using jboss-tomcat-2.2\jboss-2.2\bin\run.bat
> Step 3 : On the browser I try
> http://localhost:8080/estore/control/language?language=English
> This results in a the following exception
> Internal Servlet Error:
> 
> java.lang.RuntimeException: NamingException while looking up DB context  :
> EstoreDB not bound
>  at
> com.sun.j2ee.blueprints.shoppingcart.catalog.model.CatalogModel.init(Catalog
> Model.java:42)
>  at
> com.sun.j2ee.blueprints.petstore.control.web.ModelManager.getCatalogModel(Mo
> delManager.java:84)
>  at
> com.sun.j2ee.blueprints.petstore.control.web.ModelManager.init(ModelManager.
> java:60)
>  at
> com.sun.j2ee.blueprints.petstore.control.web.MainServlet.doGet(MainServlet.j
> ava:56)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>  at org.apache.tomcat.core.Handler.service(Handler.java:286)
>  at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>  at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
> 7)
>  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>  at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:210)
>  at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>  at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>  at java.lang.Thread.run(Thread.java:484)
> Now, if I refresh the screen. I get the first page right but on the console
> from where I started jboss I get this message
> 2001-05-06 03:47:46 - ContextManager: JDBCRealm: JDBCRealm.authenticate:
> SELECTuser_pass FROM users WHERE user_name = ?
> 2001-05-06 03:47:47 - ContextManager: JDBCRealm: Authentication unsuccessful
> for user null
> 
> Thanks in advance.
> Swamy

petstore problem

Posted by Swamy <ss...@qwest.net>.
Hi,
   I have been trying to install the pet store implementation. After jumping
a few hoops this last one has been testing me for a while now. Here is the
environment :
j2sdkee1.2.1,
jdk1.3.0_02,
Cloudscape_3.6,
jboss-tomcat-2.2,
jps1.1.1 and the patch from jboss
on
Windows 2000 server.

Here is what I do :
Step 1 : Start Cloudscape using the script in
j2sdkee1.2.1\bin\cloudscape.bat -start
Step 2 : Start jboss using jboss-tomcat-2.2\jboss-2.2\bin\run.bat
Step 3 : On the browser I try
http://localhost:8080/estore/control/language?language=English
This results in a the following exception
Internal Servlet Error:

java.lang.RuntimeException: NamingException while looking up DB context  :
EstoreDB not bound
 at
com.sun.j2ee.blueprints.shoppingcart.catalog.model.CatalogModel.init(Catalog
Model.java:42)
 at
com.sun.j2ee.blueprints.petstore.control.web.ModelManager.getCatalogModel(Mo
delManager.java:84)
 at
com.sun.j2ee.blueprints.petstore.control.web.ModelManager.init(ModelManager.
java:60)
 at
com.sun.j2ee.blueprints.petstore.control.web.MainServlet.doGet(MainServlet.j
ava:56)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
 at org.apache.tomcat.core.Handler.service(Handler.java:286)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
 at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
 at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
 at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
 at java.lang.Thread.run(Thread.java:484)
Now, if I refresh the screen. I get the first page right but on the console
from where I started jboss I get this message
2001-05-06 03:47:46 - ContextManager: JDBCRealm: JDBCRealm.authenticate:
SELECTuser_pass FROM users WHERE user_name = ?
2001-05-06 03:47:47 - ContextManager: JDBCRealm: Authentication unsuccessful
for user null


Thanks in advance.
Swamy



JNDI Datasource in Tomcat

Posted by Harden ZHU <ha...@sympatico.ca>.
Hi

I try to use JNDI to get datasource in tomcat. How can I config a jndi
datasource in
tomcat so i can get datasource as follow code?

Thanks

Harden
===================================
public AttributeDAO(String dataSource)  throws AttributeDAOException {

        try {
            InitialContext ic = new InitialContext();
            datasource = (DataSource) ic.lookup(dataSource);
        } catch (NamingException ne) {
            throw new AttributeDAOException("NamingException while looking "
+
                            "up DB context  : " + ne.getMessage());
        }

    }