Hi,
Right that was it, the problem was (is) that I don’t have all of WSS4J dependencies included
in my pet projects.
I added the maven cached item C:\Users\ingres\.m2\repository\org\apache\santuario\xmlsec\2.0.1
to the class path and it compiled.
In the IDE I added this path to the properties and it has now stopped complaining about the
CryptoFactory stuff.
Thanks for the nudges.
Adrian
From: Adrian Williamson [mailto:aw@octavo2.demon.co.uk]
Sent: 14 July 2014 12:45
To: coheigea@apache.org
Cc: users@ws.apache.org
Subject: RE: FW: CryptoFactory.getInstance("wss40.properties"); - in Wss4J 2.0.2
No, that’s what I’m looking for now.
From: Colm O hEigeartaigh [mailto:coheigea@apache.org]
Sent: 14 July 2014 12:40
To: Adrian Williamson
Cc: users@ws.apache.org
Subject: Re: FW: CryptoFactory.getInstance("wss40.properties"); - in Wss4J 2.0.2
Do you have the XML Security jar on the classpath?
Colm.
On Mon, Jul 14, 2014 at 12:34 PM, Adrian Williamson <aw@octavo2.demon.co.uk> wrote:
Sorry, I just noticed the first error complaining about XMLSecurityException – I think there
is some Maven voodoo going on to make things work that may take some time for me to tease
out.
From: Adrian Williamson [mailto:aw@octavo2.demon.co.uk]
Sent: 14 July 2014 12:31
To: coheigea@apache.org
Cc: users@ws.apache.org
Subject: RE: FW: CryptoFactory.getInstance("wss40.properties"); - in Wss4J 2.0.2
Ouch.
I took the liberty of trying this from the command prompt:
set CLASSPATH=c:\wss4jtrunc\jars\*
C:\Users\ingres\Documents\NetBeansProjects\ExceptionTest\src\exceptiontest>javac ExceptionTest.java
ExceptionTest.java:11: error: cannot access XMLSecurityException
crypto = CryptoFactory.getInstance("wss40.properties");//compilation error here
^
class file for org.apache.xml.security.exceptions.XMLSecurityException not found
ExceptionTest.java:20: error: unreported exception WSSecurityException; must be caught or
declared to be thrown
localCrypto = CryptoFactory.getInstance("wss40.properties");//compilation error here
^
2 errors
Where ExceptionTest.java is this source:
package exceptiontest;
import org.apache.wss4j.common.crypto.Crypto;
import org.apache.wss4j.common.crypto.CryptoFactory;
public class ExceptionTest{
private Crypto crypto = null;
public ExceptionTest() throws Exception {
crypto = CryptoFactory.getInstance("wss40.properties");//compilation error here
}
public static void main (String[]args)
{
Crypto localCrypto = null;
try {
localCrypto = CryptoFactory.getInstance("wss40.properties");//compilation error here
}
catch (Exception e)
{
System.out.println("Caught Exception" + e.getMessage());
}
}
}
From: Colm O hEigeartaigh [mailto:coheigea@apache.org]
Sent: 14 July 2014 12:13
To: Adrian Williamson
Cc: users@ws.apache.org
Subject: Re: FW: CryptoFactory.getInstance("wss40.properties"); - in Wss4J 2.0.2
Sorry, but I'm only willing to look at test-code if I can compile + run it via ant/maven/etc,
I don't use netbeans...
Colm.
On Mon, Jul 14, 2014 at 12:05 PM, Adrian Williamson <aw@octavo2.demon.co.uk> wrote:
Hi,
This is the project taken from NetBeans 8.0
All I did was create a new Java Application using the IDE wizard, then I added the wss4j jar
files to the project using the Project Properties Libraries section.
I then pasted in the source below and it complains about CryptoFactory.getInstance.
Are you getting that?
Thanks
Adrian
From: Colm O hEigeartaigh [mailto:coheigea@apache.org]
Sent: 14 July 2014 11:53
To: users@ws.apache.org
Subject: Re: FW: CryptoFactory.getInstance("wss40.properties"); - in Wss4J 2.0.2
Can you create a test-case that I could unzip + compile?
Colm.
On Mon, Jul 14, 2014 at 11:19 AM, Adrian Williamson <aw@octavo2.demon.co.uk> wrote:
Hi
I isolated this against the 2.0.2 jars I built:
package exceptiontest;
import org.apache.wss4j.common.crypto.Crypto;
import org.apache.wss4j.common.crypto.CryptoFactory;
public class ExceptionTest{
private Crypto crypto = null;
public ExceptionTest() throws Exception {
crypto = CryptoFactory.getInstance("wss40.properties");//compilation error here
}
public static void main (String[]args)
{
Crypto localCrypto = null;
try {
localCrypto = CryptoFactory.getInstance("wss40.properties");//compilation error here
}
catch (Exception e)
{
System.out.println("Caught Exception" + e.getMessage());
}
}
}
I can see this used in the test classes in the Wss4J project, so I fully expect it to be something
stupid I’m not doing.
Thanks
Adrian
From: Colm O hEigeartaigh [mailto:coheigea@apache.org]
Sent: 14 July 2014 11:06
To: users@ws.apache.org
Subject: Re: FW: CryptoFactory.getInstance("wss40.properties"); - in Wss4J 2.0.2
What does your code snippet look like?
Colm.
On Mon, Jul 14, 2014 at 9:35 AM, Adrian Williamson <aw@octavo2.demon.co.uk> wrote:
Can anyone shed some light on this?
Thanks
Adrian
-----Original Message-----
From: Adrian Williamson [mailto:aw@octavo2.demon.co.uk]
Sent: 11 July 2014 16:06
To: users@ws.apache.org
Subject: CryptoFactory.getInstance("wss40.properties"); - in Wss4J 2.0.2
Hi,
NetBeans/JDK1.7 is telling me that I need to handle "unreported exception
WSSecurityException; must be caught or declared to be thrown" for this
invocation of CryptoFactory.getInstance.
However I can't make it go away by blindly wrapping it in a try-catch or by
throwing the exception as in the examples:
81 public EncryptionTest() throws Exception {
82 crypto = CryptoFactory.getInstance("wss40.properties");
83 }
If I try to reference WSSecurityException in the catch block it maintains
that it cannot be converted to throwable due to incompatible types.
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.apache.xml.security.exceptions.XMLSecurityException
org.apache.wss4j.common.ext.WSSecurityException
Forgive me for what might seem like a very basic java question but why is it
complaining?
Thanks
Adrian
--
Colm O hEigeartaigh
Talend Community Coder
http://coders.talend.com
--
Colm O hEigeartaigh
Talend Community Coder
http://coders.talend.com
--
Colm O hEigeartaigh
Talend Community Coder
http://coders.talend.com
--
Colm O hEigeartaigh
Talend Community Coder
http://coders.talend.com
|