Debugging Java code
Hi,
How do i debug/step thru the code in Java? I am using notepad as editor. Is there any tool like Visual Interdev or something that i can use? I believe Forte is something similar but how do i debug code if i am using notepad as the editor?
Thanks in advance
Many people do just debug with logging or println statements. Sometimes I find it necessary to use a debugger. Don't know where you would get one from except from an IDE, such as eclipse, forte or jbuilder.
Similar Messages
-
Debugging Java code from c++ through JNI
I have c++ application calling java methods through JNI. From c++ when I call the java method through JNI how do I debug the java code? It would be of great help if I get to know the settings that I need to do. I am using VC 6.0 for C++ and JBUIlder 8 for JAVA application.OS used is Windows 2000.
Put
_asm { int 3 } to C code in the proper place and start your java application. When C code reaches this debug break it shows a dialog to attach the debugger. Attach C debugger and debug Java and C codes. -
Can I use "Adobe X Pro" to debug the java code in adobe forms?
HI,
Can I use "Adobe X Pro" to debug the java code in adobe forms?, if not how do i debug the java code written in the adobe form.I have the adobe acrobat x evaluation version installed, please find the print shot attached, I have pressed CTRL+J in the preview mode, but nothing came up.
Am I doing something wrong.. -
3DES - Php crypto codes 2 Java codes convertion problem
I give all php and java codes I convert one by one but I didnt get same result where is my mistake and what shall I do. Thanks for all.
Php Code
$key = "db9ca45ee012dcabaff193ca";
$input = sha1("MehmetKaraman");
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = mcrypt_generic($td, $input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
echo sha1(bin2hex($encrypted_data));
Output : d7eaa53ab43683a1323cfae877a24efb4a918411
Java Code :
String message= MehmetKaraman;
byte[] input = MessageDigest.getInstance("SHA1").digest(message.getBytes("utf-8"));
final Cipher cipher = Cipher.getInstance("DESede/ECB/NoPadding");
final SecretKey key = new SecretKeySpec("db9ca45ee012dcabaff193ca".getBytes("utf-8"), "DESede");
cipher.init(Cipher.ENCRYPT_MODE, key );
if( input.length % 8 != 0){
byte [] in2 = new byte[input.length+ 8- input.length%8];
for(int i = 0;i<input.length;i++){
in2=input[i];
input = in2;
final byte[] encrypted_data = cipher.doFinal(input);
System.out.println(bin2hex(MessageDigest.getInstance("SHA1").digest(bin2hex(encrypted_data).getBytes())));
Output : 626b61642ec4ba8f7467933832619d492a6fdde1Either you need$input = sha1("MehmetKaraman", true);or in your Java you need to hex encode your sha1 digest before encrypting. When I do either of these and emulate your Java bin2hex() method I get a match.
I don't understand why people seem unable to do simple debugging. If you had read the PHP documentation for the sha1() function and had printed out the results at each stage it would have been obvious.
P.S. The zero padding implemented by your codeif( input.length % 8 != 0){
byte [] in2 = new byte[input.length+ 8- input.length%8];
for(int i = 0;i<input.length;i++){
in2=input[i];
input = in2;
}can be replaced by 1 line using one of the methods in class java.util.Arrays.
Edited by: sabre150 on Sep 15, 2010 3:10 PM -
Calling java code from oracle apps form
I've created my own java .class file and am attempting to call it from an oracle applications form. I am getting a runtime error while running the form, but I don't know what the error is because nothing is being reported to me.
I've created the .java file in JDeveloper, compiled it into a .class file, deployed it to a .jar file, and placed it on the application server in a directory that the CLASSPATH can see it. I've added it to the archive parameter of the appsweb.cfg file and see that the .jar file is being downloaded when the JInitiator of Oracle Apps is started.
I have also imported the .class file into the form via the Program -> Import Java Classes which resulted in PL/SQL package stubs created to call the .class methods.
When I run the form, the java code is activated on a triggering event, PRE-INSERT. There is no java bean item in a block or on a canvas anywhere. I dont' think I need there to be since I am simply using the java code to perform actions during PRE-INSERT, not to display anything on the canvas.
I have placed debug messages throughout my code and see that the error is occuring in the PL/SQL packaged stub at the line "JNI.GET_CLASS()" where the parameter to that call is the name of my class. I know it's erroring there because I am handling the "java_error" exception. I am displaying "ora_java.last_error" in the exception handling, but it is null.
I am at a loss as to determine why I am having problems and how to display an error. Any suggestions? I'm happy to outline my steps and problem in more detail if I have missed something obvious.
We are using Forms 6.0.8.21.3 with Oracle Apps 11.5.7.
Shane.Shane,
Don't loose the heart. You have come too close to end.
The scenario you have mentioned is very unique and something which will fit more in the forms forum. So I think that was a sincere answer to help you and not a "pass the buck" card type game :)
You are lucky that you got Tapash interested into this issue, otherwise you see there is no OAF component involved out here.
I have an article promised to some of the guys but will follow this issue.
--Shiv -
Error: ORA-03113 while executing complex java code from Oracle PL/SQL
Hi,
I am trying to execute a complex java code from Oracle PL/SQL. The classes were resolved successfully. But in the middle of execution, I am getting the following error:
ERROR:
ORA-03114: not connected to ORACLE
begin
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 13685
Session ID: 21 Serial number: 20
Is there a way to debug the Java classes loaded into oracle? Or is there any utility to find out why the connection was lost?
Regards,
SaravanaHi Saravana:
You could use simply System.out.println(..) at your Java code and see the output at the .trc files generated for your Oracle session.
Or better than this adding Java Util Logging messages at your code, to see how to use JUL API at the OJVM please see this blog post [Using JUL API inside the OJVM|http://marceloochoa.blogspot.com/2007/11/getting-logging-entering-exiting-and.html].
Best regards, Marcelo.
PD: ora-0600 generally are associated with RDBMS bugs, but these bugs can be bypassed by replacing the code which throws the exception by other with a workaround. -
Error while sending Email through Java Code in OIM
Hi All,
I have created a java code using tcEmailNotificationUtil, and integrated the same with the adapter.
I am triggering this adapter when an approval process gets completed.
As soon as the approval process gets completed my email task is triggering but the task is getting rejected.
I have checked my system configuration for mail server settings.Everything seems working fine.
Can you please help me in this issue how to debug?
Thanks in advance.Hi,
Here is my log file:
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/insertTaskHistory left.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/run entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/execute entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/initialize entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getAttribute entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getAttribute left.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getUtility entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getUtility left.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.ACCOUNTMANAGEMENT] - Class/Method: tcUtilityFactory/getRemoteUtility - Data: moUtil - Value: Thor.API.Operations.tcAuditOperationsClient
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/initialize left.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/processAllByIdentifier entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
DEBUG,25 Apr 2011 10:40:00,100,[XELLERATE.DATABASE] - select A.* from (select aud_jms_key, aud_class, identifier from aud_jms order by aud_jms_key) A where rownum <= ?
INFO,25 Apr 2011 10:40:00,101,[XELLERATE.PERFORMANCE] - Query: DB: 1, LOAD: 0, TOTAL: 1
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/execute left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/run left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isSuccess entered.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isSuccess left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: SchedulerTaskLocater /removeLocalTask entered.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: SchedulerTaskLocater /removeLocalTask left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateStatusToInactive entered.
DEBUG,25 Apr 2011 10:40:00,104,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateStatusToInactive left.
DEBUG,25 Apr 2011 10:40:00,104,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateTaskHistory entered.
DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateTaskHistory left.
DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Clearing Security Associations with thread executing Scheduled task
DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/run left.
DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/execute left.
and I just wanted to ensure that my coding part is also fine.
Posting the code even:
tcDataProvider ioDatabase = new tcDataBaseClient();
tcEmailNotificationUtil sendMail = new tcEmailNotificationUtil(ioDatabase);
sendMail.setBody("Sample Message");
sendMail.setSubject("subject");
sendMail.setFromAddress("fromemailaddress");
sendMail.sendEmail("recepient");
Thanks in Advance. -
[UCCx] Change volume of an audio file (java code)
Hello guys,
Thanks to the many examples I compiled on the subject, I was able to create a script that mixes 2 audio wav files into a 3rd one. Basically the goal is to mix a first audio file containing some speech with a second one containing some music, these files being encoded identically (8 bits, 8KHz, mono wav files). The resulting file must be encoded in the same format than the initial ones.
The mixing operation is performed thanks to the MixingAudioInputStream library found online (it can be found here).
It is not the most beautiful Java code (I am no developer), but it works:
Document doc1 = (Document) promptFlux1;
Document doc2 = (Document) promptFlux2;
Document docFinal = (Document) promptFinal;
javax.sound.sampled.AudioFormat formatAudio = null;
java.util.List audioInputStreamList = new java.util.ArrayList();
javax.sound.sampled.AudioInputStream ais1 = null;
javax.sound.sampled.AudioInputStream ais2 = null;
javax.sound.sampled.AudioInputStream aisTemp = null;
javax.sound.sampled.AudioFileFormat formatFichierAudio = javax.sound.sampled.AudioSystem.getAudioFileFormat(new java.io.BufferedInputStream(doc1.getInputStream()));
java.io.File fichierTemp = java.io.File.createTempFile("wav", "tmp");
ais1 = javax.sound.sampled.AudioSystem.getAudioInputStream(doc1.getInputStream());
formatAudio = ais1.getFormat();
aisTemp = javax.sound.sampled.AudioSystem.getAudioInputStream(doc2.getInputStream());
byte[] bufferTemp = new byte[(int)ais1.getFrameLength()];
int nbOctetsLus = aisTemp.read(bufferTemp, 0, bufferTemp.length);
java.io.ByteArrayInputStream baisTemp = new java.io.ByteArrayInputStream(bufferTemp);
ais2 = new javax.sound.sampled.AudioInputStream(baisTemp, formatAudio, bufferTemp.length/formatAudio.getFrameSize());
audioInputStreamList.add(ais1);
audioInputStreamList.add(ais2);
MixingAudioInputStream mixer = new MixingAudioInputStream(formatAudio, audioInputStreamList);
javax.sound.sampled.AudioSystem.write(mixer, formatFichierAudio.getType(), fichierTemp);
return fichierTemp;
The only downside to this is that the music can be a little loud comparing to the speech. So I am now trying to use the AmplitudeAudioInputStream library to adjust the volume of the second file (it can be found here).
Here are the additional lines I wrote to do this:
ais2 = new javax.sound.sampled.AudioInputStream(baisTemp, formatAudio, bufferTemp.length/formatAudio.getFrameSize());
org.tritonus.dsp.ais.AmplitudeAudioInputStream amplifiedAudioInputStream = new org.tritonus.dsp.ais.AmplitudeAudioInputStream(ais2, formatAudio);
amplifiedAudioInputStream.setAmplitudeLinear(0.2F);
audioInputStreamList.add(ais1);
audioInputStreamList.add(amplifiedAudioInputStream);
MixingAudioInputStream mixer = new MixingAudioInputStream(formatAudio, audioInputStreamList);
javax.sound.sampled.AudioSystem.write(mixer, formatFichierAudio.getType(), fichierTemp);
return fichierTemp;
The problem is I always get the following exception when executing the code:
could not write audio file: file type not supported: WAVE; nested exception is: java.lang.IllegalArgumentException: could not write audio file: file type not supported: WAVE (line 30, col:2)
The error is on the last line (the write method), but after many hours of tests and research I cannot understand why this is not working... so I have added some "debugging" information to the code:
System.out.println("file1 audio file format: " + formatFichierAudio.toString());
System.out.println("file1 file format: " + ais1.getFormat().toString());
System.out.println("file2 file format: " + ais2.getFormat().toString());
System.out.println("AIS with modified volume file format: " + amplifiedAudioInputStream.getFormat().toString());
System.out.println("Mixed AIS (final) file format: " + mixer.getFormat().toString());
AudioFileFormat.Type[] typesDeFichiers = AudioSystem.getAudioFileTypes(mixer);
for (int i = 0; i < typesDeFichiers.length ; i++) {
System.out.println("Mixed AIS (final) #" + i + " supported file format: " + typesDeFichiers[i].toString());
System.out.println("Is WAVE format supported by Mixed AIS (final): " + AudioSystem.isFileTypeSupported(AudioFileFormat.Type.WAVE, mixer));
System.out.println("Destination file format: " + (AudioSystem.getAudioFileFormat((java.io.File)f)).toString());
AudioInputStream aisFinal = AudioSystem.getAudioInputStream(f);
System.out.println("Is WAVE format supported by destination file: " + AudioSystem.isFileTypeSupported(AudioFileFormat.Type.WAVE, aisFinal));
try {
// Ecriture du flux résultant dans un fichier
javax.sound.sampled.AudioSystem.write(mixer, formatFichierAudio.getType(), fichierTemp);
return fichierTemp;
catch (Exception e) {
System.err.println("Caught Exception: " + e.getMessage());
Which gives the following result during execution:
file1 audio file format: WAVE (.wav) file, byte length: 146964, data format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame, , frame length: 146906
file1 file format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame,
file2 file format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame,
AIS with modified volume file format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame,
Mixed AIS (final) file format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame,
Mixed AIS (final) #1 supported file format: WAVE
Mixed AIS (final) #2 supported file format: AU
Mixed AIS (final) #3 supported file format: AIFF
Is WAVE format supported by Mixed AIS (final): true
Destination file format: WAVE (.wav) file, byte length: 146952, data format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame, , frame length: 146906
Is WAVE format supported by destination file: true
So everything tends to show that the format should be supported and the mixed AIS should be written to the file... but I still get the error.
I am really confused here, if someone could help it would be great.
Thanks in advance!
PS: I have attached print screens of the actual script, without the "volume adjustment" code.Hi,
well I started writing a similar solution but it did not work either so I just put it on hold.
I also tried to get hold of the streaming "device" abstraction of UCCX to adjust the volume while "playing" but that was a dead end, too, unfortunately.
Sorry about my previous comment on your StackOverflow post, that time I thought it was kind of out of context but I believe you only wanted to ask about this issue on all available forums.
G. -
Tips on how to write efficient java code for java mapping
hi
I do not have much knowledge in Java
Can anybody tell me some tips on how to write efficient and optimised java code to be used in java mapping
Thanks,
Loveenahi D'za,
JAVA in xi
A very important place where you will use JAVA in XI is while doing your Mapping. There will be cases when JAVA MAPPING is the best solution to go for. There are 2 types of Parsers available for JAVA Mapping. DOM Parser and SAX parser. Just got through the following links to understand more on Java Mapping and the APIs available.http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
JAVA mapping -
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
sample code for java mapping
Re: Example code DOM PARSER API -
http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html DOM --- /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs tutorial sax and dom
For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/
SAX AND dom PARSER ( BY thorsten) -
example /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs java mapping example ( testing and debugging) /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
regards
biplab
Use a Good Subject Line, One Question Per Posting - Award Points -
Logging Not Working in Java Code
Hi everyone,
I'm looking into the Java code for the Portal app, and I'm trying to do some debugging as to what's going on. I see a lot of the Adobe classes use the log4j Logger to output general logging information as well as errors, but there never seems to be any output in the log files. The files I'm checking for activity are:
Adobe LiveCycle ES2\jboss\server\lc_turnkey\log\server.log
Adobe LiveCycle ES2\jboss\bin\correspondencemanagement.log
When I build and deploy the application onto the LC server, just before my application starts I get the following line in the server.log:
2011-04-29 14:30:49,055 INFO [STDOUT] **** No servlet context set in ServletLogTarget - logging disabled.
followed by a message saying that my application has started. The line above happens everytime I re-deploy the application (without actually running the app), right before it starts, so I'm assuming that it is directly related to my application.
The only 'com.adobe' related logging lines that happen in the correspondencemanagement.log file are written when I physically run the app, and I get the following line:
2011-04-29 14:31:34,298 69729 INFO [com.adobe.dct.service.impl.DataDictionaryRegistryServiceImpl] Fetching Complete Data Dictionary object graph.
Looking into the code for the com.adobe.dct.service.impl.DataDictionaryRegistryServiceImpl class, I see it uses a completely different logging system (ie not log4j).
*sigh*
I've changed the services-config.xml file and tried setting the logging target to both flex.messaging.log.ServletLogTarget and flex.messaging.log.ConsoleTarget, but neither seem to make a difference.
I must be missing some kind of configuration to get the logging to work correctly, but Google has been little help as well.
Hopefully someone has crossed this issue before, and has a solution? Any help / pointers / advice etc welcome and appreciated!!!
Thanks,
KristianThanks for the reply Saket.
It turns out that the logging was working correctly all along. The messages I could not find were all related to bootstrap code. I was assuming that the bootstrapper would run each time the application was deployed, or at the very least each time the server was started. It turns out that you manually need to run the bootstrapper. So I was looking for log lines that would never appear by themselves. Once I manually ran the bootstrap process, the log lines ran as expected.
Cheers,
K. -
How to debug Java adventure with jdb
Hi,
I'm learning J2ee and I'd like to use and debug
Java adventure. I tried to find some information but found nothing.
What I tried to debug , is to start the j2ee server by adding the following options into the bin/asadmin.bat file:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
This it doesn't work because the j2ee server is started with the javaw.exe virtual machine. So I'm stuck here.
My first question: 1- what visual debugger is great to debug J2ee apps ??
I'd like to known what are the steps to:
2- how to start the j2ee server in order to attach the jdb or a visual
debugger ?
3- when starting the j2ee server, what do i have to do in order to step
into the code source of Java adventure and follow function calls ?
4- how do I have to start the jdb to attach to the J2ee server ?
5- Any useful tip to debug J2ee apps ! :-)
Thanks in advance !
WaltereoHi,Hello
I'm learning J2ee and I'd like to use and debug
Java adventure. I tried to find some information but
found nothing.
What I tried to debug , is to start the j2ee server by
adding the following options into the bin/asadmin.bat
file:
-Xdebug
ug
-Xrunjdwp:transport=dt_socket,address=8000,server=y,sus
end=nThat looks OK.
This it doesn't work because the j2ee server is
started with the javaw.exe virtual machine. So I'm
stuck here.javaw.exe implies you are on a win32 machine. The default
debugging transport on win32 is shared memory... but you specify
a socket connection on the debugee command line above. This
means you need to specify sockets on the debugger side as well.
For example:
jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000
Note the port number (8000) matches the value you specified
when starting the debugee.
>
My first question: 1- what visual debugger is great
to debug J2ee apps ??For a list of debugging tools, check this web page:
http://java.sun.com/products/jpda/using.html
Many of these products work well in a J2EE environment.
Most of them are either free, or come with an introductory
"try before you buy" offer.
I'd like to known what are the steps to:
2- how to start the j2ee server in order to attach
the jdb or a visual
debugger ?You are on the right track with the flags/options you
mentioned.
3- when starting the j2ee server, what do i have to
do in order to step
into the code source of Java adventure and follow
low function calls ?The code you want to examine needs to be compiled
with the "-g" flag added to the javac command line.
When -g is specified, javac will save information
in the .class files that is used later during debugging.
4- how do I have to start the jdb to attach to the
J2ee server ?See above...
For more coverage on this topic, refer to:
JPDA Connection and Invocation Details
http://java.sun.com/j2se/1.4.2/docs/guide/jpda/conninv.html
5- Any useful tip to debug J2ee apps ! :-)That is a bit outside the scope of this forum... sorry.
Any useful tips will depend on what J2EE app server you
are using. Most of the well-known servers come with
a debugging guide. For example, take a look at:
Debugging J2EE Applications in the SunOne Application Server
documentation:
http://docs.sun.com/source/817-2171-10/dgdebug.html
Thanks in advance !Best Regards... -
How to Configure the Datasource In JNDI and access it through Java Code
I have declared under web.xml
<resource-ref>
<res-ref-name>MSDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
Under Jrun-resource.xml
<data-source>
<dbname>xxxxxxx</dbname>
<driver>macromedia.jdbc.sqlserver.SQLServerDriver</driver>
<url>jdbc:macromedia:sqlserver://xxx.xxx.xx.xx:1433;databaseName=xxxxxxx</url>
<username>xxxxxxxx</username>
<password>xxxxxxxxx</password>
<encrypted>false</encrypted>
<encryption-class>jrun.security.JRunCrypterForTwofish</encryption-class>
<native-results>true</native-results>
<remove-on-exceptions>true</remove-on-exceptions>
<pool-statements>false</pool-statements>
<initial-connections>1</initial-connections>
<connection-timeout>1200</connection-timeout>
<transaction-timeout>20</transaction-timeout>
<cache-enabled>false</cache-enabled>
<cache-size>5</cache-size>
<cache-refresh-interval>30</cache-refresh-interval>
<jndi-name>MSDataSource</jndi-name>
<poolname>Pool</poolname>
<minimum-size>0</minimum-size>
<maximum-size>2147483647</maximum-size>
<user-timeout>20</user-timeout>
<skimmer-frequency>420</skimmer-frequency>
<shrink-by>5</shrink-by>
<maximum-soft>true</maximum-soft>
<debugging>false</debugging>
<disable-pooling>false</disable-pooling>
<isolation-level>READ_UNCOMMITTED</isolation-level>
<description/>
</data-source>
Under jrun-web.xml
<resource-ref>
<res-ref-name>MSDataSource</res-ref-name>
<jndi-name>MSDataSource</jndi-name>
</resource-ref>
Java Code
String dsndb="java:comp/env/MSDataSource";
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"jrun.naming.JRunContextFactory");
p.put(Context.PROVIDER_URL, "localhost:2932");
InitialContext context=new InitialContext(p);
System.out.println(context.getEnvironment());
DataSource ds=(DataSource)context.lookup(dsndb);
ds.getConnection();
System.out.println(ds.getConnection().toString());
Error is
{java.naming.provider.url=localhost:2932, java.naming.factory.initial=jrun.naming.JRunContextFactory}
Exception in thread "main" javax.naming.NameNotFoundException: No such binding: MSDataSource
at jrun.naming.ContextManager.getBinding(ContextManager.java:680)
at jrun.naming.ContextManager.getBinding(ContextManager.java:686)
at jrun.naming.ContextManager.getObject(ContextManager.java:690)
at jrun.naming.ContextManager.lookup(ContextManager.java:463)
at jrun.naming.JRunNamingContext.lookup(JRunNamingContext.java:501)
at jrun.naming.JRunNamingContext.lookup(JRunNamingContext.java:644)
at jrun.naming.JRunNamingContext.lookup(JRunNamingContext.java:470)
at javax.naming.InitialContext.lookup(Unknown Source)
at Controller.DBManager.getConnection(DBManager.java:29)
at Controller.DBManager.main(DBManager.java:42)
Please help me .
Thanks in advanceAlso, try to log the username/password in your authenticator, just to be sure that credentials changeGood piece of advice, michael. Worth of it. When I changed the credentials manually, it worked correctly,but from the application, when I logout from 'a', 'a' and log in to 'b', 'b', I got a valuable information.
I tried debugging like given below for checking from the application.
class MyAuthenticator extends Authenticator {
protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("userrrrrrrrr"+UtilsHTTPS.username);
System.out.println("pwdddddddddd"+UtilsHTTPS.password);
.........................................The information I got while debugging from the application was, the username and password does not get printed. It implies that, Authenticator.setDefault(new MyAuthenticator()); does not work as desired ie; even on calling new MyAuthenticator(), it does not get inside the MyAuthenticator class.
Why does this happen? What is the solution for this? -
Can I debug c++ code
I have some bug in my C++ code. I useing MS Visual studio .net to compile it. How I can enable "Step into" that I can see what happening in my c++ object space when I call that native method from Java?
The easiest way to debug this code USED TO BE to open the Dll project in Visual Studio, then go to the project options and make some some settings. The specific settings involved were the invoking program (Make that java.exe.), and the parameters to the program (Make those the parameters that will make jvm.exe execute your java program.).
This is the way I did it using VC 6.0. It probably still works in the new version. -
Export java code out of database? difference between Prod and Test
Hi all,
I'm a seasoned DBA, but I have never really dealt with Java, so this is all new to me. Within one of my test databases (10.2.0.3.0), I have a database package - within the package is a procedure that has this Java call:
language java name 'com.clinapps.pmd.etl.interfaces.forecasting.itemtrial.helper.SSFItemOutboundPMDHelper.processSSFItemInterface()';
This Java code goes and exports a file to .xml format. The basic problem is that in our Test environment, there is a problem in the xml file that gets generated - the second line is missing the first few characters. However, in all of our other environments, including Production and Validation, it all works fine - the xml file is good. What has me confused, is that we've done several database refreshes, where we export from production, then import it down to test. So from everything I'm looking at, the schema is exactly the same - but something is different, causing the issue in the xml file that is being generated. I was wondering if I could get into the database and export the Java code, then that is something where I could confirm if there's a difference or not, from Prod to Test.
Does anyone have any input/feedback on how to do this? I've been googling, and tried several methods, including dbms_metadata.get_ddl, and DBMS_JAVA.EXPORT_SOURCE, but I can't get anything to work.
Or if anyone has any other thoughts on how to debug/troubleshoot this, I'd appreciate any ideas!!
Thank you from a Java newbie!!OK, that is helping me get somewhere!! If I change the query to this, I am getting results:
select obj_num,long_name from SYS."KU$_JAVA_CLASS_VIEW" where LONG_NAME like '%SSFItemOutboundPMDHelper%';
171879
com/clinapps/pmd/etl/interfaces/forecasting/itemtrial/helper/SSFItemOutboundPMDHelper
Note that it has the / instead of the . as the differentiator
Now if I do the second query, I see this:
SQL> select * from SYS."KU$_JAVA_OBJNUM_VIEW" where OBJ_NUM=171879;
OBJ_NUM DATAOBJ_NUM OWNER_NUM OWNER_NAME
NAME NAMESPACE SUBNAME
TYPE_NUM TYPE_NAME CTIME MTIME
STIME STATUS REMOTEOWNER
LINKNAME
FLAGS OID SPARE1 SPARE2 SPARE3
SPARE4
SPARE5
SPARE6
171879 123 PMD50
/34bae3f1_SSFItemOutboundPMDHe 1
29 JAVA_CLASS 2012-06-28 10:44:22 2012-06-28 10:44:22
2012-06-28 10:44:22 1
8 6 65535
Any thoughts on where to go from here?? -
How to debug java stored procedures using jdwp with Eclipse IDE?
I need to debug the java stored procedures loaded in Oracle 9.2.0.6. The java files are loaded into the database using dbms_java.loadjava('-force -debug -verbose -resolve lib/java_stored_procs.jar'); The jar contains .java files and the database resolves and compiles them into .class files. Works fine but I need to debug the code. I am tried of the println method since takes too much and too many iterations.
My IDE is Eclipse 3.1. I want to use the jdwp for debugging in my IDE. Any one who knows the exact steps?
Thanks a lot.I need to debug the java stored procedures loaded in Oracle 9.2.0.6. The java files are loaded into the database using dbms_java.loadjava('-force -debug -verbose -resolve lib/java_stored_procs.jar'); The jar contains .java files and the database resolves and compiles them into .class files. Works fine but I need to debug the code. I am tried of the println method since takes too much and too many iterations.
My IDE is Eclipse 3.1. I want to use the jdwp for debugging in my IDE. Any one who knows the exact steps?
Thanks a lot.
Maybe you are looking for
-
Unequal amount of songs on ipod compared to Mac iTunes
Hi, I have an old 10g ipod (click wheel) v 1.5 The total number that appears on amount of songs on the ipod does not equal the total amount of songs on iTunes. I don't believe I have anything activated to possibly skip a song (ie I dont have "update
-
Submit button on Android doesn't submit completed form via e-mail
We've created a form in Adobe Acrobat Pro with a submit button using the "mailto:" command. When we are in the android app and click the button, the e-mail script works fine, but it doesn't send the actual file, just a blank e-mail. Any advice? I'
-
How do i make an icon for a new genre
I'd like to create a new genre in iTunes for my collection, and would like to create an "icon" similiar to the ones that are plugged into iTunes already. I know if there isn't one it will default to an album cover. Is there a way of doing this? I
-
How do I set up CMS in adobe muse?
I need to create a client website so that they will have access to edit certain pages. Can I do this without using Business Catalyst? For the amount of editing they require it is not worthwhile to use BC.
-
rary, even though I select pics from photo stream, and then when I go to import to library, it tries to import every picture in my computer, not the ones I selected from the photo stream, and then iPhoto crashes.