Struts getting real path
I'm using struts framework how can I access the webcontents path the folder containing the jsp, web-inf
I'm using struts framework how can I access the webcontents path the folder containing the jsp, web-inf The same way as with Servlets/JSPs
String contextPath = getServletConfig().getServletContext().getRealPath("/");andi
Similar Messages
-
Get real path in non servlet class
Hi,
I've created a ServletContextListener class that loads a thread at application startup and kills it and application shutdown.
The thread periodically monitors a specific file. I need to pass a real file path to the thread, but because the thread class is not a servlet, I cannot use the getServletContext().getRealPath("").
What are my options?The ServletContextListener has access to both the ServletContext as well as the Thread.
So the solution can be to get the path in the listener and pass it as a parameter to the constructor or a setter method of the thread. -
Hi..Am developing a website using jsp in tomcat. There is a page through which I can upload images to the server. Its working in my local server. I am using the following code to get the real path of the folder where I want to upload the image:
<%@ page language="java" import="java.io.*" %>
<%
String savepath="";
ServletContext sc = getServletConfig().getServletContext();
savepath = sc.getRealPath("/") + "uploads";
out.println(savepath);
%>
I am getting the path as "C:\Program Files\TSW\Tomcat5\webapps\mysite\uploads" where 'uploads' is teh folder where I am saving the images. Its working fine.
But when I am using the site in my internet server, I am getting the path as "/home/somename/public_html/mysite/uploads".
Is there anyway I can get the physical path to this folder? Pls help. Its very urgent. Thanks in advance.By your 'internet server' do you mean one you do not run yourself, but one that someone else hosts?
If so, then the path given probably IS the physical path, and the server is running on a Linux/Unix machine... -
Hi,
I'm trying to access a file stored on my webserver using fileinputstream but I can't find the file becuase I need to get the real path of the files location. I'm trying to achieve this by using:
config.getContextPath().getRealPath("/")config being defined as:
public void doGet(HttpServletRequest request,HttpServletResponse response, ServletConfig config)but it keeps giving me the error: cannot find symbol: method getContextPath()
Does anyone have any idea why this is?
Many Thanks!However, it does exist here http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
So call config.getServletContext().getRealPath()....
- Saish -
How to get the real path of the application in a JavaBean?
Hi everyone,
I know this has been asked several times before, but I I am not really satisfied with the answers... :-)
I am writing a webapp which uses XML files for storing information, the "business" logic is in JavaBeans. So far I just used hardcoded paths, now I will have to put the thing on a server and need a better solution.
I understand I can use getServletContext().getRealpath() but that doesn't work in a Bean.
One solution would be to fill a (hidden) field calling that and passing the field to the Bean, but I don't really like that solution.
I am using Java Studio Creator 2 (Update 1), isn't there a way to access the ApplicationBean instance in my JavaBeans? As I understand it, I could get the path from there as well.
Thanks!When you create the bean that contains the business logic you will have to pass in the real path either as a constructor parameter or by setting a property of the bean.
-
How to get the real path of the xml file
I have a java application
following is the package structure
com>>gts>>xml
having file---------> MyXML.xml
com>>gts>>java
having java program to read the file
Problem is if I use File file = new File("..\\xml\\MyXML.xml");
java.io.FileNotFoundException: E:\LEARNING_WORK_SPACE\JavaXml\..\xml\MyXml.xml (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
How do I get the real path of the xml file.
Edited by: shashiwagh on Jan 29, 2010 11:46 AMHi,
if your XML file is inside a package you can easily get it from the classloader.
Note that your application maybe packaged inside a jar so it is not safe to use java.io.File for this purpose.
You have an xml file in :
com/gts/xml/MyXML.xml
in a class of the same module (that will packaged in the same jar) for example com.gts.java.XmlLoader :
// To get the stream :
InputStream is = this.getClass().getResourceAsStream("/com/gts/xml/MyXML.xml");
// Or the URL :
URL xml = this.getClass().getResource("/com/gts/xml/MyXML.xml");Hope it helps. -
How do I get the real path!!!
I am trying to get the real path:
http://xxxxx/listusers.do?section=xxx
But when I am using request. getRequestURI() I get
listuser.jsp which is the value that listusers.do returns.
How do I get the real path?????hehe
You can't get the real path from a virtual
path..that's why you have virtual paths. -
Problem for getting the real path using one servlet and one jsp page
I have one tomcat machine and several virtual domains. Eahc virtual domain has one realpath in the disc.
I am using one servlet and one jsp page for using this servlet.
my purpose is to load, using the servlet , the real path for the domains (eahc domain has its path).
for this i make this:
the servlet code is this:
package utils.ticker;
import java.io.*;
import java.io.File;
import java.io.IOException;
import java.net.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class Edicion extends HttpServlet{
public Edicion() {
public String cc(){
ServletContext myContext= getServletContext();
String abspath = myContext.getRealPath("/");
//here i want to return the real path
return abspath;
public static void main(String args[]){
and the jsp page is:
<%@ page import="utils.ticker.*" %>
<jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
<html><head><body>
<%
tick.cc();
%>
</body></head></html>
But this produces one error, NullPointerException and dont shows me the real path.
Can anyone help me?
thanksi have put this into one sevlet:
package utils.ticker;
import javax.servlet.ServletContext;
public class Edicion{
private ServletContext myContext;
public Edicion(ServletContext myContext) {
this.myContext = myContext;
public String getCC(){
return myContext.getRealPath("/");
and in the jsp page this:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"%>
<%@ page import="utils.ticker.*" %>
<jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
<html><head><body>
<%=tick.getCC()%>
</body></head></html>
but appear this error in the tomcat.
Can you, please, help me. i am trying to solve this during one week and i am desesperate.
Thanks.
ERROR:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)
root cause
javax.servlet.ServletException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.pruebas_jsp._jspService(pruebas_jsp.java:72)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)
Apache Tomcat/4.1.18 -
File dialog box: how get full path and filename (firefox 3.0 problem)
Hi,
I have a smilar problem then discussed in this thread: file dialog box: how get full path and filename
Now this solution doesn't seem to work in firefox 3.0,I only get the filename but not the full path.
I have tried to solve this problem by adding *"netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");"* in a javacript function but that doesn't do the trick
Although when i tested it local it does work.
Any idees how to solve this?
Best Regards
StijnActually, that is strange and scarry. With 20% of the browser market share they decide to behave like Microsoft did in the past - they want to decide what users need and what they do not need. With 3.0 I have a real problem with some of my applications. They are all tested in IE6, IE7, FF2.0 and they all work the same way (they even work with Opera and Safari). Now, I will for sure not go there and make it work for 3.0, just because 2 out of 200 users use FF3.0. Up to now I have always recomended FF as the best browser. 3.0 causes my opinion to change completely. Competition is always good but it is a question if it is good if we have 20 different browsers out there with equal market shares.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Probelm in getting absolute path of the application folder?
I have problem in getting the absolute path of the application folder.
I wriiten the following line in my action class:
String absPath = getServlet().getServletContext().getRealPath("/");
when i run my application 'DTH' in Tomcat server, I am getting correct path :
C:\Tomcat\jakarta-tomcat-5.0.25\webapps\DTH
But when i run this application in weblogic server, I am getting null value for the above line.
Can any one help me in this?public java.lang.String getRealPath(java.lang.String path)
This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).
so, getRealPath() might not be a very good approach because of its different behavior when used from a war or exploded application.
What you could do is:
1. pass the path as a parameter inside web.xml (config files, log files etc)
2. For dynamic lookup of files you could make use of ClassLoader.getResource().
Hope it helps. -
How to Hide real path ??
Hi
Friends
Sorry for duplication post. because in previous thread i can't edit it
and code formatting is remains.
sorry for that.
see the following problem
====================
I have make File Upload Successfully using
dirName =servletContext.getRealPath("/uploads/");
File f = new File(dirName);
if(!f.exists()){f.mkdirs();}
out.println("<br>");
saveTo = new File(dirName+"\\"+fileName);Since it is uploaded successfully.
Now i navigate all uploaded files from perticular folder.
and want to download that file.
when i am using following code :
// LISTING FILES IN DIR
out.println("<br>");
File dir = new File(dirName);
String[] children = dir.list();
if (children == null)
// Either dir does not exist or is not a directory
else
%>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="68%" id="AutoNumber1">
<tr>
<td width="50%" align="center"><font face="Verdana">File</font></td>
<td width="50%" align="center"><font face="Verdana">Action</font></td>
</tr>
<%
for (int i=0; i<children.length; i++)
// Get filename of file or directory
String filename = children;
//out.println(filename);
%>
<tr>
<td width="50%">
<p align="center"><font face="Verdana"><%=filename %></font></td>
<td width="50%">
<p align="center"><font face="Verdana"><a href="<%=saveTo %>">View</a></font></td>
</tr>
<%
out.println("<br>");
%>
it showing real path on link when i do mouseOver on it.
So i want to hide the real path and want to download that file.
since i am not using any database for this. it is just a prototype i m making.
Can u help me to hide the actual path and we can download that file
by clicking that perticular file.
Thanks in advance.Hi, friend
Might u not still understand me yet.
actual problem is what i want to tell is :
following is my structure :
file1.pdf view
pic1.jpg view
pic3.jpg view
rom.pdf viewwhen i mouseOver on view of pic1.jpg it displayed the
link path in status bar : C:\name\JavaProg\webFUpload\build\web\uploads\pic1.jpg
but i want it should be : \webFUpload\build\web\uploads\pic1.jpg
and this is prototype only so i am not using any database.
just to display files from folder. ( that is /uploads)
2) second problem is :
when i mouseOver on other link like view of rom.pdf
it will display path of last uploaded file only that is
file1.pdf
and i m still unable to download it.
please give me proper way to download file in JSP.
Thanks -
Adding archived-real-path-enabled caused Cannot obtain XAConnection
I am migrating a web application from Tomcat 6.x to Weblogic 10.3.5. Because some features rely on reading the real path of the resources, and the returnRealPath() returns NULL on weblogic, so I added <wls:show-archived-real-path-enabled>true</wls:show-archived-real-path-enabled> in the application's weblogic.xml and tried to re-deploy. The deployment failed with following stack trace. However, before I added this entry into weblogic.xml , the deployment is successful.
<Jun 1, 2012 4:55:35 PM EDT> <Warning> <netuix> <BEA-423420> <Redirect is execut
ed in begin or refresh action. Redirect url is /console/console.portal?_nfpb=tru
e&_pageLabel=JdbcDatasourcesJDBCDataSourceMonitorTestingPage.>
Setting up initial data source (DataSource)ic.lookup('jdbc/nimscastds');
calling initializeCurrentConnection dataSource.getConnection()
Returned from init. Now should get dataSource.getConnection()
Got dataSource.getConnection()
java.sql.SQLException: Internal error: Cannot obtain XAConnection weblogic.commo
n.resourcepool.ResourceLimitException: No resources currently available in pool
NIMSCastDS to allocate to applications, please increase the size of the pool and
retry..
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResourceInternal
(ResourcePoolImpl.java:577)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(Resourc
ePoolImpl.java:342)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(Resourc
ePoolImpl.java:329)
at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.j
ava:417)
at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.j
ava:324)
at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(Connectio
nPoolManager.java:94)
at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(Connectio
nPoolManager.java:63)
at weblogic.jdbc.jta.DataSource.getXAConnectionFromPool(DataSource.java:
1677)
at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1
475)
at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:446)
at weblogic.jdbc.jta.DataSource.connect(DataSource.java:403)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
ce.java:364)
at gov.fema.web.nimcast.PoolManager.currentConnection(PoolManager.java:1
78)
at gov.fema.web.nimcast.dao.BaseDao.select(BaseDao.java:106)
at gov.fema.web.nimcast.dao.BaseDao.select(BaseDao.java:94)
at gov.fema.web.nimcast.dao.MetricsOptionDao.cacheAll(MetricsOptionDao.j
ava:138)
at gov.fema.web.nimcast.dao.MetricsSectionDao.cacheMetricsObjects(Metric
sSectionDao.java:259)
at gov.fema.web.nimcast.InitServlet.initNimscast(InitServlet.java:112)
at gov.fema.web.nimcast.InitServlet.init(InitServlet.java:46)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(St
ubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
120)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecuri
tyHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubL
ifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHel
per.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppS
ervletContext.java:1985)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(
WebAppServletContext.java:1959)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:1878)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletCon
text.java:3153)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.jav
a:1508)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedMod
uleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(Module
ListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartMod
ulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.ja
va:636)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.
java:205)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleM
oduleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(Deploym
entStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(Ap
pContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.ac
tivate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.ac
tivateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.do
Commit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.co
mmit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploym
entCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeplo
ymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(
DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.com
mit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
gWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1
484)
at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:446)
at weblogic.jdbc.jta.DataSource.connect(DataSource.java:403)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
ce.java:364)
at gov.fema.web.nimcast.PoolManager.currentConnection(PoolManager.java:1
78)
at gov.fema.web.nimcast.dao.BaseDao.select(BaseDao.java:106)
at gov.fema.web.nimcast.dao.BaseDao.select(BaseDao.java:94)
at gov.fema.web.nimcast.dao.MetricsOptionDao.cacheAll(MetricsOptionDao.j
ava:138)
at gov.fema.web.nimcast.dao.MetricsSectionDao.cacheMetricsObjects(Metric
sSectionDao.java:259)
at gov.fema.web.nimcast.InitServlet.initNimscast(InitServlet.java:112)
at gov.fema.web.nimcast.InitServlet.init(InitServlet.java:46)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(St
ubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
120)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecuri
tyHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubL
ifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHel
per.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppS
ervletContext.java:1985)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(
WebAppServletContext.java:1959)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:1878)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletCon
text.java:3153)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.jav
a:1508)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedMod
uleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(Module
ListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartMod
ulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.ja
va:636)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.
java:205)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleM
oduleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(Deploym
entStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(Ap
pContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.ac
tivate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.ac
tivateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.do
Commit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.co
mmit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploym
entCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeplo
ymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(
DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.com
mit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
gWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)I'm still not convinced that archived-real-path-enabled has something to do with the issue.
938276 wrote:
at gov.fema.web.nimcast.PoolManager.currentConnection(PoolManager.java:1
78)
at gov.fema.web.nimcast.dao.BaseDao.select(BaseDao.java:106)
at gov.fema.web.nimcast.dao.BaseDao.select(BaseDao.java:94)
at gov.fema.web.nimcast.dao.MetricsOptionDao.cacheAll(MetricsOptionDao.j
ava:138)
at gov.fema.web.nimcast.dao.MetricsSectionDao.cacheMetricsObjects(Metric
sSectionDao.java:259)
at gov.fema.web.nimcast.InitServlet.initNimscast(InitServlet.java:112)
at gov.fema.web.nimcast.InitServlet.init(InitServlet.java:46)Do you have access to this code? I would look into this and search for a possible bug that wouldn't manifest on Tomcat but does in Weblogic... Maybe connections being created but not released... I would suspect on -- PoolManager.java:178 and MetricsOptionDao.java:138 ...
Or maybe the connection expiration timeout is lower on Tomcat than on Weblogic...
Hope that helps.
Cheers,
Vlad
If you think this is helpful, please consider giving points - it is good etiquette to reward an answerer points (5 - helpful; 10 - correct) for their post if they answer your question. -
Get installation path of web application from class file
Can anybody tell me how I can get the path on disk to the root of my web application from a class file. Im running under Tomcat 5.5 and I have 3 copies of the same webapp under 3 differenet directories:
C:\xxx\dev\yyy
C:\xxx\test\yyy
C:\xxx\prod\yyy
Based on which directory the web-app, I need to do a lookup on a properties file to pull the right jdbc connection to connect to the appropriate database. So it would be similar to using getServletContext().getRealPath("/") from a .jsp file.
Thanks,
JasonSorry for not clarifying. I have a properties file with name/value pairs. I know where this properties file is and I can do a lookup in it. In this file, I have jdbc connection names which point to corresponding jdbc resources in my context.xml file.
jdbcDevDatabase=jdbc/tfmDev
jdbcTestDatabase=jdbc/tfmTest
jdbcProdDatabase=jdbc/tfmProd
These connections are for dev, test and prod databases. Now based on where the web-app is installed on disk, i.e-dev dir, test dir, prod dir, I want to retrieve the corresponding connection. The problem is I don't know how to get a handle to the web apps real path on disk without access to the request object or using getServletContext().getRealPath("/") which are not available to me in a class file.
Thanks,
Jason -
Getting the path of a resource file inside the context
I am trying to migrate some of our applications running on OracleApplicaiton Server. We have data resource xml file needs to use in the applicaiton. In Oracle Application server we used to give the actual path of the xml file to load the xml file to the parsers since we know the path of the directories after deploying the application as an ear file. How can I get the path of the files in weblogic after deployment. If this is not supported what is the alternative to get the relative path of that xml file to load in ? The xml file is in the root folder of the context.
THanks
SuneeshHi Suneesh,
Please try enabling the <show-archived-real-path-enabled> Tag to TRUE ...And then everything will work fine with the following code:
context.getRealPath()
At domain level in config.xml. For example:
<web-app-container>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</web-app-container>
*****OR *****
At the web app level in weblogic.xml. For example:
<container-descriptor>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
For Archived Applications , It is always a best practice to use the getResourceAsStream() rather than using getResource().......Below code snippet should workout in 99% cases
InputStream stream=this.getClass().getClassLoader().getResourceAsStream("someXMLorPropfile.properties");
Thanks
Jay SenSharma
http://middlewaremagic.com/weblogic/?p=408 (Middleware Magic is Here) -
Et the real path from one filter (servlet)
Whit this:
String rutaDisco = ((HttpServletRequest)request).getRealPath("/");
i get the real path, but this is deprecated.
which is the equivalent in 1,4?
how can i use the equivalent for loading the real path?
thanksIn your Filter call: ServletContext application = null;
public void init(FilterConfig config) {
application = config.getServletContext();
}Using the ServletContext you can call ServletContext.getRealPath(String path);
Cheers,
Anthony
Maybe you are looking for
-
How do you combine audio and video files?
I've brought in a video file and an audio file, but can find no way to specify that they are a single source that should be compressed together. The documentation was of no use. How do you identify video and audio files as being one source? Thanks!
-
Query regarding the ADDM Report
Hi All, My DB performance was quite slow during the last weekend because we had a major data load job and dbms_stats.gather_schema_stats jobs running simultaneously. So, we got an ADDM report generated for these 2 days and from that i could extract 2
-
Hi Guys, The Maximum number of allowed special characters in RSKC are 72. If it exceeds more then this what can we do? Thanks and regards Rajesh.
-
Hi, I have created a fairly large website for my company which has an area in the margin of every page with links to current news items. I now realise that I perhaps should have based this on a template so that I don't need to do a find and replace e
-
Hi all, I need a BAPI or function module to create a PS network with reference of Standard Nerwork. The network will be added on a WBS auto. But I just found some check BAPI and a maintain BAPI : BAPI_NETWORK_MAINTAIN. Is there any function used to C