Tomcat & Embedded()
I am having a problem transferring my webapp from my development Jbuilder6 IDE with integrated TomCat 4.0 to a non integrated version of Tomcat 4.0.
I am using a servlet that runs on startup that uses the Embedded class to build an an engine and multiple hosts. Within the JBullder environment this works fine, but when I to run it outside of JBuilder Tomcat will run only part of the servlet. The servlet stops running at the line Embedded embedded = newEmbedded().
For example:
public void init() throws ServletException {
System.out.println("here1");
System.setProperty("catalina.home","C:/EmbeddedTomcat");
Embedded embedded = new Embedded();
System.out.println("here2");
will output only 'here1' in the tomcat console.
I am new to catalina development so any help with this problem would be greatly appreciated.
Thanks in advance.
I may be out of line here but you probably could get this to work...it would be a bit of a hack job but it is possible.
With regards to your "NoClassDefFound" problem (and adding dynamic contexts) I believe your problem is that there is a rarely used var that you can set in server.xml that allows the user to access the main Tomcat jars. The main Tomcat classes are separated from the webapp specific classes on startup...i.e. loaded completely separately and access is closed off for security. The var I mentioned changes this.
Unfortunately, it's been a while since I was reading up on this so I completely forget the name of it....it's some type of "Factory" object/var that exposes the JARs you need.
Once you get access to the other side of Tomcat, then you "should" be able to use the main JARs to dynamically reload contexts and webapps using the same methods and classes tomcat itself uses to start.
I would guess that to develop this into a production capable solution would take quite some time....but who knows
ON THE LOG ISSUE......something to note...check out the /logs directory and see if your System.out.println() calls are being fed to the logs....tomcat seems to like making this the stdout as opposed to the console...which is reasonnable considering most production versions won't have the error logs piped to the screen :)
Hope some of this helps...like I said..it's been a while since I've looked into this so I could be wrong.
RG
Similar Messages
-
Tomcat embedded + add servlet
Hi,
I need to use Tomcat in an embedded mode. No problem to do this. The only problem is that I want to have a servlet added to the server at startup coding it directly in my start method. I have saw that it is possible with Jetty, is it possible too with Tomcat ?
Thanks.Hi,
download the Tomcat "Embedded" version at http://tomcat.apache.org/download-55.cgi and try the following code:
import org.apache.catalina.*;
import org.apache.catalina.connector.*;
import org.apache.catalina.realm.*;
import org.apache.catalina.startup.*;
import org.apache.catalina.users.*;
public class EmbeddedTomcat
// Instance variables:
private String name;
private int portNumber;
private Embedded embedded;
private Engine baseEngine;
private Host baseHost;
private Connector httpConnector;
/** Creates a new instance of EmbeddedTomcat */
public EmbeddedTomcat(
String name,
int portNumber)
this.name = name;
this.portNumber = portNumber;
init();
private void init()
MemoryRealm realm;
Context context;
String baseEngineName;
String hostName;
embedded = new Embedded();
// set default logger and realm
FileLogger fileLog = new FileLogger();
fileLog.setDirectory(".");
fileLog.setPrefix(name);
fileLog.setSuffix(".log");
fileLog.setTimestamp(true);
embedded.setLogger(fileLog);
realm = new MemoryRealm();
embedded.setRealm(realm);
// create an Engine
baseEngine = embedded.createEngine();
// set Engine properties
baseEngineName = name + "Engine";
hostName = name + "Host";
baseEngine.setName(baseEngineName);
baseEngine.setDefaultHost(hostName);
baseHost = embedded.createHost(hostName, "webapps");
baseEngine.addChild(baseHost);
// RootContext
context = addContext("", "ROOT");
// ManagerContext
context = addContext("/manager", "manager");
context.setPrivileged(true);
// add new Engine to set of Engine for embedded server
embedded.addEngine(baseEngine);
// create Connector
httpConnector = embedded.createConnector((java.net.InetAddress) null,
portNumber, false);
// add new Connector to set of Connectors for embedded server, associated
// with Engine
embedded.addConnector(httpConnector);
public void start()
// start server
try
embedded.start();
catch (org.apache.catalina.LifecycleException ex)
ex.printStackTrace();
//fileLog.log("Startup failed");
//fileLog.log(ex.getMessage());
public Context addContext(
String path,
String docBase)
Context c;
c = embedded.createContext(path, docBase);
baseHost.addChild(c);
return c;
public static void main(String[] args)
new EmbeddedTomcat("test", 8080).start();
}Let me know if you have any problems.
/klejs -
Embedded Tomcat Can't Compile JSP from JAR
I've got a problem that I can't seem to figure out. I hope someone might shed some light on this.
I have a desktop java application that has Tomcat embedded in it. I'm creating a jar file of just myapp's *.class files and I specify the main-class and classpath in the manifest file. If I execute the jar the following way, it works fine:
set CLASS_PATH=.;.\myapp.jar;.........all of the required Tomcat classes....;.\lib\anotherLib.jar
javaw -ea -classpath %CLASS_PATH% com.myapp.Application
But if I try to execute it this way, it runs and starts Tomcat. However, when Tomcat tries to compile a JSP, it can't find packages such as javax.servlet, javax.servlet.jsp, org.apache.jasper.runtime, and so forth.
I believe It has something to do with the classpath. Does anybody have any ideas?i guess it is not the too lengthy classpath...
just chek that when u run the application from eclipse.. r u seting the classpath.. and that classpath should not have any spaces in it..
for ex: a directory like c:\program files \ should be as c:\progra~1\..
ot any jar file in the classpath has spaces...
this may be one of the reason that the classpath gets truncated... -
Visual Web Pack looking for AppServer but set for Tomcat
I am having trouble starting a Creator 2 project I imported into the Visual Web Pack. It seems to be trying to use the AppServer which I do not have installed. It is set up to use Tomcat55. I set it up following the import instructions. It is clearly marked Tomcat55 in project.properties. It wont launch though. It just prints null and the following error is in the ide log...it happens every time i try and run the project. Other projects I create in VWP run fine with tomcat embedded. The error is:
INFORMATIONAL *********** Exception occurred ************ at 8:25 PM on Jan 16, 2007
javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException: deployer:Sun:AppServer::localhost:4849 The Application Server installation directory is not correctly set up. (Use the Tools->J2EE Platform Manager menu to correct.)
at org.netbeans.modules.j2ee.sun.ide.dm.SunDeploymentFactory.getDisconnectedDeploymentManager(SunDeploymentFactory.java:130)
at org.netbeans.modules.j2ee.deployment.impl.Server.getDisconnectedDeploymentManager(Server.java:144)
at org.netbeans.modules.j2ee.deployment.impl.Server.getDisconnectedDeploymentManager(Server.java:138)
[catch] at org.netbeans.modules.j2ee.deployment.config.ConfigSupportImpl.getDeploymentConfiguration(ConfigSupportImpl.java:432)
at org.netbeans.modules.j2ee.deployment.config.ConfigSupportImpl.getWebContextRoot(ConfigSupportImpl.java:227)
at com.sun.rave.project.jsfproject.ProjectWebModule.getContextPath(ProjectWebModule.java:107)
at com.sun.rave.project.jsfproject.ui.customizer.WebProjectProperties.init(WebProjectProperties.java:328)
at com.sun.rave.project.jsfproject.ui.customizer.WebProjectProperties.<init>(WebProjectProperties.java:262)
at com.sun.rave.project.jsfproject.WebProject.getWebProjectProperties(WebProject.java:466)
at com.sun.rave.project.jsfproject.RaveWebActionProvider.invokeAction(RaveWebActionProvider.java:124)
at org.netbeans.modules.project.ui.actions.ProjectAction.actionPerformed(ProjectAction.java:96)
at org.netbeans.modules.project.ui.actions.LookupSensitiveAction.actionPerformed(LookupSensitiveAction.java:139)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1170)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1211)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Message was edited by:
CandideECHi!
It seems to me that your application is deployed to Sun Application Server. Try to change Deployment Server in project's properties. For that:
1) Rightclick on top of project in 'Projects' window.
2) Select Properties.
3) Change Server in 'Run' section.
Thanks,
Roman. -
Hi,
I'm trying to run Apache + Tomcat + JBoss.
JBoss/Tomcat embedded is working fine, but I can't run Tomcat standalone, I've got the following error :
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:60)
at com.sun.enterprise.naming.SerialContext.<init>(SerialContext.java:79)
at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:54)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:665)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at javax.naming.InitialContext.init(InitialContext.java:222)
at javax.naming.InitialContext.<init>(InitialContext.java:178)
at ejb.sbtest.SBTest1Servlet.doGet(SBTest1Servlet.java:96)
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:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
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.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
Someone has a tutorial on Tomcat configuration with an application server ?
Thanks,
jerome.At your SBTest1Servlet.java:96, you must have a call
new InitialContext(); // no parameter
It only works if tomcat is running with jboss. Also this call is for JNDI, if your jboss is not running, who is your JNDI server??? Anyway, assuming you have jboss running on "anotherHost" as JNDI server, the use the following code. If your JNDI server is not jboss, the property values are diff depending on that server.
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "anotherHost:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
ctx = new InitialContext(env); -
Current Date in Debugger different from Current Date in Web-Determinations
Just today....
The current date in my laptop is 7/4/2012;
When I invoke build and restart debugger without screens, I am showing the current date at 7/4/2012
When I invoke build and restart debugger with screens, the current date is showing as 7/5/2012
Does anyone have any thoughts about this?
Thanks,
AllanWe are using OPM 10.4
The project region is US (English)
It's running on a laptop where the time zone is Pacific Time (US&Canada) - (UTC-8:00)
For this moment (0740) local, the current date is showing as 7/5 in both debugger with and without screens.
I will monitor hourly to see if it flips over to tomorrow's date.
As an aside, I note, on project start-up, it takes 3-4 efforts to deploy to debugger with screens. It seems to time out (error message says "Tomcat embedded web server failed to start after 30 seconds") for the first two or three tries, and then finally loads. I don't recall this experience in prior versions. Any thoughts on that? is there something I should set?
thanks, will update regularly to see if the date cross-over seems to occur at GMT 1200am. -
Hi,
I have a JSP based web application that works well when deployed in Tomcat 6. I am trying to deploy it in jboss 4.2.1, everything seems to be ok but when I try to access to a JSP page I have the following error
java.lang.IllegalStateException: No Java compiler available
org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:229)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:561)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
my JAVA_HOME is set to use a JDK 1.5, but it should work with a JRE as the Tomcat embedded in jboss has its own compiler. I changed the web deployer configuration to use the sun compiler instead of the default but I have the same problem despite tools.jar is in the classpath. Has someone had this problem before or could someone help me on the issue ?
Thanks,
CyrilHi here is what JBOSS displays at startup, everything seems to be right and points to a JDK
JBOSS_HOME: D:\java\jboss\jboss-4.2.1.GA
JAVA: D:\java\jdk1.5.0_12\bin\java
JAVA_OPTS: -Djava.library.path="D:\java\jboss\jboss-4.2.1.GA\bin\native;..." -Dprogram.name=run.bat -server -Xms256m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
CLASSPATH: D:\java\jdk1.5.0_12\lib\tools.jar;D:\java\jboss\jboss-4.2.1.GA\bin\run.jar
To use sun compiler instead of jdt in tomcat I modified web.xml in JBOSS_HOME\server\default\deploy\jboss-web.deployer\conf and added the following to the jsp servlet configuration
<init-param>
<param-name>compilerClassName</param-name>
<param-value>com.sun.tools.javac.main.Main</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.5</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.5</param-value>
</init-param>
but I have the same error as when I use the jdt compiler. I'm clueless on what else I could try from here, I posted also the issue on jboss forums last week but haven't got an answer so far, I suspect a classloader side effect with my application as I get the same error accessing the jboss web-console only when my application is deployed. -
Hello,
my first post here and I hope not my last post.. I submit you the question hoping someone can help me out.
The thing is: I've got a WAR that I want to include inside a JAR, which itself consists of a Jetty embedded plus the needed jars to deploy the WAR. I'm trying to make a single jar with the one-jar utility, but after constructing the single jar and trying to use it, it reports the " java.io.FileNotFoundException" for the WAR. After searching on the forums and googling I tried to use the following code to load the war, but same problem filenotfound:
Class cls = NovoJetty.class;
ProtectionDomain domain = cls.getProtectionDomain();
CodeSource source = domain.getCodeSource();
URL url = source.getLocation();
String sUrl = url.getPath();My question if it's possible to do this (Ive seen guys on the internet who successfully have deployed a web application with a tomcat embedded and everything inside a jar), but I can't see to get the point.
Any help in doing this? Thank you very very much.....
PS - Sorry if it's not the right forum; if it's the case I'll move it to the right one.
Edited by: xfc on Dec 25, 2007 2:48 AMFor those interested. Finally managed to get working the winstone app server. It lets you package the server and a war as a single jar file.
Take a look at: http://winstone.sourceforge.net/ -
How to deploy war file in embedded Tomcat in UCM
Hi ,
Can anyone please share the steps to configure embedded Tomcat in UCM, And steps to deploy individual JSP and War file.
thanks,
Edited by: user4884609 on Feb 13, 2012 4:23 PMone more question :
The Url to access war file is something like this :
http://localhost/idc/groups/jsp/documents/webapps/testwar/test.jsp
Can we have friendly URL for war file ? something like http://localhost/testwar/test.jsp or may be http://localhost/idc/testwar/test.jsp ? -
Embedding tomcat to run as a webserver
Hi,
I have compiled the Embedded.java source code to work in my environment.
But the code includes the Thread.sleep , without that the code will terminate.
So the webserver is running only for the time x,
Thread.sleep(x)
The sample code is:
public static void main(String args[]) {
try {
EmbeddedTomcat tomcat = new EmbeddedTomcat();
tomcat.setPath("d:/jakarta-tomcat-4.0.1");
tomcat.startTomcat();
Thread.sleep(1000000);
tomcat.stopTomcat();
how to avoid the thread.sleep so that the webserver is running continuously until it is shutdown explicitly
ThanksTry running the tomcat service (embedded.start()) in a separate thread. I got the Embedded.java example working in this fashion by extending Thread and moving the code in the startTomcat() method to the public void run() method. To start the service, just call this.start(). Hope this helps...
-
JNDI Setup in Embedded Tomcat 5.0.19
Hi All,
I have embedded Tomcat 5.0.19 in my application, which is a simple web based database application in servlets. In Embedded Tomcat we don't have server.xml.
Reference:
http://www.vsj.co.uk/articles/display.asp?id=319
I am trying to create JNDI Context to connect to my database.
My configuration file is like this:
<naming>
<context >
<resource name="jdbc/myDS" type="javax.sql.DataSource" >
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>net.sourceforge.jtds.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:jtds:sqlserver://SQLServer:1433;databaseName=myDB;</value>
</parameter>
<parameter>
<name>username</name>
<value>sa</value>
</parameter>
<parameter>
<name>password</name>
<value>sa</value>
</parameter>
</resource>
</context>
</naming>
I have put this config file in the root directory and called thru the following method.
XmlConfigurator.loadConfiguration(getClass().getResourceAsStream("/myConfig.xml"));
Ref:
http://directory.apache.org/subprojects/naming/using.html
I have written a class which starts the embedded tomcat and calls the above method.
The following is the output of tomcat:
Apr 15, 2005 3:19:00 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Apr 15, 2005 3:19:01 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.19
Apr 15, 2005 3:19:01 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Apr 15, 2005 3:19:01 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
Apr 15, 2005 3:19:01 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
Apr 15, 2005 3:19:02 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='view.ApplicationResources', returnNull=true
Apr 15, 2005 3:19:02 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 9889
Apr 15, 2005 3:19:02 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on port 9889
I have written another class which does the context lookup function and creates the Connection Object like this:
public Connection getConnection()
Context ctx=new InitialContext();
Context jdbcCtx = (Context)ctx.lookup("jdbc");
DataSource datasource=(DataSource)jdbcCtx.lookup("myDS");
return datasource.getConnection();
but every time my web application calls this function to create a new connection it throws:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:815)
at org.apache.naming.NamingContext.lookup(NamingContext.java:198)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at view.DatabaseConnection.getConnection(DatabaseConnection.java:109)
at view.Admin_LoginValidation.doPost(Admin_LoginValidation.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
ContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:20
6)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:688)
at java.lang.Thread.run(Thread.java:534)
java.lang.NullPointerException
when I tried Context lookup in the same class which starts Tomcat, there is no problem: it gets the Name jdbc/myDB. How to make the Context Global.
Please help me out to solve this problem.
Thanks in Advance,
Prettyin the reource tag u have somet hing called global attribute which will be ur global jndi name with which u can access the resource
Context ...>
<ResourceLink name="The name of the linked global resource in the global JNDI context.
global="The name of the resource link to be created, relative to the java:comp/env context.
type="The fully qualified Java class name expected by the web application when it performs a lookup for this resource link.
r"
i think tat will work
regards
shanu
</Context> -
Debug applet embedded in jsp using tomcat and eclipse
I am trying to debug applet embeded in jsp. I have deployed my application on tomcat.
The steps I followed
1. Added JVM rumtime parameters in Java plugin control panel
-Djava.compiler=NONE -Xnoagent -Xdebug -Xrunjdwp:transport=dt_socket,address=localhost:8000,suspend=n
2. Added JPDA_ADDRESS = localhost:8000 and JPDA_TRANSPORT=dt_socket to catlina.bat
3. I start my server from commandline prompt "catalina.bat JPDA start"
4.I have made a new configuration for remote debug in eclipse debug>new> connection type (socket attach) >port 8000
5. when I open my application url in browser browser closes and command prompt displays "*Debugger failed to attach , timeout before handshake*"
Any help on this ?
Thanks in advancePersonally, I have no knowledge about Applet but have you checked this link?
[http://blogs.sun.com/thejavatutorials/entry/deployment_toolkit_101|http://blogs.sun.com/thejavatutorials/entry/deployment_toolkit_101] -
Embedded Tomcat 5.5 return 404 for all request
I am starting embedded tomcat within a Java application, but it returns 404 when i request a existing static content html file. I have no idea why is that and there is no service using the port. Please advise.
File structures are as follow:
base directory: D:\AXIS
directory with index.html - D:\AXIS\webapps\root\
other existing dir
D:\AXIS\webapps\root\WEB-INF\lib\
D:\AXIS\webapps\root\WEB-INF\
debug level is set to 5 and following is the response of log screen when i request http://localhost:7070/index.html :
Command> HttpProcessor[7070][3] An incoming request is being assigned
HttpProcessor[7070][3] The incoming request has been awaited
HttpProcessor[7070][3] parseConnection: address=/127.0.0.1, port=7070
HttpProcessor[7070][3] Normalized: '/index.html' to '/index.html'
HttpProcessor[7070][3] Request is 'GET' for '/index.html' with protocol 'HTTP/1.1'
HttpProcessor[7070][3] Header accept = */*
HttpProcessor[7070][3] Header accept-language = en-us
HttpProcessor[7070][3] Adding locale 'en_US'
HttpProcessor[7070][3] Header accept-encoding = gzip, deflate
HttpProcessor[7070][3] Header user-agent = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
HttpProcessor[7070][3] Header host = localhost:7070
HttpProcessor[7070][3] Header connection = Keep-Alive
StandardEngine[null]: Mapping server name 'localhost'
StandardEngine[null]: Trying a direct match
StandardHost[localhost]: Mapping request URI '/index.html'
StandardHost[localhost]: Trying the longest context path prefix
StandardHost[localhost]: Mapped to context ''
StandardContext[]: Mapping contextPath='' with requestURI='/index.html' and relativeURI='/index.html'
StandardContext[]: Decoded relativeURI='/index.html'
StandardContext[]: Trying exact match
StandardContext[]: Trying prefix match
StandardContext[]: Trying extension match
StandardContext[]: Trying default match
HttpProcessor[7070][3] parseConnection: address=/127.0.0.1, port=7070
Following is server start code.
public class EmbeddedTomcat {
private String path = null;
private Embedded embedded = null;
private Host host = null;
* Default Constructor
public EmbeddedTomcat() {
* Basic Accessor setting the value of the context path
* @param path - the path
public void setPath(String path) {
this.path = path;
* Basic Accessor returning the value of the context path
* @return - the context path
public String getPath() {
return path;
* This method Starts the Tomcat server.
public void startTomcat() throws Exception {
Engine engine = null;
// Set the home directory
System.setProperty("catalina.home", getPath());
System.setProperty("catalina.base", getPath());
// Create an embedded server
embedded = new Embedded();
// print all log statments to standard error
embedded.setDebug(99);
embedded.setLogger(new SystemOutLogger());
// Create an engine
engine = embedded.createEngine();
engine.setDefaultHost("localhost");
// Create a default virtual host
host = embedded.createHost("localhost", getPath() + "/webapps");
engine.addChild(host);
// Create the ROOT context
Context context = embedded.createContext("", getPath() + "/webapps/root");
System.out.println("Doc Base - " + context.getDocBase());
host.addChild(context);
// Install the assembled container hierarchy
embedded.addEngine(engine);
// Assemble and install a default HTTP connector
Connector connector = embedded.createConnector(null, 7070, false);
embedded.addConnector(connector);
// Start the embedded server
embedded.start();
public static void main(String args[]) {
try {
EmbeddedTomcat tomcat = new EmbeddedTomcat();
tomcat.setPath("D:/AXIS");
tomcat.startTomcat();
catch( Exception e ) {
e.printStackTrace();
Thanks is advance,
Jerryin the reource tag u have somet hing called global attribute which will be ur global jndi name with which u can access the resource
Context ...>
<ResourceLink name="The name of the linked global resource in the global JNDI context.
global="The name of the resource link to be created, relative to the java:comp/env context.
type="The fully qualified Java class name expected by the web application when it performs a lookup for this resource link.
r"
i think tat will work
regards
shanu
</Context> -
How to make Visitor Tracking in embedded Tomcat.
Hi, Please help me.
I want to know how to make visitor tracking in embedded Tomcat. If you know, how to catch all the incoming clients to Tomcat, please tell me. I don't know how to catch them.enable logging on the server
-
Embedded Tomcat Java Application
Hi
I am using an Embedded Tomcat Java Application.
I am getting the following Exception when i run the program.
java.lang.NullPointerException
at org.apache.catalina.startup.DigesterFactory.register(DigesterFactory.java:174)
at org.apache.catalina.startup.DigesterFactory.registerLocalSchema(DigesterFactory.java:130)
at org.apache.catalina.startup.DigesterFactory.newDigester(DigesterFactory.java:92)
at org.apache.catalina.startup.ContextConfig.createWebXmlDigester(ContextConfig.java:435)
at org.apache.catalina.startup.ContextConfig.createWebDigester(ContextConfig.java:422)
at org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:499)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:623)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.startup.Embedded.start(Embedded.java:846)
at EmbeddedTomcat.startTomcat(EmbeddedTomcat.java:77)
at EmbeddedTomcat.main(EmbeddedTomcat.java:135)
could anyone tell me how to solve this problem
Thanx & Regards
FaisalHi
R u able to resolve the problems.... If yes please provide me the info... I'm also facing the same problem...
REgards
siddhu
Maybe you are looking for
-
I'm trying to set up an Xserve at a high school in my town. Someone from a local college came to help, but he had never set up an Xserve before and we got stuck. We have already gone through the set up process (creating the account, attaching it to t
-
How do I get rid of the 'local storage' dialog once I deny it?
Whenever I try to view a video with IE11, an Adobe Flash Player Settings dialog opens up, covering the center of the video, saying: Local Storage www.whatever.com is requesting permission to store information on your computer. Requested: up to 10 KB
-
Employee training and claiming the training expnediture
Hello Experts, I have a business case where an employee needs to register for the training (internal/external) on there own thru a BAPI/Idoc. Then claim for the training expenditure thru a BAPI/Idoc. From a JSP(internet page). There is no interventio
-
Problem with SunFileBinding configured with endpoints.xml
Hello, I'm trying to confiugure the SunFileBinding using the endpoint.xml file. The idea is to pikcup a file from the filesystem and pass it to my engine. I've checked the samples under ri-components/file-binding and I (think) my descriptors are iden
-
IPod touch 4th Gen will not update or restore
I've been trying to update my IPod Touch via iTunes and now it is stuck in restore mode. You got to update and download the software but it doesn't install and keeps taking you back to restore but it just downloads the software update again etc etc.