File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Accessing 3rd party static method from ejb3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Accessing 3rd party static method from ejb3" Watch "Accessing 3rd party static method from ejb3" New topic

Accessing 3rd party static method from ejb3

Norman Davis

Joined: Feb 14, 2011
Posts: 2
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.

Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

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.

[My Blog] [JavaRanch Journal]
Thiago Alves de Moraes

Joined: Dec 09, 2010
Posts: 8
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

thiago moraes
I agree. Here's the link:
subject: Accessing 3rd party static method from ejb3
It's not a secret anymore!