Win a copy of Pipeline as Code this week in the Cloud/Virtualization 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Accessing 3rd party static method from ejb3

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to all, I've a long time forum browser.

I have a question regarding acessing a static method from within a @Statless bean. The company I work for has close to a dozen seperate systems, and we are attempting to reduce code redundancy by utilizing web services.

The long and short is that I need to "validate" some email addresses that have been a database for 10 + years. I can read the data just fine, but I cannot figure out how to access a static method from org.apache.commons.validator:


This works fine, no questions asked. However, when I try the following:


I get an invocation error and glassfish tells me to go get my shinebox. I'm guessing this has to do with accessing the static method, but I don't know. Please, any help would be enormous.

Thanks.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That doesn't look like a static method. I see that you are getting an instance of the validator and invoking on it. So I'm guessing isValid isn't really a static method. Anyway, what error/exception do you see? Please post the entire exception stacktrace.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at the code inside initialize method


validator is an reference inside the scope of the method.

you should create a new property of the class


And then it works
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic