Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

NoClassDefFoundError implementing WS-Security on Glassfish 4.1

 
Ranch Hand
Posts: 108
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've created and successfully deployed a web service using NetBeans that implements WS-Security using "Username Authentication with Password Derived Key". The problem comes when I send a soap request to the service. Sending the same request twice I get 2 different errors. The first time I get this exception:




Changing nothing and resubmitting the same request again I get this exception:


 
Rancher
Posts: 4174
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The second is caused by the failure of the first.
The server attempts to initialise the SecurityRecipient class (by the look of it) and fails because Apache logging's LogFactory couldn't be found.

So that's your root cause.
 
Rob Micah
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those exceptions don't happen on a single call. That happen on 2 separate requests. And even after adding the commons-logging.jar to the classpath those errors persist. After the application is deployed the first exception occurs and then every subsequent call causes the second exception.
 
Bartender
Posts: 1164
38
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Dave pointed, try to fix the first issue. If even after adding Apache logging jars the first exception still occurs, it is likely that the class path is still misconfigured.
 
Rob Micah
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something is definitely wrong with the classpath. I added the common-logging jar to the lib/ext directory of the domain and restarted the server but still no luck. What else am I missing?
 
Dave Tolls
Rancher
Posts: 4174
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where exactly have you placed the jar file?

Is it in the WEB-INF/lib directory?

I'm assuming it's not a versioning issue, since I don't think the LogFactory has moved in several versions.
 
Rob Micah
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:Where exactly have you placed the jar file?

Is it in the WEB-INF/lib directory?

I'm assuming it's not a versioning issue, since I don't think the LogFactory has moved in several versions.



Dave, I actually did not place it inside the war file but in the glassfish install directory at /glassfish/domains/domain1/lib/ext.
 
Dave Tolls
Rancher
Posts: 4174
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know Glassfish's structure, so can't really say where this should go if (and it's an if on my part) this is a glassfish thing and not something down to your project, in which case it should be part of your war.
 
Rob Micah
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried packaging commons-logging.jar in the war at WEB-INF/lib but I get the same results.
 
Greenhorn
Posts: 5
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I faced the same problem.
The solution was found there: https://github.com/payara/Payara/issues/218/  -> "put commons-logging jar lib into dir C:\glassfish4\glassfish\modules, did fix this for me".
This helped me too.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!