Problem in retrieving init-param
Hi,
I am having some problem while trying to access the initial parameters throught a jsp page.
Instead of getting the avalues, i am getting null values.
Here is the web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>First Project</display-name>
<description>A Virtual Shopping Mall</description>
<!-- Input for ConfigDemoServlet.java -->
<servlet>
<servlet-name>ConfigDemoServlet</servlet-name>
<servlet-class>ConfigDemoServlet</servlet-class>
<!--Initial parameters -->
<init-param>
<param-name>AdminEmail</param-name>
<param-value>[email protected]</param-value>
</init-param>
<init-param>
<param-name>ContactNo</param-name>
<param-value>9886424818</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ConfigDemoServlet</servlet-name>
<url-pattern>/servlet/ConfigDemoServlet</url-pattern>
</servlet-mapping>
</web-app>And here is my test.jsp
<%
String AdminEmail = application.getInitParameter("AdminEmail");
String ContactNo = application.getInitParameter("ContactNo");
System.out.println("++++++++++++++++++++++++++++++++++");
System.out.println(AdminEmail); //Output is null
System.out.println(ContactNo); //Output is null
%>Thanks for your help.
Haii
The initParam that u have given has the scope inside the servlet ConfigDemoServlet. So u cant get the initparameter value for the jsp
if u rite config.getInitParameter("") inside ConfigDemoServlet u willl get teh value..
regards
Shanu
Similar Messages
-
Init-params in web.xml are not loaded (Tomcat 4)
Hello all...
I register a servlet in webapps/<my-servlet>/WEB-INF/web.xml file, and pass 1 <init-param> tag. The file gets parsed (I know because when I made errors tomcat complained during initialization). However, when in the init method of the servlet I try to access this parameter, its not there. In fact, the servlet has NO init params at all.
=================================================
I have the following web.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>XServlet</servlet-name>
<servlet-class>com.fxcm.xml.xengine.xdas.XServlet</servlet-class>
<init-param>
<param-name>xengine.configFile</param-name>
<param-value>c:/projects/re/das.config/config.xng</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>XServlet</servlet-name>
<url-pattern>/xservlet</url-pattern>
</servlet-mapping>
</web-app>
=======================================================
I have the following servlet
* XServlet.java
* Created on May 6, 2002, 1:17 PM
package com.fxcm.xml.xengine.xdas;
import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletConfig;
import java.util.Enumeration;
import com.fxcm.xml.xengine.XEngine;
public class XServlet extends HttpServlet{
/** Initiates new XServlet */
public void init(ServletConfig config)
throws ServletException
for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();){
//This statement never gets printed because the loop never enters here since there are no init parameters
System.out.println(e.nextElement());
super.init(config);
String str = config.getInitParameter("xengine.configFile");
System.out.println(str);
XEngine.init(str.trim()); //This line throws NullPointer, because str is null since there are no initParameters.
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException{
// res.setContentType( );
System.out.println("Got post request in XServlet");
PrintWriter out = res.getWriter();
out.println(XEngine.process(req.getInputStream()));
out.flush();
out.close();
================================================================
I get the follwoing error in the browser:
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
at com.fxcm.xml.xengine.xdas.XServlet.init(Unknown Source)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:400)
Please help.
Thank you,
ElanaI know what the problem is. If you call servlet with the default URL (http://host/app/servlet/package.Servlet) than Servlet DOES NOT read init parameters. I don't know why it was designed this way.
To make servlet read init parameters, you have to assign it a name and then call it with that name, like this:
<servlet>
<servlet-name>ServletName</servlet-name>
<servlet-class>package.ServletClass</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletName</servlet-name>
<url-pattern>/app/path/ServletName</url-pattern>
</servlet-mapping>
You can then call servlet using path specified in url-pattern and read init parameters in the normal way. -
How to set the init-param debug_mode to "true"
Hi All,
I wrote a custome application that will get invoked when I click the link in the SES search result page.
I could invoke the application. However, getting the following exception when I click one button in my application:
500 Internal Server Error
OracleJSP: An error occurred. Consult your application/system administrator for support. Programmers should consider setting the init-param debug_mode to "true" to see the complete exception message.
How can see the exceptions I am getting. I mean how can I set the init-param debug_mode to "true".
Thanks
KrrishNormally application.log is where I look for problems. However this time there's nothing in the application.log file.
I 'm trying a little experiment with how I build my .ear file. Usually I keep all the dependent jars of my webapp under WEB-INF/lib and then include the .war inside a .ear for command line deployment to Oracle application server (not OC4J standalone). Now I 'm trying place all my dependent library .jar files in the top directory of the .ear and then have a CLASSPATH entry in the .war's META-INF/MANIFEST.MF file to reference those jar files. This way multiple .war files inside my .ear then can reference a common set of jars without having to duplicate then under WEB-INF/lib of each war. Maven2 supports this type of packaging. In some forums this is called "skinny war" packaging.
With this "skinny war" packaging, my .ear file deploys without errors using admin_client.jar (command line deployment) to the Oracle app server. However when I access the JSF page in one of my apps from the browser, I see this OracleJSP error asking me to set the debug parameter. NOTHING in the application.log file.
On the application server host I don't have write permissions to all the application server directories (so I can set this debug param in soe global file) . I prefer being able to set this debug flag via my application's deployment plan file or web.xml.
I have a workaround by making all the .wars inside my .ear "fat" i.e. they will have their own copies of the jars instead of sharing. I guess I can try to setup a OAS shared library and accomplish this too but with the "skinny" war approach the .ear is self contained. -
hy,
can anybody help me with a problem?
Got following init-param in web.xml with <?xml version="1.0" encoding="ISO-8859-1"?>
set at the beginning.
<init-param>
<param-name>removeTemplateCache</param-name>
<param-value>/content/admin/remove?cache=templates&id=</param-value>
</init-param>
Deploying fails with SAXException saying:
Deployment descriptor "web.xml" is malformed, check against the DTD: The reference
to entity "id" must end with the ';' delimiter. (line 218, column 56)
What do I need to do to handle "special characters" in the Deployment Descriptors
?? Only Escaping doesn´t really work ..
Thanks for input.
Greetings
Seems to be a problem nobody want to answer to ..
Tried a little and found something that worked:
<?xml version="1.0" encoding="UTF-8"?>
<init-param>
<param-name>removePageCache</param-name>
<param-value>/content/admin/remove?cache=pages&id=</param-value>
</init-param>
The wonder ist called unicode and can be found in more details at: www.unicode.org
"Markus Eisele" <[email protected]> wrote:
>
>hy,
>
>can anybody help me with a problem?
>Got following init-param in web.xml with <?xml version="1.0" encoding="ISO-8859-1"?>
>set at the beginning.
>
><init-param>
> <param-name>removeTemplateCache</param-name>
> <param-value>/content/admin/remove?cache=templates&id=</param-value>
> </init-param>
>
>Deploying fails with SAXException saying:
>
>Deployment descriptor "web.xml" is malformed, check against the DTD:
>The reference
>to entity "id" must end with the ';' delimiter. (line 218, column 56)
>
>What do I need to do to handle "special characters" in the Deployment
>Descriptors
>?? Only Escaping doesn´t really work ..
>
>Thanks for input.
>
>Greetings
-
JSF - Problem in Retrieving selected record from datatable
I am new to JSF and in the process of developing a new web application using JSF.
I have problem in retrieving the selected record from a datatable. I am using h:datatable tag and h:commandlink in a column for selecting a particular row on the datatable.
I have populated the data to the datatable by binding a bean and its property.
When I retrieve also I am binding to a bean in the action attribute of the h:commandlink tag in h:column of that datatable.But when I try to bind the bindign attribute of the h:datatable tag to the datatable instance in my Bean , my JSF File gets corrupted..
How to implement this without any issue??plz help me regarding this.HI
Try the below code
DATA lo_nd_del TYPE REF TO if_wd_context_node.
DATA lo_el_del TYPE REF TO if_wd_context_element.
DATA ls_del TYPE wd_this->Element_del.
DATA lo_nd_et_postab_1 TYPE REF TO if_wd_context_node.
DATA lo_el_et_postab_1 TYPE REF TO if_wd_context_element.
DATA ls_et_postab_1 TYPE wd_this->Element_del.
DATA lt_et_postab_1 TYPE wd_this->Elements_del.
DATA: wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
* navigate from <CONTEXT> to <ET_POSTAB_1> via lead selection
lo_nd_et_postab_1 = wd_context->path_get_node( path = `ZSHP_EXTENDED_DUE_LI.CHANGING_3.ET_POSTAB_1` ).
CALL METHOD lo_nd_et_postab_1->get_selected_elements
RECEIVING
set = lt_temp.
* navigate from <CONTEXT> to <DEL> via lead selection
lo_nd_et_postab_1 = wd_context->get_child_node( name = wd_this->wdctx_del ).
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_et_postab_1.
ls_et_postab_1-vbeln = del. // adding new attribute value.
APPEND ls_et_postab_1 TO lt_et_postab_1.
CLEAR ls_et_postab_1.
ENDLOOP.
lo_nd_et_postab_1->bind_table( new_items = lt_et_postab_1 ). -
Problem with accessing init parameters from JSP file
Hi,
I have my init parameters and Jsp configured in web.xml
<servlet>
<servlet-name>TestJsp</servlet-name>
<jsp-file>/Test.jsp</jsp-file>
<init-param>
<param-name>username</param-name>
<param-value>Balboa</param-value>
</init-param>
</servlet> How do I access 'username' field from JSP file.
Kindly help.
Thanks.you can do this in the jsp
<%=config.getInitParameter("username")%>or do it in the jspInit method in the jsp:
<%! String userName = null;
public void jspInit() {
ServletConfig config = getServletConfig();
userName = config.getInitParameter("userName ");
%>
Hello <%=userName%> -
Problems with retrieving data from tables with 240 and more records
Hi,
I've been connecting to Oracle 11g Server (not sure exact version) using Oracle 10.1.0 Client and O10 Oracle 10g driver. Everything was ok.
I installed Oracle 11.2.0 Client and I started to have problems with retrieving data from tables.
First I used the same connection string, driver and so on (O10 Oracle 10g) then I tried ORA Oracle but with no luck. The result is like this:
I'm able to connect to database. I'm able to retrieve data but from small tables (e.g. with 110 records it works perfectly using both O10 and ORA drivers). When I try to retrieve data from tables with like 240 and more records retrieval simply hangs (nothing happens at all - no error, no timeout). Application seems to hang forever.
I'm using Powerbuilder to connect to Database (either PB10.5 using O10 driver or PB12 using ORA driver). I used DBTrace, so I see that query hangs on the first FETCH.
So for the retrievals that hang I have something like:
(3260008): BIND SELECT OUTPUT BUFFER (DataWindow):(DBI_SELBIND) (0.186 MS / 18978.709 MS)
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=0
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=1
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=0
(3260008): EXECUTE:(DBI_DW_EXECUTE) (192.982 MS / 19171.691 MS)
(3260008): FETCH NEXT:(DBI_FETCHNEXT)
and this is the last line,
while for retrievals that end, I have FETCH producing time, data in buffer and moving to the next Fetch until all data is retrieved
On the side note, I have no problems with retrieving data either by SQL Developer or DbVisualizer.
Problems started when I installed 11.2.0 Client. Even if I want to use 10.0.1 Client, the same problem occurs. So I guess something from 11.2.0 overrides 10.0.1 settings.
I will appreciate any comments/hints/help.
Thank you very much.pgoel wrote:
I've been connecting to Oracle 11g Server (not sure exact version) using Oracle 10.1.0 Client and O10 Oracle 10g driver. Everything was ok.Earlier (before installing new stuff) did you ever try retrieving data from big tables (like 240 and more records), if yes, was it working?Yes, with Oracle 10g client (before installing 11g) I was able to retrieve any data, either it was 10k+ records or 100 records. Installing 11g client changed something that even using old 10g client (which I still have installed) fails to work. The same problem occur no matter I'm using 10g or 11g client now. Powerbuilder hangs on retrieving tables with more than like 240 records.
Thanks. -
Problem in retrieve data in COSS and COSP from PBS using FM /pbs/select_in
hi all i have problem in retrieving data from COSP and COSS tables from PBS using FM /pbs/select_into_table in this FM i couldn't find the tables if any body knows pls reply back with the Archiving object to be use and parameters to be used.
That are controlling tables-
Have you installed PBS for Controlling ?
try http://www.pbs-bensheim.de/
A. -
Modifying the init-params for third-party handler without redployment?
Hello,
I have a custom handler used for authentication as a third-party jar file. This handler has some of the init-params which are configured in web-services.xml deployment descriptor. Typically these init-params change from one test environment to another. So user can change these parameters, but for every change I would need to redploy the application in each environement.
Is it possible to change these init-params dynamically once application is deployed? I would like to change it after my EAR file containing webservice is deployed and before a webservice invocation is made by the client.
Any help/guidance will be much appriciated...
Thanks.Duplicate post please do not respond to it. thanks.
-
Init-param tags and related settings?
Hello all,
I am completely new to all this and just recently started training for a product called ServiceCenter and was wondering how the servlet technology works in conjunction with the product.
There are servlet tags available in the web.xml for servlet names AttachmentDownload, FileDownload, FileUpload, ImageUpload, AttachmentUpload, UniqueUpload, Attachment, Image, Messages, HtmlViewer, SCLink, NavMenu, and ThemeServlet.
At this time I can find no documentation available for all the init-param tags and related settings along with explanations. If I can understand how this works, I'm sure I can get the appropriate info from the SC engineers.
And when I say I'm new to this, even that is an understatement but I look forward to a looong career and learning every bit of information passed my way.
Thanks,
AndrewSounds like 3rd party API.
First find out the package names for all of that stuff and then google on that to find the manfacturer's website. -
I have a problem in retrieving security question
I have a problem in retrieving security question because of the lack of an option that can restore him to question the safety of e-reserves .. Please solution
for security question issue u will need to contact applecare at 1800aplcare
they will need to verify ur identity so have access to id.apple.com when u call -
Changing init-param value for servlet filter after deployment
Is it possible to change the <param-value> of a servlet filter's <init-param> for a deployed app through Weblogic Console? Can't seem to find a place in the console where this is exposed.
The <init-param> of course is specified in web.xml as:
<filter>
<filter-name>foo</filter-name>
<filter-class>bar</filter-class>
<init-param>
<param-name>name</param-name>
<param-value>value</param-value>
</init-param>
</filter>Hi,
U can use "Plan.xml" feature provided by WLS to change the Deployment Descriptor values without Editing Physically inside your WAR or EAR or JAR application.
Please refer to:
http://forums.oracle.com/forums/thread.jspa?threadID=1107834
http://weblogic-wonders.com/weblogic/2009/12/16/updating-cookiename-using-plan-xml/
http://weblogic-wonders.com/weblogic/2010/03/14/adding-workmanager-using-plan-xml-to-a-war-file/
Thanks
Jay SenSharma
http://weblogic-wonders.com (Middleware Wonders Are Here) -
Recently when I connect my iphone 4 to my Mac for normal synchronising i found after a few minutes all my purchased apps were deleted and gone ? I have no problem to retrieve them back but that is exhausting and I am feeling sick ? what is the problem ? please help me and thank you
Make sure Sync Apps is checked on the Apps tab of your iTunes sync settings and that all the apps are checked that you want on your phone. Also be sure that your computer is authorized for all Apple IDs used to purchase your apps (and other media) in Store>Authorize this Computer.
-
EVDRE error "encountered problem when retrieving data from webserver"
Hi,
in a EVDRE we always get the error "encountered problem when retrieving data from webserver"
When analysing this further we noticed this is always generated when a base member is selected in the CV and the expansion on the row for this dimension is has one of the following expansion settings:
DEP
ALL
NOEXPAND
if we select SELF, the error disappears again and the EVDRE works fine again ... is this normal behavior?
there is no problem with application nor dimension.
D
solved itNote that the keyword "ALL" does not include the member itself. This may cause some confusion, but as Harish implies, when you select a base member it finds no matches if your memberset is "ALL".
If you want to design a report to handle the user moving back and forth between base and non-base members in their CV, you either need to include SELF,ALL or SELF,DEP, or something similar....
OR you need to get a little fancier, and use EVPRO to look and see if the CV member is base -- evpro(app,member,"CALC") -- and then use some conditional logic in Excel to choose the correct expansion options. If Calc=N, use Self, otherwise use SELF,DEP or whatever you choose. This can be a bit tricky if you then want the user to be able to drill down in the report (especially if you want the workbook option to insert add'l rows on the expansion, rather than replace), but it's all possible. -
Initi Param prerequisite failure in RCU for Webcenter schemas
am geting this error
he following error:
RCU-6107:DB Init Param Prerequisite failure for: open_cursors. Current value is 300, it should be greater than or equal to 500.
i did the folowing
SQL> ALTER SYSTEM SET PROCESSES=1000 SCOPE=SPFILE;
System altered.
SQL> commit;
Commit complete.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> connect /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 373293520 bytes
Database Buffers 155189248 bytes
Redo Buffers 5804032 bytes
Database mounted.
Database opened.
SQL> show parameters processes;
NAME TYPE VALUE
aq_tm_processes integer 0
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 0
log_archive_max_processes integer 4
processes integer 1000
SQL>
STILL geting error
RCU-6083:Failed - Check prerequisites requirement for selected component:OID Please refer to RCU log at C:\oracle\Middleware\rcuHome\rcu\log\logdir.2013-11-07_21-47\rcu.log for details. RCU-6107:DB Init Param Prerequisite failure for: open_cursors Current Value is 300. It should be greater than or equal to 500. RCU-6092:Component Selection validation failed. Please refer to log at C:\oracle\Middleware\rcuHome\rcu\log\logdir.2013-11-07_21-47\rcu.log for details.i did that ,i even switch off the pc,the error stl the same
SQL> connect /as sysdba
Connected.
SQL> show parameters processes;
NAME TYPE VALUE
aq_tm_processes integer 0
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 0
log_archive_max_processes integer 4
processes integer 500
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
RCU-6083:Failed - Check prerequisites requirement for selected component:OID Please refer to RCU log at C:\oracle\Middleware\rcuHome\rcu\log\logdir.2013-11-07_22-21\rcu.log for details. RCU-6107:DB Init Param Prerequisite failure for: open_cursors Current Value is 300. It should be greater than or equal to 500. RCU-6092:Component Selection validation failed. Please refer to log at C:\oracle\Middleware\rcuHome\rcu\log\logdir.2013-11-07_22-21\rcu.log for details.
Maybe you are looking for
-
PC met Windows 7 12Gb memory After updating from CS5 to CC (full version) InDesign CC (2014) doesn't start. I get the Windows message (Dutch): Kan de toepassing niet correct starten (0xc000007b). Klik op OK om de toepassing te sluiten.
-
Hi All, disp+exe is in yellow in PI 7.0 , "J2EE status info unavailable" ABAP stack is up but Java stack is down. trc file: "dev_disp", trc level: 1, release: "700" sysno 00 sid DGX systemid 560 (PC with Windows NT) relno 7000 patc
-
Upgrade FCP HD to X on Lion 10.7.3
I just bought a mini. I had no idea my FCP HD would not work on this computer. Very bummed. I cannot seem to find an upgrade, only the 800 dollar full versions. Any help is greatly appreciated!!! Thanks! IX
-
Icmp poller on solaris 10: lot's of unexplained ping failed
Hello to everybody, and if someone can help me on the following problem... I use the IBM tivoli netcool network manager icmp poller on a solaris sparc local zone server, and for a reason I don't understand, regularly, I have lot's of unexplained ping
-
IPhoto unable to open even after reinstalling.
Hello, I am not able to open iPhoto after the latest OS update. Have tried 3 times reinstalling the iPhoto but still facing the same problem. Please kindly advise how should i solve this problem. Process: iPhoto [23855] Path: /Applications