.ear problem with getRealPath(String path)
Repost from interest.servlet group
Hello all,
I am using weblogic 6.1/NT 4x
I have created .ear file which contains two files ejb-jar.jar and web.war which
has all jsps and other standard classes application uses.
I have followed guidelines in the documentation for creating the .ear file which
is under
Packaging Enterprise Applications @
http://edocs.beasys.com/wls/docs61/programming/packaging.html#1044277
I deployed this ear file in my applications directory through console.
Now my application needs to read image file from the
database and write it to the file system so that my
jsp pages can read the image file through html tag
<img src="/images/...">
When my MainServlet initializes I am calling the ServletConfig.getServletContext().getRealPath("/")
I am expecting this to return me the real path like http://localhost/ which it
does if I don't use ear file and do it traditional DefaultWebApp way. But in ear
file it returns me null because J2EE documentation clearly says : " 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). "
I wanted to know the workaround for this if anyone is aware of such problem.
Any feedback would be greatly appreciated.
thanks Nafis
Repost from interest.servlet group
Hello all,
I am using weblogic 6.1/NT 4x
I have created .ear file which contains two files ejb-jar.jar and web.war which
has all jsps and other standard classes application uses.
I have followed guidelines in the documentation for creating the .ear file which
is under
Packaging Enterprise Applications @
http://edocs.beasys.com/wls/docs61/programming/packaging.html#1044277
I deployed this ear file in my applications directory through console.
Now my application needs to read image file from the
database and write it to the file system so that my
jsp pages can read the image file through html tag
<img src="/images/...">
When my MainServlet initializes I am calling the ServletConfig.getServletContext().getRealPath("/")
I am expecting this to return me the real path like http://localhost/ which it
does if I don't use ear file and do it traditional DefaultWebApp way. But in ear
file it returns me null because J2EE documentation clearly says : " 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). "
I wanted to know the workaround for this if anyone is aware of such problem.
Any feedback would be greatly appreciated.
thanks Nafis
Similar Messages
-
Problem with output string to command
hey i have no idea why this aint working
its a simple output string to command.
what it is supposed to do is make a new directory given by the input string
e.g. mkdir /home/luke/dep
thanks for the help
//methods input save files
saveFile = JOptionPane.showInputDialog("Save Files To : ");
//method command for saving files
//Stream to write file
FileOutputStream fout;
try { Process myProcess = Runtime.getRuntime().exec("mkdir" + saveFile );
InputStreamReader myIStreamReader = new InputStreamReader(myProcess.getInputStream());
fout = new FileOutputStream ("file.txt");
while ((ch = myIStreamReader.read()) != -1) { new PrintStream(fout).print((char)ch); } }
catch (IOException anIOException) { System.out.println(anIOException); }What you fail to understand is that "aint working" and "Problem with output string to command" tells us absolutely squat about what your problem is. This is the same as saying to the doctor "I'm sick" and expecting him to cure you. As mentioned by Enceph you need to provide details. Do you get error messages? If so post the entire error and indicate the line of code it occurs on. Do you get incorrect output? Then post what output you get, what output you expect. The more effort you put into your question the more effort others will put in their replies. So until you can manage to execute a little common sense then the only responses you will get will be flames. Now is your tiny little brain able to comprehend that?
-
Correlation Problem in OpenScript with solveGroupJavaScript(String path).
I am having problems with the correlation of solveGroupJavaScript(String path). My script is throwing the following error.
Failed to solve JavaScript variable web.jscript.httpseformssitch...
Does anyone know how to switch of this particular type of correlation or how I can change my script to ignore it?
I have tried commenting out the line, this failed as I expected it would.
With out going into too much detail my script is a record of a manager accessing an Oracle form which allows them view only of claims made by their staff.
The scenario is
Page 1 of script
Access Form
Click on view claims bar with hidden button
Page 2
A table drops down of claims
A claim is selected to view
Page 3
Claim is shown
Page 4
Return to start
Close form
The error occurs when returning to the view claim page before closing form. I believe the problem is that the script does not find the button to view claims. On this second visit the form has reverted back to it original state with drop down table has gone. Whether it’s that that confusing the script I don’t know.
This is the line from the script
http.solveGroupJavaScript(http.javaScriptPath(
"web.jscript.httpseformssitchris_21", 1, 3, 2, 0));
And this is the post line
http
.param("source",
"{{web.jscript.httpseformssitchris_21,form1:commandButton1}}"),
The hidden button to view claims is called commandButton1. I refer to it as a hidden as it is hidden in a bar that runs across the form.
Any help would be appreciated.
Edited by: user9020510 on 09-Jul-2010 06:10I have found out how to edit my script
comment out the first line and the post line should be
.param("source","form1:commandButton1")),
/*"{{web.jscript.httpseformssitchris_21,form1:commandButton1}}")),*/
I do not fuuly understand this but it worked.
I hope this may help others
Edited by: user9020510 on 12-Jul-2010 04:53 -
Problem with getRealPath in the class ServletContext
this is a bug in tomcat 4.1
ServletContext scon=getServletConfig().getServletContext();
String path = scon.getRealPath("index.html");
this lines return the path of the archive index.html but with a caracater of espace example:
C:\Archivos de programa\Apache Group\Tomcat 4.1\webapps\prueba \index.html
----------------------------------------------------------------------------------------------^i don't think this is a bug...
if you're using a MS OS (Windows) your java environment will normally return a files path using the backslash character instead of the normal slash. -
Problem with getRealPath()?
Is there a problem with ServletContext.getRealPath() in WebLogic? Seems it
always returns a path prefixed with \applications\DefaultWebApp_myserver,
regardless of the application where the jsp/servlet resides. And that's
only if you use a context based on the jsp/servlet. If you use
getServletConfig().getServletContext().getRealPath("/"), you get null.
Any thoughts?
Never mind; I found the answer in a posting to the
weblogic.developer.interest.servlet newsgroup from July.
"Lance Harris" <[email protected]> wrote in message
news:[email protected]..
> BTW: I'm running WebLogic 6.0sp2. getRealPath() works fine under 5.1
>
> "Lance Harris" <[email protected]> wrote in message
> news:3b9936a0$[email protected]..
> > Is there a problem with ServletContext.getRealPath() in WebLogic? Seems
it
> > always returns a path prefixed with
\applications\DefaultWebApp_myserver,
> > regardless of the application where the jsp/servlet resides. And that's
> > only if you use a context based on the jsp/servlet. If you use
> > getServletConfig().getServletContext().getRealPath("/"), you get null.
> >
> > Any thoughts?
> >
> >
> >
> >
> >
>
>
-
Problem with different execution paths in hierarchical query
Hello,
I have problems with the following query:
SELECT DISTINCT P.ID FROM PRODUCTELEMENTIMPL P WHERE ( ( LABEL = 'SomeLabel' AND PRODUCTELEMENTTYPE = 'SomeText' AND ( STATE = 'created' OR STATE = 'stored' OR STATE = 'archived' OR STATE = 'archivedRestored' ) ) ) START WITH P.ID = 42 CONNECT BY PRIOR P.ID = P.PARENT
We have two databases (an Oracle 10g XE and Oracle10g Enterprise). In the XE Database the query is executed very fast, but in the main installation it takes minutes. If I "explain" the query I get two different execution paths:
The fast:
ID PARENT_ID LEVEL SQL Kosten Anzahl Zeilen
0 - 1 SELECT STATEMENT 20 49
1 0 2 HASH UNIQUE 20 49
2 1 3 FILTER - -
3 2 4 CONNECT BY WITH FILTERING - -
4 3 5 TABLE ACCESS BY INDEX ROWID PRODUCTELEMENTIMPL (TABLE) - -
5 4 6 INDEX UNIQUE SCAN SYS_C0072201 (INDEX (UNIQUE)) 2 1
6 3 5 NESTED LOOPS - -
7 6 6 BUFFER SORT - -
8 7 7 CONNECT BY PUMP - -
9 6 6 TABLE ACCESS BY INDEX ROWID PRODUCTELEMENTIMPL (TABLE) 19 49
10 9 7 INDEX RANGE SCAN PRODUCTELEMENTIMPL_IDX1 (INDEX) 3 49
11 3 5 TABLE ACCESS FULL PRODUCTELEMENTIMPL (TABLE) 19 49
Slow:
ID PARENT_ID LEVEL SQL Kosten Anzahl Zeilen
0 1 SELECT STATEMENT 1 1
1 0 2 HASH UNIQUE 1 1
2 1 3 FILTER
3 2 4 CONNECT BY WITHOUT FILTERING
4 3 5 TABLE ACCESS BY INDEX ROW 3 1
ID PRODUCTELEMENTIMPL (TABLE)
5 4 6 INDEX UNIQUE SCAN SYS_C0 2 1
020528 (INDEX (UNIQUE))
6 3 5 TABLE ACCESS FULL PRODUCT 6628 1100613
ELEMENTIMPL (TABLE)
Any ideas how to avoid this full table scan?
bye
Roland SpatzeneggerHello,
thank you for your replies. The indices and table schemas are the "same", but only the content for the tables was mirrored.
We made some tests with dropping and/or analyzing the tables, but it didn't change anything.
The main problem is that the query takes 33s in the productive environment for searching in a couple of rows. At the moment it's faster to make
SELECT DISTINCT P.ID, P.STATE FROM PRODUCTELEMENTIMPL P WHERE ( ( LABEL = 'SomeLabel' AND PRODUCTELEMENTTYPE = 'SomeText' ) ) START WITH P.ID = 42 CONNECT BY PRIOR P.ID = P.PARENT
and to test in the application if the state-values match ;-)
If I add the hint /*+ no_filtering */ in the test environment, I get the same "slow" execution path as in the production environment. So the question is, what prevents the filtering in "connect by"?
(I think in the fast version it filters only the results of the hierarchical query, in the slow version it first filters the whole table and joins/merge it with the hierachical result).
bye
Roland Spatzenegger -
Hello, I am working on a program that converts Roman numerals to Arabic numbers and the opposite. I have the Arabic to Roman part down, yet Roman to Arabic part is causing troubles for me.
I know that there are many solutions out there, yet I would like just solutions within my code that would fix the problem it has.
Instead of the whole code, here's the method that changes Roman to Arabic.
//method to convert Roman numerals to Arabic numbers
public static int toArabic (String x)
int arabica=0;
char chars;
for (int y=0; y<=(x.length()-1); y++)
chars=x.charAt(y);
switch (chars)
case 'C':
if( x.length() == 1)
arabica+=100;
y++;
else if (x.charAt(y+1)=='M')
arabica+=900;
y++;
else if (x.charAt(y+1)=='D')
arabica+=400;
y++;
else
arabica+=100;
break;
case 'X':
if(x.length() == 1)
arabica+=10;
y++;
else if (x.charAt(y+1)=='C')
arabica+=90;
y++;
else if (x.charAt(y+1)=='L')
arabica+=40;
y++;
else
arabica+=10;
break;
case 'I':
if(x.length() == 1)
arabica+=1;
y++;
else if (x.charAt(y+1)=='X')
arabica+=9;
y++;
else if (x.charAt(y+1)=='V')
arabica+=4;
y++;
else
arabica++;
break;
case 'M':
arabica+=1000;
break;
case 'D':
arabica+=500;
break;
case 'L':
arabica+=50;
break;
case 'V':
arabica+=5;
break;
There's a problem with this, however, is that whenever I put something in like XX, CC, XXX, or II, the program says
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2
at java.lang.String.charAt(String.java:687)
at RomanNumerals.toArabic(RomanNumerals.java:172)
at RomanNumerals.main(RomanNumerals.java:33)
I think this problem is caused by the if-else and else-if statements in my method for cases C, X, and I, as this problem doesn't come up when I do similar things to cases without the if statements. Could you perhaps find out what is causing this problem? I've been working on it for days after finishing the rest and I can't figure it out.
Thanksimport java.io.*;
public class RomanNumerals{
public static void main (String [] args)
DataInput keyboard=new DataInputStream (System.in);
String input;
try
//options
System.out.println("1. Roman numerals to Arabic numbers");
System.out.println("2. Arabic numbers to Roman numerals");
System.out.println("3. Exit");
System.out.print("Enter your option: ");
input=keyboard.readLine();
int choice=Integer.parseInt(input);
switch (choice)
//Roman numerals to Arabic numbers
case 1:
String romanInput, ro;
int answer1;
System.out.print("Enter a Roman numeral: ");
romanInput=keyboard.readLine();
ro=romanInput.toUpperCase();
answer1=toArabic(ro); //line 33 where the error occurs
System.out.println("The Arabic number is: "+answer1);
break;
//Arabic numbers to Roman numerals
case 2:
String arabicInput, answer;
System.out.print("Enter an Arabic number: ");
arabicInput=keyboard.readLine();
int arabic=Integer.parseInt(arabicInput);
answer=toRomans(arabic);
System.out.println("The Roman numeral is: "+answer);
break;
case 3:
break;
default:
System.out.println("Invalid option.");
catch(IOException e)
System.out.println("Error");
//method to convert Arabic numbers to Roman numerals
public static String toRomans (int N)
String roman="";
while (N>=1000)
roman+="M";
N-=1000;
while (N>=900)
roman+="CM";
N-=900;
while (N>=500)
roman+="D";
N-=500;
while (N>=400)
roman+="CD";
N-=400;
while (N>=100)
roman+="C";
N-=100;
while (N>=90)
roman+="XC";
N-=90;
while (N>=50)
roman+="L";
N-=50;
while (N>=40)
roman+="XL";
N-=40;
while (N>=10)
roman+="X";
N-=10;
while (N>=9)
roman+="IX";
N-=9;
while (N>=5)
roman+="V";
N-=5;
while (N>=4)
roman+="IV";
N-=4;
while (N>=1)
roman+="I";
N-=1;
return(roman);
//method to convert Roman numerals to Arabic numbers
public static int toArabic (String x)
int arabica=0;
char chars;
for (int y=0; y<=(x.length()-1); y++)
chars=x.charAt(y);
switch (chars)
case 'C':
if( x.length() == 1)
arabica+=100;
y++;
else if (x.charAt(y+1)=='M')
arabica+=900;
y++;
else if (x.charAt(y+1)=='D')
arabica+=400;
y++;
else
arabica+=100;
break;
case 'X':
if(x.length() == 1)
arabica+=10;
y++;
else if (x.charAt(y+1)=='C') //the line 172 where error occurs
arabica+=90;
y++;
else if (x.charAt(y+1)=='L')
arabica+=40;
y++;
else
arabica+=10;
break;
case 'I':
if(x.length() == 1)
arabica+=1;
y++;
else if (x.charAt(y+1)=='X')
arabica+=9;
y++;
else if (x.charAt(y+1)=='V')
arabica+=4;
y++;
else
arabica++;
break;
case 'M':
arabica+=1000;
break;
case 'D':
arabica+=500;
break;
case 'L':
arabica+=50;
break;
case 'V':
arabica+=5;
break;
return(arabica);
}When I put in XX as the input, this is what the error comes out as:
Enter a Roman numeral: XX
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2
at java.lang.String.charAt(String.java:687)
at RomanNumerals.toArabic(RomanNumerals.java:172)
at RomanNumerals.main(RomanNumerals.java:33) -
Comma problem with global string variable
Hi,
I'm fiighting with comma problem for global string variable. I've on page string for example "7nndqrr52vzyb,0" and by dynamic column link I'm assigning this string to global variable. Then I'm trying to display value of that global variable on another page but I see only string till comma, nothings more. I'm not sure what I'm doing wrong because when I'm trying to assign that value normally by computation process as a constant value is fine and see on another page correct string. I'll be really glad for help.
Thanks
Cheers,
MariuszWhen it tries to display the string, it sees the comma and wants to believe the string is terminated. You could escape the , in the string or replace it with a different character..
See this link: http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#BEIGDEHF
Thank you,
Tony Miller
Webster, TX
If vegetable oil is made of vegetables, what is baby oil made of?
If this question is answered, please mark the thread as closed and assign points where earned.. -
Problem with getRealPath() method
I am making a Servlet and want to get the real file-pass for the class.
And I am using ServletContext method, getRealPath(String).
But the return value is "null".
I am using *.class-file, not using *.war or *.jar file.
I am only using package.
I was able to use this Servlet in WebLogic 5.1.
Please give me Help.
vbrao wrote:
> Hi,
>
> How do I get real path in weblogic 8.1 server when I deploy a webapplication?
> I am getting null when I used getServletContext().getRealPath() method.
>
>
> thanks
>
>
Is this from a war file? War files always return null for this method
From the servlet2.3 javadocs : "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)."
-
hi
i am new here
2 days ago i was finish my database administrator course.-it mean that is the first course from 6(as much i know)
first you should know that english is not my lang so if i will maskes i am sorry
anyway after i am talking about me i will talk about my problem
i am trying to connect to sqlplus
after i click on this tool i get
user name:
pass:
host string:
i know that i need to go to the file tnsnames.ora and take from there the host string
i did that and after the parameter "host=" i saw the host string name.
after i did that i tried to connect with sysdba but without pass cuase if i conn with sysdba i dont need pass
in "host string " i write the host string accurding to the tnsnames.ora ang it doesn't work
as aresult i get a line that ask me the pass what sould i do?
tasks to all of you![b]"Host string" entry to connect through SQL*Plus is the SID entry from the tnsnames. Not the parameter host=...
This is the first parameter, something else like the following :
DEMO92 =
(DESCRIPTION =
(ADDRESS_LIST =...The host which you said is the hostname which is the host of the database, not thedatabase itself.
Nicolas. -
The problem with the strings Convert each other
Hello all,
Could you help me to solve the following problem using LV7.1? Thank in advance.
How can I convert a string of "hexadecimal value" with Normal display style to other string of " the same hexadecimal value" with Hex display style?
Best regards,
Evan_LvHi Evan,
look at the attachment
At the moment there is no error checking (any characters other than (0-9|A-F|a-f) will give an error; only even number of chars is converted). You can do the error checking as an exercise on your own!
Message Edited by GerdW on 08-21-2007 09:08 AM
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome
Attachments:
HexString.vi 22 KB -
Hi,
I have a report (made with crystal reports) in wich I have embedded a xcelsius dashboard. I am passing string values to that dashboard using a crosstab (I am forced to do this that way due to programming and database limitations). Examples of those string would be :
15426, 1000, 34567, ...
In my xcelsius model, i then extract each of the values to separate columns and use them to populate a table. I use FIND and MID functions to do so. I then get the following
CELL A1 : 15426
CELL A2 : 1000
CELL A3 : 34567
CELL A4 : =A1A2A3+A4
When i hit preview, i get all the values in my table exept the cell A4 value... its like xcelsius cant make the calculations passed a certain level .....
I tried to copy/paste the string directly in my xcelsius model with same results...
Thanks for your help guys
PS: Sorry for my real bad english... I tried my best to explain my problem...hi ,
i have also same problem, in my case alll value are string type, now i want to change them in numeric in excel but i am not getting correct answer.
i tried a lot method, but they did not work, then i multiply every field with 1 and then add them in this case its showing value result but some time the result is wrong. i can findout whats the problem.
can anyone suggest how to change value from string to numeric in excel or what should i do.
regards,
PIyushGahlot -
Updated to CR 2008 - now have new problem with truncated String fields.
Hi there
I'm hoping someone has a simple answer for this one... notice there's a lot of it on forums but I haven't found an answer.
Since updating to Crystal 2008 (Crystal 12), we have found that some reports are suddenly truncating string fields at 255 characters, despite the field value being much longer in the database.
Does anyone know what to do to allow these fields to print in completion?
Database connection is ODBC RDO.
regards
-KarenWhat is the database Oracle, SQL server etc.
Can you query the database directly with another query tool, eg SQL Server Management Studion or SQL developer/Toad for Oracle.
You can then run the Crystal query directly and see if its your ODBC connection that is truncating the datafield or Crystal.
I have memo fields on SQL server with up to 2000 characters and these display in Crystal 2008 without any problem. We use ODBC (RDO) too.
Ian -
Putting an image into a jtextpane / problems with ImageIcon and path
So here is what I am trying to do. I would like to be able to allow the user to add images to a jtextpane which will also contain rtf text.
My current plan is to have a drag event or some other event run the actual code to place the image in the jtextpane. So my first attempt was just to first write a test program to add an image to a textpane using a hard coded path. The problem is i cant seem to create an imageicon using a canonical path because the image icon constructor wants a relative path(from the docs).
So i guess the best solution would be to convert the canonical path to a relative path. I have this forum and google many times and found many similar posts but none with a real solution (people just reply, why would you want to do that etc.).
So i either need to convert the path or if any one has a better suggestion to allow users to add images to the jtextpane. Any suggestions?show the path you are trying to use.
Edited by: JacobsB on Mar 13, 2008 1:11 PM
and try this
URL url = getClass().getResource(pathName);
ImageIcon(url); -
Problems with java.library.path
Hi.
I'm having trouble with the java.library.path setting. Ok, this is the scenario:
My app is inside a JAR. What I need is to load a native library, and for user convenience I'm putting some common locations manually in java.library.path. Like this:
// append custom path for the native libraries
String libraryPath = System.getProperty("java.library.path");
String sep = System.getProperty("path.separator");
libraryPath = "." + sep + "libs" + sep + "native" + sep + libraryPath;
System.setProperty("java.library.path", libraryPath);
System.out.println(libraryPath);Pretty easy, right? (This is the first thing in my main method). Ok, so I've put the native libraries in the same dir than my JAR. I just do 'java -jar myjar.jar' and my app spits this:
.:libs:native:/usr/java/jdk1.5.0_06/jre/lib/i386/client:/usr/java/jdk1.5.0_06/jre/lib/i386:/usr/java/jdk1.5.0_06/jre/../lib/i386so my hack is working but... voila! I get UnsatisfiedLinkError.
What is really annoying and has me out of my mind is the fact that if I run my app as:
java -Djava.library.path=. -jar myapp.jarit works! If I do this my app prints:
.:libs:native:.and everything works as expected. What the ff$�(�&$ is going on here??
Please, help me I'm desperate.
Thanksthis one drove me batty for a while too.
once the library path is set, that's it, playing with it has no effect.
my solution involved a new instance the VM, something along the lines of:
String[] C = new String[] { "bash", "-c", "java -Djava.library.path="+libraryPath };
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec( C );
int eVal = proc.waitFor();
System.exit( eVal );
or cmd/command in C[0], /c in C[1] for a M$ system.
the err and out streams are available using proc.getErrorStream() and proc.getInputStream() as well.
Maybe you are looking for
-
Problem Previewing Spry in Browser
Hi, I've been following the Adobe online tutorials, and I'm failing miserably with Spry. Even the pre-worked, finished example files will not display properly in Internet Explorer 7. I refer to the files regarding "Using the Spry Framework for Ajax"
-
To update or not to update that is the question.....
I recently RMA my WRT54G V5 and hoped they would send me a V1,2 or 3...of course they didn't! Soooooo, I got another V5 POS and it has the older FW 1.06 or something like that. Should I update it to the 1.09 or not? I read somewhere that peopl said i
-
Adding a checkbox to a form report
Hi there, I've built a multi-item form in APEX 3.1.2, based on the following query: SELECT id, ticker, deal_date, deal_type, no_shares, price_per_share, commision, stamp_duty, DECODE( trade_grou
-
Reconnecting Application and opening a new applications
My issue is that using server 2012 R2, I have setup any connections that have been disconnected and try to reconnect. All the programs seems to work fine except our internal ERP software which reconnects then opens another instance of the software. H
-
I have a G5 w/ FCP HD 4.5...made some updates (also on quicktime now 7.1.2) and at startup (when the cinema slate is on) it crash...any suggestions? thanks, David