Page 1 of 1

Lookup Method unavailable

Posted: Tue Apr 04, 2017 4:12 pm
by scott.warnick
We are encountering the following error when attempting to register our custom EJB's using customServiceBean.java

2017-04-03 13:33:01,773 WARNING startup Method 'lookup' is not available for 'javax.ejb.EJB'. The old API 'file:/C:/Users/scott.warnick/.m2/repository/org/apache/tomcat/tomcat-annotations-api/7.0.68/tomcat-annotations-api-7.0.68.jar' was found on the classpath.

This error leads to a cascade of other errors which eventually cause the custom EJB's not to register. Worse, the server will not start. I can send our pom.xml files by email if that will help solve the problem.

I find this error baffling because as far as I can tell the jar referenced in the error is that jar that should be used for the version of Tomcat in the embedded server.

Re: Lookup Method unavailable

Posted: Tue Apr 04, 2017 4:17 pm
by scott.warnick
I am mostly interested in debugging techniques. I think the problem comes from getting the javaee api from javax as opposed to getting it from the TomEE server. As I am sure you all know, the javaee that comes from javax does not include implementations for the methods. I think part of the problem is getting the implementations for the javee 6 methods at runtime. It seems logical to get them from the TomEE server using <scope><provided<scope> but using TomEE to provide Javax is leading us to the error I posted previously.

We are running the embedded TomEE server for LSPS 3.1 on windows 7 using the embedded H2 server.

Re: Lookup Method unavailable

Posted: Tue Apr 04, 2017 4:42 pm
by Roman Kubascik
Hi Scott,

you probably mean you registered custom EJB in the ComponentServiceBean.java.
Lately we improved our documentation where we describe how to implement custom function as an EJB. It's for LSPS 3.2, but for 3.1 it's the same.

If it doesn't help, please send us your EJB class (it can have empty methods) + ComponentServiceBean.

Regards,
Roman

Re: Lookup Method unavailable

Posted: Wed Apr 05, 2017 6:01 pm
by scott.warnick
Roman,
Thank you for the prompt reply.

I will look for the new documentation on registering components in the LSPS version 3.2 documentation. It would be great to have a link.

I have attached the EJB we are working with and a copy of our ComponentServicesBean.java file. I have also attached the model test we are trying to get to work under LSPS 3.1.

On reflection, the ComponentServicesBean.java I just posted is from our LSPS 2.5 system and is unaltered. I will compare it with the version in the default application and see if the annotations need to change.

I wanted to attach log files but I am having trouble with that. I will try attaching them in a separate reply.

Re: Lookup Method unavailable

Posted: Wed Apr 05, 2017 6:46 pm
by Roman Kubascik
Link to the documentation is included in my previous post (it's visibility could be better).

Re: Lookup Method unavailable

Posted: Wed Apr 05, 2017 6:56 pm
by Roman Kubascik
Here is an example of the custom TaskType:
https://docs.whitestein.com/lsps/3_2/cu ... sktypeimpl
Code: Select all
Instead of
@EJB(beanName = "AuthorizeWorkProduct")
private ExecutableTask authorizeWorkProduct;
I would use
@EJB(beanName = "BAHAuthorizeWorkProductTask")
private ExecutableTask authorizeWorkProduct;


When you set breakpoint in the method registerCustomComponents, is authorizeWorkProduct properly injected (does it have not null value)?

Re: Lookup Method unavailable

Posted: Wed Apr 05, 2017 7:34 pm
by scott.warnick
Roman,
I am trying to upload full log files showing the problem I am having but the uploads are failing with the following error:

phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_posting.php on line 456: chmod(): No such file or directory

The files are there on my c: drive and I can open them fine. I suspect there is a file length limitation on this forum.

I emailed the log files to Bryon Glueck with a request to forward them to you. Please check with him.

In the meantime I am posting a document that summarizes the relevant messages from the log files.

Re: Lookup Method unavailable

Posted: Wed Apr 05, 2017 7:47 pm
by Roman Kubascik
Have you noticed any change when you changed beanName to "BAHAuthorizeWorkProductTask" in the ComponentServiceBean.java?

Re: Lookup Method unavailable

Posted: Wed Apr 05, 2017 9:27 pm
by scott.warnick
For what it's worth, I compared our ComponentServicesBean.Java to the one in the default application. There is a significant difference. Our version requires import javax.ejb.EJB to compile. The version in the default application doesn't have that import.

Re: Lookup Method unavailable

Posted: Wed Apr 05, 2017 11:04 pm
by scott.warnick
I found a fix, or at least a workaround. The @stateless directive in our EJB's need to be elaborated with the bean name. Once I did that the JNDI context name was available and the exceptions went away. I can now start the embedded TomEE server with all of our custom EJB's registered.