This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Help with debugging!

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

my error is this, but this is not really the case. I need to find out the flow of code which in some step trigger this error:

Error is this:



This is the method that triggers this error:
 

I do not know how to find out which method is calling this method, so that i do reverse engineering and find out why "String transformation" is not set and where/how must be set.
I  am using IDEA IDE.

tnx
miha


 
Marshal
Posts: 66236
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does that error occur? We need more details before we can help. Is this related to your previous post?
 
Ranch Foreman
Posts: 53
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, some of your code tries to initiate a XML cipher. So, look through your code where you call Cipher.getInstance(). Also: What you posted is just the exception message, but an exception always also have a stacktrace - if you don't get one in come catch block there's a printStackTrace() missing - as the stacktrace shows you exactly the information you want to know: where's the call that fails.
Look through all your catch blocks and make sure you have a printStackTrace in each one - this should help you to find the call failing.
 
miha zoubek
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:How does that error occur? We need more details before we can help. Is this related to your previous post?




Hi Ritchie

yes it is related to this post. I am rreally struggling to debug this
 
miha zoubek
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kristina Hansen wrote:Well, some of your code tries to initiate a XML cipher. So, look through your code where you call Cipher.getInstance(). Also: What you posted is just the exception message, but an exception always also have a stacktrace - if you don't get one in come catch block there's a printStackTrace() missing - as the stacktrace shows you exactly the information you want to know: where's the call that fails.
Look through all your catch blocks and make sure you have a printStackTrace in each one - this should help you to find the call failing.



Hi Kristina

i do not know where to put stacktrace as this is not my library, it is library of spring-ws which i can not edit.
 
miha zoubek
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another thing from logs:

java.security.NoSuchAlgorithmException: Null or empty transformation
at java.base/javax.crypto.Cipher.getInstance(Cipher.java:526) ~[na:na]
at com.sun.xml.wss.impl.apachecrypto.EncryptionProcessor.encrypt(EncryptionProcessor.java:1052) ~[xws-security-3.0.jar:3.0-FCS]
at com.sun.xml.wss.impl.filter.EncryptionFilter.encrypt(EncryptionFilter.java:430) ~[xws-security-3.0.jar:3.0-FCS]
at com.sun.xml.wss.impl.filter.EncryptionFilter.process(EncryptionFilter.java:389) ~[xws-security-3.0.jar:3.0-FCS]
at com.sun.xml.wss.impl.HarnessUtil.processWSSPolicy(HarnessUtil.java:81) ~[xws-security-3.0.jar:3.0-FCS]
at com.sun.xml.wss.impl.HarnessUtil.processDeep(HarnessUtil.java:252) ~[xws-security-3.0.jar:3.0-FCS]




Does this mean that before Cipher.java:526 was executed EncryptionProcessor.java:1052?

In  EncryptionProcessor.java:1052 there is this:

I see this:



How this is string if I put flag on this line and trigger debug and it shows like object?

https://drive.google.com/file/d/1BkvKMSQPyvf7rWT7rIbRUYQVoc0ZEg-j/view?usp=sharing





 
Kristina Hansen
Ranch Foreman
Posts: 53
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me give you another example:
In https://coderanch.com/t/719551/java/set-PKI-Java-openssl I've posted some crypto stuff. As it uses AES-256 it fails with anything lower than Java 8 update 161 (as 161 was the update when oracle finally dropped the restriction on crypto). So it fails with this stacktrace:

This tells me: ok, in line 29 of my code I call something else wich in the end failed. In my code this is a call to a helper method to store an encrypted keypair. In this helper method I use AES-256. As this is executed with Java 8 update 144 I'm not allowed to use AES-256 as 144 is restricted to only AES-128.
The line causing this issue:

The issue: AES-256-OFB - not allowed with 8u144 causing the stacktrace.

So, to maybe get more into your problem, we need the complete stacktrace you get. Then we can try to identify the class in wich the exception is caused and from there we can work your code up until the call goes to the lib and try to figure out if its something wrong with what you wrote, if it's an error with the lib or maybe an issue with the environment its run on.
The few information you gave us until now aren't enough to help.

Hope this gets you further.

Kris
 
miha zoubek
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kris thank you so much.

This is when i try to encrypt with symmetric keystore:
https://pastebin.com/0LGQrvTC


This is when i try to encrypt with keystore:
https://pastebin.com/mSYHfD2R

thank you!
 
Kristina Hansen
Ranch Foreman
Posts: 53
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These are helpful. The following is just a wild guess by how application servers work and based on name:

Why these two lines?
All that comes before it (below) is just the invocation by the client thread, all that comes after it (above) is the framework and some XML stuff ("marshal" mostly has some to do with XML).
Also, as .MK is the TLD for North Macedonia it fits your name.

So suspect the two classes

mk.softnet.Porting.PortingApplication
mk.softnet.Porting.client.SoapClient

are part of the servlet executed on the application server when access some URL poiting to it. So, somewhat in those two classes may have to do with the exception.

Also: As the overall exception says that some Cipher specific is missing, it could be likely that you miss some dependency library or have a wrong version of it.

So, to try to get further, have a look at the two classes and thier depencies. This way you should be able to figure out, if it's some missing dependency, a version conflict, or just some wrong usage. It could also be an issue with the XML policy file you posted earlier. Maybe try consider consult the manual of the used library how to set it up and use it. Maybe some error slipped in there.

Hope this helps.

Kris
 
miha zoubek
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Kris thank you for this tip and helping me understand this.

SoapClient.java



PortingApplication.java



And yes, xml is for loading policy file, which indicated what it is used (sign, encrpy,...). I fallowed tutorial and do not see that I missed something.

How can I debug verison issue?

My pom.xml


 
Kristina Hansen
Ranch Foreman
Posts: 53
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I have to admit this is my limit. Now you need help from someone familiar with sping. I've hoped to see more from the code, but as it's all that framework magic happen in the background controlled by this xml, wich is as to the tutorial, there's not much to see what's failing why.
I can only asume that either something is wrong with your xml config here: https://coderanch.com/t/719464/engineering/Unable-initialize-XML-Cipher-Null or with the key material you try to use.
Sadly, the exception "Null or emptry transform" isn't helpful - but that's fault of the dev written that cipher implementation.
As you postet, this exception is thrown in an if-else statement. So, one could look what's that if looking for and why it evals to false. Maybe this could give a clue if and what input parameter is wrong or missing.
Sorry, but I can't help you anymore on this topic - that's for someone knowing the framework you use. Just wait until hopefully someone comes around.

Kris
 
miha zoubek
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Kris i moved everything to java 8 and now it is working

thank you for all help!
 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!