Re: How to access JNDI Directory Context in Tomcat 8
On Mon, 09 Mar 2015 14:11:08 -0400, Christopher Schultz wrote: >> how can that be modified to load the jndi.properties file? > > The javadoc for InitialContext seems to indicate that this file will be > processed automatically. > > If it isn't processed automatically, I'd suggest trying to figure out > why. Good to know, thank you. Amazingly, this is the only Java example code I've ever seen which, potentially, enables remote JNDI lookup for JMSContext. -Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to access JNDI Directory Context in Tomcat 8
On Mon, 09 Mar 2015 08:59:33 +, Mark Thomas wrote: > On 09/03/2015 03:59, Thusitha Thilina Dayaratne wrote: >> Hi, >> >> I want to access the JNDI Directory context in Tomcat8. I've used >> *DirContextURLStreamHandler* class which was in Tomcat 7. But now that >> has been removed. >> Can someone tell me how can I access the JNDI Directory Context in >> Tomcat 8? > > Via the standard JNDI API. > > Mark Can you elaborate a little? For this example: public static void main(String[] args) { try { // Gets the JNDI context Context jndiContext = new InitialContext(); // Looks up the administered objects ConnectionFactory connectionFactory = (ConnectionFactory) jndiContext.lookup("jms/javaee7/ConnectionFactory"); Destination queue = (Destination) jndiContext.lookup("jms/javaee7/ Queue"); // Sends a text message to the queue try (JMSContext context = connectionFactory.createContext()) { context.createProducer().send(queue, "Text message sent at " + new Date()); } } catch (NamingException e) { e.printStackTrace(); } } http://stackoverflow.com/questions/23037845/ how can that be modified to load the jndi.properties file? thanks, Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
loading properties file from WEB-INF instead of WEB-INF/classes
getPropsFromWebINF works so long as the properties file is within the package of the class (/. However, I'd like to put the properties file under WEB-INF: public void getPropsFromWebINF() throws IOException { Properties p = new Properties(); InputStream is; is = getClass().getResourceAsStream("sqljdbc4.properties"); p.load(is); log(p.toString()); } I've seen mention of using: System.getenv("APP_PROPERTIES"); in conjunction with a context (context.xml under META-INF) along the lines of: however, I'm not able to get the environment, I just get a null value. What's the correct, and simple, idiom? (Staying away from jndi and dbcp for now, and, oddly enough, servlets in this case.) Actually, I suppose in a sense it's in WEB-INF: dtc01l0376-06:~ a00720398$ dtc01l0376-06:~ a00720398$ jar -tfv NetBeansProjects/A00720398sat/dist/A00720398sat.war | grep sql 498 Sat Apr 17 14:36:14 PDT 2010 WEB-INF/classes/controller/sqljdbc4.properties however, I'd like to move it from WEB-INF/classes up to just WEB-INF. thanks, Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
JNDI config
For a servlet to employ JNDI to access a JDBC database, Tomcat must be configured? JNDI won't work on a vanilla configuration of Tomcat? 1. Install Your JDBC Driver Use of the JDBC Data Sources JNDI Resource Factory requires that you make an appropriate JDBC driver available to both Tomcat internal classes and to your web application. This is most easily accomplished by installing the driver's JAR file(s) into the $CATALINA_HOME/lib directory, which makes the driver available both to the resource factory and to your application. http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html Thanks, Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: manager 401 error fixed with restart
On Mon, 02 Mar 2009 08:11:18 +, Thufir wrote: > On Mon, 02 Mar 2009 07:04:40 +0000, Thufir wrote: > >> On Mon, 02 Mar 2009 05:49:53 +, Thufir wrote: >> >>> I'm getting: >>> >>> >>> HTTP Status 401 - >>> >>> type Status report >>> >>> message >>> >>> description This request requires HTTP authentication (). >>> >>> http://localhost:8080/manager/html >>> >>> >>> on tomcat6 for ubuntu 8.10 with sun java. Neither restarting tomcat >>> nor logging out gained access to the manager page, had to restart. >>> >>> Is there a less drastic step to take in that circumstance? > > > Well, restarting apache2 seems to fix that problem. pain in the neck, > though. LOL. it was just that it took time to do all that and futz around. I could've just twiddled my thumbs, same diff! I just wait for it to go from: thu...@arrakis:~$ thu...@arrakis:~$ netstat -tan | grep 127 tcp0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp0 0 127.0.0.1:48816 127.0.0.1:8080 FIN_WAIT2 tcp6 0 0 127.0.0.1:8005 :::* LISTEN tcp6 527 0 127.0.0.1:8080 127.0.0.1:48816 CLOSE_WAIT tcp6 0 0 127.0.0.1:59454 127.0.0.1:8005 TIME_WAIT thu...@arrakis:~$ thu...@arrakis:~$ to: thu...@arrakis:~$ thu...@arrakis:~$ netstat -tan | grep 127 tcp0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 127.0.0.1:8005 :::* LISTEN thu...@arrakis:~$ thu...@arrakis:~$ >From what I understand there's no real solution, but it's quite annoying. Perhaps I'm doing something wrong? -Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: instance has been stopped. could not loadoracle.toplink.essentials...
On Sun, 01 Mar 2009 21:46:30 -0600, Caldarale, Charles R wrote: >> From: news [mailto:n...@ger.gmane.org] On Behalf Of Thufir Subject: Re: >> instance has been stopped. could not loadoracle.toplink.essentials... >> >> Glad you saw that. It seems like toplink is required for JPA? > > Got no idea; what I said was mostly a joke, like mixing oil and water. > Should have used a smiley face. > >> Do you have suggestion beyond "don't use mssql" because mssql is what >> my school uses > > Nothing wrong with MSSQL; it has its quirks, just like every other DB. > > - Chuck > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY > MATERIAL and is thus for use only by the intended recipient. If you > received this in error, please contact the sender and delete the e-mail > and its attachments from all computers. LOL. I took it as that, but also thought there might be something to it, too. I swear the "tutorials" on JDBC settings for mssql are wrong. Anyhow, thanks for the help. -Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: manager 401 error fixed with restart
On Mon, 02 Mar 2009 07:04:40 +, Thufir wrote: > On Mon, 02 Mar 2009 05:49:53 +0000, Thufir wrote: > >> I'm getting: >> >> >> HTTP Status 401 - >> >> type Status report >> >> message >> >> description This request requires HTTP authentication (). >> >> http://localhost:8080/manager/html >> >> >> on tomcat6 for ubuntu 8.10 with sun java. Neither restarting tomcat >> nor logging out gained access to the manager page, had to restart. >> >> Is there a less drastic step to take in that circumstance? Well, restarting apache2 seems to fix that problem. pain in the neck, though. -Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: manager 401 error fixed with restart
On Mon, 02 Mar 2009 05:49:53 +, Thufir wrote: > I'm getting: > > > HTTP Status 401 - > > type Status report > > message > > description This request requires HTTP authentication (). > > http://localhost:8080/manager/html > > > on tomcat6 for ubuntu 8.10 with sun java. Neither restarting tomcat nor > logging out gained access to the manager page, had to restart. > > Is there a less drastic step to take in that circumstance? Additional data: thu...@arrakis:~$ thu...@arrakis:~$ netstat -tan Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 127.0.0.1:8005 :::* LISTEN tcp6 0 0 :::8009 :::* LISTEN tcp6 0 0 :::8080 :::* LISTEN tcp6 0 0 :::80 :::* LISTEN tcp6 0 0 ::1:33239 :::* LISTEN tcp6 0 0 127.0.0.1:45109 127.0.0.1:8080 ESTABLISHED tcp6 0 0 127.0.0.1:8080 127.0.0.1:45109 ESTABLISHED tcp6 1 0 127.0.0.1:8080 127.0.0.1:45112 CLOSE_WAIT thu...@arrakis:~$ is there a problem with port 8080? would configuring server.xml differently help? If I kill java that seems to help (I think) but is inconvenient. thanks, Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
manager 401 error fixed with restart
01215 at java.lang.Class.newInstance(Class.java:308) 101216 at org.apache.juli.ClassLoaderLogManager.readConfiguration (ClassLoaderLogManager.java:404) 101217 at org.apache.juli.ClassLoaderLogManager.readConfiguration (ClassLoaderLogManager.java:348) 101218 at org.apache.juli.ClassLoaderLogManager.readConfiguration (ClassLoaderLogManager.java:239) 101219 at java.util.logging.LogManager$2.run(LogManager.java:258) 101220 at java.security.AccessController.doPrivileged(Native Method) 101221 at java.util.logging.LogManager.readPrimordialConfiguration (LogManager.java:256) 101222 at java.util.logging.LogManager.getLogManager (LogManager.java:239) 101223 at java.util.logging.Logger.(Logger.java:221) 101224 at java.util.logging.LogManager$RootLogger. (LogManager.java:973) 101225 at java.util.logging.LogManager$RootLogger. (LogManager.java:970) 101226 at java.util.logging.LogManager$1.run(LogManager.java:179) 101227 at java.security.AccessController.doPrivileged(Native Method) 101228 at java.util.logging.LogManager. (LogManager.java:156) 101229 at java.util.logging.Logger.getLogger(Logger.java:274) 101230 at org.apache.juli.logging.DirectJDKLog. (DirectJDKLog.java:71) 101231 at org.apache.juli.logging.DirectJDKLog.getInstance (DirectJDKLog.java:178) 101232 at org.apache.juli.logging.LogFactory.getInstance (LogFactory.java:170) 101233 at org.apache.juli.logging.LogFactory.getInstance (LogFactory.java:241) 101234 at org.apache.juli.logging.LogFactory.getLog (LogFactory.java:296) 101235 at org.apache.catalina.startup.Bootstrap. (Bootstrap.java:54) 101236 Mar 1, 2009 9:44:00 PM org.apache.catalina.core.StandardService stop 101237 INFO: Stopping service Catalina 101238 Mar 1, 2009 9:44:00 PM org.apache.coyote.http11.Http11Protocol destroy 101239 INFO: Stopping Coyote HTTP/1.1 on http-8080 101240 Mar 1, 2009 9:44:01 PM org.apache.catalina.core.AprLifecycleListener init 101241 INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-sun-1.6.0.10/jre/lib/i386/client:/ usr/lib/jvm/java-6-sun-1.6.0.10/jre/lib/i386:/usr/lib/jvm/java-6- sun-1.6.0.10/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib 101242 Mar 1, 2009 9:44:01 PM org.apache.coyote.http11.Http11Protocol init 101243 INFO: Initializing Coyote HTTP/1.1 on http-8080 101244 Mar 1, 2009 9:44:01 PM org.apache.catalina.startup.Catalina load 101245 INFO: Initialization processed in 1390 ms 101246 Mar 1, 2009 9:44:01 PM org.apache.catalina.core.StandardService start 101247 INFO: Starting service Catalina 101248 Mar 1, 2009 9:44:01 PM org.apache.catalina.core.StandardEngine start 101249 INFO: Starting Servlet Engine: Apache Tomcat/6.0.18 101250 Mar 1, 2009 9:44:02 PM org.apache.jasper.EmbeddedServletOptions 101251 SEVERE: The scratchDir you specified: /usr/local/tomcat/work/ Catalina/localhost/host-manager is unusable. 101252 Mar 1, 2009 9:44:02 PM org.apache.jasper.EmbeddedServletOptions 101253 SEVERE: The scratchDir you specified: /usr/local/tomcat/work/ Catalina/localhost/examples is unusable. 101254 Mar 1, 2009 9:44:02 PM org.apache.jasper.EmbeddedServletOptions 101255 SEVERE: The scratchDir you specified: /usr/local/tomcat/work/ Catalina/localhost/docs is unusable. 101256 Mar 1, 2009 9:44:02 PM org.apache.jasper.EmbeddedServletOptions 101257 SEVERE: The scratchDir you specified: /usr/local/tomcat/work/ Catalina/localhost/_ is unusable. thu...@arrakis:~$ ll /usr/local/tomcat/work/Catalina ls: cannot access /usr/local/tomcat/work/Catalina: Permission denied thu...@arrakis:~$ sudo ls -al /usr/local/tomcat/work/Catalina [sudo] password for thufir: total 12 drw-rw-rw- 3 thufir thufir 4096 2009-01-15 22:17 . drw-rw-rw- 3 thufir thufir 4096 2009-01-15 22:17 .. drw-rw-rw- 9 thufir thufir 4096 2009-03-01 20:37 localhost thu...@arrakis:~$ thu...@arrakis:~$ thu...@arrakis:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=8.10 DISTRIB_CODENAME=intrepid DISTRIB_DESCRIPTION="Ubuntu 8.10" thu...@arrakis:~$ thanks, Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: instance has been stopped. could not loadoracle.toplink.essentials...
On Sun, 01 Mar 2009 09:24:08 -0600, Caldarale, Charles R wrote: > (Mixing anything from Oracle with MSSQL? That's gutsy.) > > - Chuck Glad you saw that. It seems like toplink is required for JPA? Do you have suggestion beyond "don't use mssql" because mssql is what my school uses, so I have to connect to that db. Maybe I should setup some sort of derby thing? I'm not sure how that works, but I'm guessing that it would add a layer of abstraction. However, I'm not sure that would get me anywhere. Kinda a java question rather than tomcat. -Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: instance has been stopped. could not loadoracle.toplink.essentials...
On Sun, 01 Mar 2009 09:24:08 -0600, Caldarale, Charles R wrote: >> From: news [mailto:n...@ger.gmane.org] On Behalf Of Thufir Subject: >> instance has been stopped. could not loadoracle.toplink.essentials... > >> I can't quite predict with certainty when this error will occur: > > And we can't predict what Tomcat version you're running on. You might > be a mentat, but the rest of us aren't. Uproot your questions from their ground and the dangling roots will be seen. More questions! -Mentat Zensufi Server Information Tomcat Version JVM Version JVM Vendor OS Name OS Version OS Architecture Apache Tomcat/6.0.181.6.0_10-b33Sun Microsystems Inc. Linux 2.6.27-11-generic i386 Which is all manually installed on ubuntu. >> 86899 Feb 28, 2009 10:05:50 PM >> org.apache.catalina.loader.WebappClassLoader loadClass >> 86900 INFO: Illegal access: this web application instance has been >> stopped already. > > It looks like the webapp was already on the way down when the above > message (note that it's INFO, not ERROR) was displayed. You may have > run into the problem of your logging environment trying to reinitialize > itself when it shouldn't. You can try setting the system property: Yeah, I've just been ignoring the INFO, as you point out and it doesn't seem to matter. Nebeans undeploys and redeploys, and maybe restarts tomcat as well. I suppose settings for those actions would be in netbeans. Sounds like something fairly safely ignored? thanks, Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
instance has been stopped. could not load oracle.toplink.essentials...
I can't quite predict with certainty when this error will occur: 86899 Feb 28, 2009 10:05:50 PM org.apache.catalina.loader.WebappClassLoader loadClass 86900 INFO: Illegal access: this web application instance has been stopped already. Could not load oracle.toplink.essentials.internal.localization.i18n.LoggingLocalizationResource. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. 86901 java.lang.IllegalStateException but generally restarting tomcat, and some combination of undeploy/ redeploy fixes the problem. (I'm using NB 6.1, which automagically deploys the .war) I'm not entirely whether undeploying the app does anything or not, I don't see why it would, but it seems to help. >From what I've read the general solution is to just restart tomcat. What does the error mean? Also, just to clarify, if I'm using toplink for JPA then the toplink jars, and whatever I'm using for jdbc, need to be copied to tomcat as per: http://wiki.netbeans.org/DeployREST2Tomcat55 (instead of derby I'm using mssql.jar) thanks, Thufir - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: hello world
On Sun, 21 Sep 2008 16:54:33 -0400, H. Hall wrote: > When I installed Netbeans 6.1, the installer also installed Tomcat > 6.0.14. This was on a windows pc but I would find it very amazing if the > Linux version of NB6.1 installed a TC 5.5. Is is possible that a > tomcat installed with Ubuntu? Ah, looking at: http://download.netbeans.org/netbeans/6.1/final/ I see that some versions of NB do include Tomcat -- interesting. So far as I can tell this isn't the case for Ubuntu, though. Ubuntu can install Tomcat 5.5 through the package manager, and then I may have installed the plug-in for Tomcat 6...? I dunno. It seems to be working with the upstream tomcat 6 and NB 6. With Java 6, does this mean that the arrival of the four horsemen is imminent!? Anyhow, I expressed my frustration on the Ubuntu mailing list and received a confirmation and then a "works for me", along with an advisory not to run Tomcat as root. -Thufir - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hello world
On Fri, 19 Sep 2008 10:10:20 -0400, Steve Ochani wrote: >> Now rather than recriminating at aeternum, does anyone know how to >> track down said packager, so that maybe he could come here and see the >> errors of his ways, or at least explain his logic here ? Same as for >> Debian Tomcat5.5 itself, I haven't a clue where to start. Wouldn't this be the starting place? Yeah, I'm a tad bitter at wasting my time. > I remember a while back someone from Ubuntu posting on this list stating > that if someone needs help getting their tomcat package working that the > person should ask in their forums. that kinda makes sense. > So that might be a place to start > looking for the packager or at least someone who can answer why the > packages are so ... non functional. I got tomcat working satisfactorily by following: http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/ I haven't fully tested it, but I did set up a manager role and so forth. For the life of me, I can't see why the incredibly simple how-to is *not* what synaptic does under ubuntu. They should just remove it from synaptic. By the way, I thought that the JAVA_HOME environment variable was passe? I'm going to make a post to the ubuntu mailing list asking "why?". -Thufir - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hello world
On Thu, 18 Sep 2008 09:50:18 -0500, Caldarale, Charles R wrote: >> Do I need to install Tomcat 5.5 from Ubuntu > > We've had no end of problems with 3rd-party repackaged versions of > Tomcat. Ok, yeah, I've seen mention of that, but thought that must be in error. If Apache installs then why not tomcat? -Thufir - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hello world
On Thu, 18 Sep 2008 11:02:42 -0400, Brantley Hobbs wrote: >> I thought mentats weren't supposed to use computers... >> Later on they do :) >> > No matter what, the spice must flow. If it takes a computer, it takes a > computer. Yes :) -Thufir - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
hello world
This cuts across IDE, OS and server. I'm running Ubuntu: [EMAIL PROTECTED]:~$ [EMAIL PROTECTED]:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=8.04 DISTRIB_CODENAME=hardy DISTRIB_DESCRIPTION="Ubuntu 8.04.1" [EMAIL PROTECTED]:~$ [EMAIL PROTECTED]:~$ sudo apt-get update; sudo apt-get upgrade; sudo apt-get dist-upgrade ... which, near as I can tell, is fully updated. I'm also running Netbeans 6.0.1 and Java 6, and Tomcat 5.5. (If Ubuntu is up to date, why isn't Netbeans and Tomcat? anyhow.) >From Netbeans I've installed the Tomcat plug-in, which seems to have resulted in two Tomcat directories: /usr/share/tomcat5.5 /usr/share/tomcat5.5-webapps When I go to create a new web application from the IDE, Netbeans prompts for the user/password for a manager and the path to Catalina. Which version of Tomcat are they referencing? Do I need to install Tomcat 5.5 from Ubuntu, or just the plug-in from Netbeans? Just not quite sure how to get started. Navigating to "localhost" just gives "it works", so I'll have to dig further into fixing tomcat. It just seems that the one thing depends on another, which goes in a circle so that I'm not even sure of my question. -Thufir - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]