How to write the java file and number line where execution point is?
I'd like to log errors encountered by a home made java server to a file.
To be effective, here is how I'd like to build the string to log, roughly :
String locError = "ERROR: in "+ filename +" => "+ methodname +", line "+ linenumber +"\n"; Is there a way in java to get such informations? Via reflection?
I doubt so but I'd like to make sure.
Thanks
bestam wrote:
I'd like to log errors encountered by a home made java server to a file.
To be effective, here is how I'd like to build the string to log, roughly :
String locError = "ERROR: in "+ filename +" => "+ methodname +", line "+ linenumber +"\n"; Is there a way in java to get such informations? Via reflection?
I doubt so but I'd like to make sure.
ThanksNot quite sure what you mean here. Are you trying to print out the contents of an actual Java error? If so, Throwable.getStackTrace() or Throwable.printStackTrace() are probably what you want.
Winston
Similar Messages
-
Can any one tell me how to write the properites files and how to acces
can any one tell me how to write the properites files and how to acces thoose files
plz let me no
thanks in advancehttp://www.exampledepot.com/egs/java.util/Props.html
-
How to access the *.java file corresponding to a TypeElement T?
Here is a problem:
How to access the *.java file corresponding to a TypeElement T from a AnnotationProcessor environment?
Let us say the hook method
public boolean process(Set<? extends TypeElement> annos, RoundEnvironment roundEnv)
is invoked with a TypeElement T such that T.getQualifiedname() = "a.b.c.X"
And the problem is how to locate the file that has the *.java source code for a.b.c.X?
That is the file that has the source code for a.b.c.X say "some/path/a/b/c/X.java"?
For simplicity, let us assume that TypeElement T corresponds to a top-level Java class.Pinaki wrote:
That is not something you as the annotation processor author should be asking about. That is something you the person configuring the javac environment should set up via the -d option or its equivalent.
I strongly recommend using a separate output directory hierarchy.That is the way the current implementation is. The annotation processor takes a -Aout= <some directory path> to write generated output relative to a user-specified location (which defaults to the class output location).That is contrary to the design of the annotation processing facility. The intended use is for that information to be configured via options like "javac -d".
Additionally, IMO it is a serious configuration error to put generated files and input files, presumably tracked under version control, in the same directory. Interesting you said that. We are just running some "field trial" with these things and some users want them to be in the same directory of the original *.java files (especially when their source files are spread across many roots) .
Who knows what the user wants?The user does and the user is free to (mis)configure their environment however they like ;-) However, that is the user's option and the user has control of this via the javac command line. The annotation processor is not the proper place to configure this setting; see slide 7 of http://blogs.sun.com/darcy/resource/J1_2006-BOF-0606.pdf for some thoughts on different roles in annotation processing.
presumably tracked under version control, in the same directory.version control is another 'usability issues' that we are trying to get our heads around with this stuff. "To check-in or not?" - that seems to be the question. When presented these facilities without any cue, "the users" were divided -- some wanted them to be checked-in, some did not. The context where these generated files being used -- there exists some rationale to check them in a version control system.The right answer depends on the circumstances, but IMO generally generated files should not be checked in under version control, especially if they are derived from other source files. Checking in generated files of this nature just creates the opportunity for them to get out of date with the originating files. -
How to compile other java files and run them from my own programs?
I'm developing a unit testing tool for AspectJ, which can originally generate the stubs for aspect unit to be tested. All these stubs are java files. After generation of stubs, how can I program the code to compile this unit together with these stubs, i.e. how can I put the functionality of compilation and run, e.g. command "javac *.java" and "java *", into my own code.
Hope you can understand what I mean.
Thank you in advance.When I use Runtime.getRuntime().exec(command) for executing the AspectJ compile command "ajc", "IOException createProcess error=2" always occurs, while it is ok for Java comiple command "javac".
Why this happens when I use Runtime.getRuntime().exec("ajc Hello.java Test.aj")? Is it the reason that Runtime.exec(String) may not support any command in DOS?
(ajc is the compile command for the java file and aj file.)
Thank you in advance. -
How to write the java program to retrieve the last 7 days dates
Hi,
I am having requirement that how to write the java program to retrieve the last 7 days dates. Please help me.
Regards,
AhamadIt needs any jar file.Of course!
I did using jscape.My program is running fine.But it
requires jar file.Which is licensed version.Maybe you should follow the link the the 'license' on the site I posted!
>
I have the doubt is apache provides jar file free
versionMaybe you should follow the link the the 'license' on the site I posted! -
Hi,
I have two ISE-3315 Appliances in production network.
I need someone's help to explain, how to make the Secondary node as the primary admin note to reset-config.
And then I would like to know how to keep the license files and Certificate during the Upgrade.
Please help me to answer my questions.
Thanks
CSCO11872447The Cisco Identity Services Engine (ISE) provides distributed deployment of runtime services with centralized configuration and management. Multiple nodes can be deployed together in a distributed fashion to support failover.
If you register a secondary Monitoring ISE node, it is recommended that you first back up the primary Monitoring ISE node and then restore the data to the new secondary Monitoring ISE node. This ensures that the history of the primary Monitoring ISE node is in sync with the new secondary node as new changes are replicated.
Please Check the below configuration guide for Secondary ISE- Nodes.
http://www.cisco.com/en/US/docs/security/ise/1.0/user_guide/ise10_dis_deploy.pdf -
hai,
Im uploading a .css file and some images in Apex shared components ,now how to call the css file and images from my Application.... plz tell me detailed.....
Edited by: anoo on Nov 3, 2008 12:51 AMHi Anoo,
Sorry, didn't see that you'd started a new thread, so have answered this in 'undefined' is null (or) not an object "
Andy -
How to read the data file and write into the same file without a temp table
Hi,
I have a requirement as below:
We are running lockbox process for several business, but for a few businesses we have requirement where in we receive a flat file in different format other than how the transmission format is defined.
This is a 10.7 to 11.10 migration. In 10.7 the users are using a custom table into which they are first loading the raw data and writing a pl/sql validation on that and loading it into a new flat file and then running the lockbox process.
But in 11.10 we want to restrict using temp table how can we achieve this.
Can we read the file first and then do validations accordingly and then write to the same file and process the lockbox.
Any inputs are highly appreciated.
Thanks & Regards,
Lakshmi Kalyan Vara Prasad.Hello Gurus,
Let me tell you about my requirement clearly with an example.
Problem:
i am receiving a dat file from bank in below format
105A371273020563007 07030415509174REF3178503 001367423860020015E129045
in this detail 1 record starting from 38th character to next 15 characters is merchant reference number
REF3178503 --- REF denotes it as Sales Order
ACC denotes it as Customer No
INV denotes it as Transaction Number
based on this 15 characters......my validation comes.
If i see REF i need to pick that complete record and then fill that record with the SO details as per my system and then submit the file for lockbox processing.
In 10.7 they created a temporary table into which they are loading the data using a control file....once the data is loaded into the temporary table then they are doing a validation and updating the record exactly as required and then creating one another file and then submitting the file for lockbox processing.
Where as in 11.10 they want to bypass these temporary tables and writing it into a different file.
Can this be handled by writing a pl/sql procedure ??
My findings:
May be i am wrong.......but i think .......if we first get the data into ar_payments_interface_all table and then do the validations and then complete the lockbox process may help.
Any suggestions from Oracle GURUS is highly appreciated.
Thanks & Regards,
Lakshmi Kalyan Vara Prasad. -
How to write the listener.ora and tnsnames.ora
Hi, there
I store my oracle database in the machine A. In the machine B,
it only install the oracle without create database. How should
I write the
listener.ora and tnsnames.ora? So that the machine B could
acces the database which store in the machines A.
Could you give me a simple example and with some description.
Thanks you very much!!
nullwrjih (guest) wrote:
: Hi, there
: I store my oracle database in the machine A. In the machine B,
: it only install the oracle without create database. How should
: I write the
: listener.ora and tnsnames.ora? So that the machine B could
: acces the database which store in the machines A.
: Could you give me a simple example and with some description.
: Thanks you very much!!
1 - you can simply copy the files from the server to the client.
If they are correct, it must work fine
2 - Follow the examples inside the
$ORACLE_HOME/network/admin/samples
3 - Follow my examples:
I will try to make it simple:
The server must have the listener.ora. The client does not need
it if you don't have a database there.
I cannot tell you what is mandatory in the file, and what is not.
The listener.ora has the interface (addr or name)
to listen, the port/proto, and some info about your database
($ORACLE_HOME and Name).
#--- Listener.ora -- my minimal settings ---
LISTENER =
(ADDRESS_LIST =
(ADDRESS=(PROTOCOL= TCP)(Host=Server)(Port= 1521))
(ADDRESS=(PROTOCOL= IPC)(KEY = ORCL))
STARTUP_WAIT_TIME_LISTENER = 1
CONNECT_TIMEOUT_LISTENER = 10
TRACE_LEVEL_LISTENER = OFF
TRACE_LEVEL_CLIENT=OFF
SID_LIST_LISTENER =
(SID_LIST=(SID_DESC=
(SID_NAME = SACS)
(ORACLE_HOME=/oracle/805)))
#---- end of listener.ora ---
Both machines can, and should have similar TNSNAMES.ORA:
tnsnames.ora has the address or name of the server, and the Name
of the database you wish to connect to.
#--- tnsnames.ora --- minimal.
ORCL = (DESCRIPTION =
(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(Host=Server)(Port =
1521)))
(CONNECT_DATA = (SID = SACS)))
#--- end of tnsnames.ora ---
And finally sqlnet.ora, that is very usefull for setting secure
networks or
just logging for looking for errors. You can also set your
keepalive timeout.
#--- sqlnet.ora
TRACE_LEVEL_CLIENT = OFF
names.directory_path = (TNSNAMES)
SQLNET.EXPIRE_TIME = 10
#-- end of sqlnet.ora --
null -
How to make the java files compile for a project created outside of Eclipse
Hi^^,
I have created a project outside of Eclipse. It has the following folders
1. config
2. source
3. WEB-INF
I want to execute the project on remote server. Will it compile automatically creating a new folder for .class files corresponding to the source folder or do i need to include a build.xml to enable the project to create a new folder for .class files. Also pls tell me how do I write this build.xml
Please advise.Hi^^,
Actually I have created a project without using eclipse.
My source files are inside WEB-INF/source
Now I want to compile the files using build.xml so that I can create class files. I am using the following build.xml
<project name="jsp" default="all" basedir="./">
<property environment="env"/>
<property file="ArmorJSP.properties"/>
<!-- set global properties for this build -->
<property name="source" value="."/>
<target name="all" depends="copy, jspc, testservlet"/>
<!-- Creates jsp_servlet directory under WEB-INF\classes of the Examples Web
APP and places the compiled jsp classes into it -->
<target name="jspc">
<!-- Run ejbc to create the deployable jar file -->
<java classname="weblogic.jspc" fork="yes">
<arg line="-webapp ${APPLICATION_HOME} -compileAll -d ${APPLICATION_WEB_CLASSES} ${source}/*.jsp"/>
<classpath>
<pathelement path="${WL_HOME}/lib/weblogic_sp.jar;${WL_HOME}/lib/weblogic.jar;${ARMOR_HOME}/ARMORSecurity.jar;${ARMOR_HOME}/ARMORUtil.jar"/>
</classpath>
</java>
</target>
<!-- Creates jsp_servlet directory under WEB-INF\classes of the Examples Web
APP and places the compiled Servlets classes into it -->
<target name="testservlet">
<!-- Run ejbc to create the deployable jar file -->
<javac destdir="${APPLICATION_WEB_CLASSES}" srcdir="${source}" includes="*.java">
<classpath>
<pathelement path="${WL_HOME}/lib/weblogic_sp.jar;${WL_HOME}/lib/weblogic.jar;${ARMOR_HOME}/ARMORSecurity.jar;${ARMOR_HOME}/ARMORUtil.jar"/>
</classpath>
</javac>
</target>
<target name="copy">
<copy todir="${APPLICATION_HOME}">
<fileset dir="${source}">
<include name="*.jsp"/>
</fileset>
</copy>
</target>
</project>I do not know how to compile the project using this build.xml
The motive of doing all this is to understand how is Eclipse doing the build project step. I simply cannot find any build.xml inside any of my projects created in Eclipse however when right click on the project and choose build project, it compiles excellently. ???
Edited by: pksingh79 on Nov 24, 2008 1:19 PM -
How to upload the tif file and Display into Iframe
Hi all,
My requirement is to upload 'n' number of tif files and display the file name in dropdown.
If i select the file name, it should display the file in Iframe.
My problem is i am not able to upload the tif file.
try{
byte []by=new byte[wdContext.currentContextElement().getPhotoResource().read(true).available()];
wdContext.currentContextElement().getPhotoResource().read(true).read(by);
String ext=wdContext.currentContextElement().getPhotoResource().getResourceType().getFileExtension();
WDWebResourceType res=wdContext.currentContextElement().getPhotoResource().getResourceType();
IWDResource resource=null;
resource=WDResourceFactory.createResource(by,"sample",WDWebResourceType.getWebResourceTypeForFileExtension(ext));
wdContext.currentContextElement().setPhoto(resource.toString());
catch(Exception e){
In the above code Photo is Iframe Context variable.
If i upload tif file means it directly giving Save and Open options is giving.
Please how to slove this probelm...........................
Thanks,
SuniHi Satya,
In HTML a TIF file can be displayed as"
<html>
<body>
<object height="100%" width="100%"
type="image/tiff" data="PO.tif">
</object>
</body>
</html>
Hope it helps.
Regards,
Alka -
How to Read the "text file and csv file" through powershell Scripts
Hi All
i need to add a multiple users in a particular Group through powershell Script how to read the text and CSV files in powershell
am completly new to Powershell scripts any one pls respond ASAP.with step by step process pls
Regards:
Rajeshreddy.kHi Rajeshreddy.k,
To add multiple users to one group, I wouldn't use a .csv file since the only value you need from a list is the users to be added.
To start create a list of users that should be added to the group, import this list in a variable called $users, the group distinguishedName in a variable called $Group and simply call the ActiveDirectory cmdlet Add-GroupMember.
$Users = Get-Content -Path 'C:\ListOfUsernames.txt'
$Group = 'CN=MyGroup,OU=MyOrg,DC=domain,DC=lcl'
Add-ADGroupMember -Identity $Group -Members $Users -
How to read the source file and copy the entire content to the target Database field
Hi All,
PI system extracts the actual business content from the incoming attachment file and copy the entire format to the target Database field which is a blob data type field.
Sender Adapter: SOAP
Receiver Adapter: JDBC
JDBC Structure
Can we achived the above requirement by using UDF with out Java Mapping?
Thanks,
Mahi.Ok, in this case yo can use the conten converion of the file adapter. Therefore you first need to create a Datatype in ESR with the required structure
Then in your file adapter you need to use this datatype and its required fields:
The Datatype then can be used as usual within you mapping.
regards
Christian -
How to attach the .emp files and .rar files in this forum.
Dear Sir ,
I want to attach the ".emp" file or .emp file stored in the "rar", how to attach these files in this forum because whenever I am going to attch the .emp file or .rar file , it is showing the error that " The contents of the attachment doesn't match its file type".Well, you might think that. But you would be wrong.
I'm not aware of any unix OS with an undelete function at the filesystem level.
Such things don't tend to work well in a multiuser/server environment where lots of things are writing to the disk in the background.
And trying to guess what the filesystem used to look like is a good way to court random file system corruption. -
How to Parse the XML File and create an IDOC?
Hello friends,
I've an xml file which needs to be parsed and create an idoc into SAP to post the New Hire process? I need to create an ABAP for this
Could somebody help me do this?
Thankshere is the sample code for loading local xml file and parsing its using the abov ementioned FM
report y_xml_upload
no standard page heading.
data: filename type string ,
xmldata type xstring .
data: result_xml type standard table of smum_xmltb .
data: return type standard table of bapiret2 .
constants: line_size type i value 255.
data: begin of xml_tab occurs 0,
raw(line_size) type x,
end of xml_tab,
file type string,
size type i.
* upload the xml file
filename = 'C:raja123.xml' .
call function 'GUI_UPLOAD'
exporting
filename = filename
filetype = 'BIN'
has_field_separator = ' '
header_length = 0
importing
filelength = size
tables
data_tab = xml_tab
exceptions
others = 1.
************uncomment this and comment the call of SCMS_BINARY_TO_XSTRING if you dont have this fm in your system.
* if sy-subrc <> 0.
* clear: xmldata.
* exit.
* else.
* data: len type i.
* len = size.
* loop at xml_tab.
* if len <= line_size. exit. endif.
* concatenate xmldata xml_tab-raw(line_size)
* into xmldata in byte mode.
* len = len - line_size.
* endloop.
* if len > 0.
* concatenate xmldata xml_tab-raw(len)
* into xmldata in byte mode.
* len = len - size.
* endif.
* endif.
******* end of comment.
call function 'SCMS_BINARY_TO_XSTRING'
exporting
input_length = size
* FIRST_LINE = 0
* LAST_LINE = 0
importing
buffer = xmldata
tables
binary_tab = xml_tab
exceptions
failed = 1
others = 2
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'SMUM_XML_PARSE'
exporting
xml_input = xmldata
tables
xml_table = result_xml
return = return .
Regards
Raja
do not forget to assign points to helpful answers
Maybe you are looking for
-
How can I display a specified row from a chart in a 2nd chart in Numbers?
I have a chart in Numbers '09, which contains tasks with their due dates. This chart is rather large and is divided into several categories (i.e. home, work, taxes, etc.). Each row in the chart has a task name and due date in addition to other inform
-
i cant download apps throgh wifi on my iphone however when i connect to cellular data it starts downloading. then what is wrong over wifi , i tried reset network setting but i didnt help
-
Patience running thin. max HEIGHT after I publish to bizcat.
what a piece of garbage. this is only reason i joined creative cloud. I have a site in progress and when i publish it to view in on business catalyst, the resulting site seems to have a max height, cutting off everything below 600px. All else is w
-
I erased my system folder then reinstalled Lion 10.7.3. My login in formation (both administrative and password) no longer work. I have the correct login information. I tired to change it via Terminal but it won't let me change the password. Is the
-
How to respond to live blackmailer
If they get a video of you and they are blackmailing you to send money. Just act panicked, and by as much time as you can without making them too to angry between responses. 1. Search how to find a skype username, write it down 2. Find an internet s