This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques and have Mario Casciaro & Luciano Mammino on-line!
See this thread for details.
Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Jerwin Louise Uy

Ranch Hand
+ Follow
since Oct 27, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jerwin Louise Uy

Hi,

The answer is already in the exception -



BINARY is not valid EJBQL.

Use NativeQuery instead. Note that using functions or proprietary functions in NativeQuery API will not make your application portable (if you decide to swap the DB).

@All
Definitely not using Hibernate. Please take a good look at the exception. Oracle Toplink is an implementation of EJB3.0.


Regards.
Hi,

Yes. For remote calls (different JVM instances), you need not have the actual implementation in your classpath. You only need the stubs (i.e. ejb-jar containing interfaces) so that you can make a call against that interface. You don't make a call against the implementation because you don't have direct access to the implementation - even through JNDI.

Regards.
Hi,

You are making a call against the interface and not the implementation. The EJB container makes a proxy and delegates call to the actual implementation.

I hope I answered your question.

Regards.
Hi,

The application failed to load the JAR file of the EJB. Please check whether the ejb-jar is in the classloader path of your web application (WEB-INF\lib).

Regards.
Hi,

Is it possible for you to post the stacktrace here?

Regards.
Convention over Configuration.

If you deploy your EJB without specifying the name or mappedName(vendor specific, not portable) then the application server will assume a default global JNDI name. The default global JNDI name is dependent on the application server.

I would recommend reading EJB 3 in Action. The answers to your questions can be found there.

Regards.
Hi,



Based on your configuration, the glassfish app server is on the same machine as the tomcat. If not, then please change it to the actual IP.

Given that all jars are present, then if the configuration of the host and port are incorrect then you would only get NamingException. Other exceptions would point to configuration and environment problems.

Regards.
I would assume that the manager in your code is EntityManager.

Assuming the EJB jar and WAR are packaged into an EAR, then you could use the following annotation for dependency injection



If the servlet is packaged outside the EAR, then you need to modify your deployment descriptor (web.xml) for DI or you can access it via JNDI.

Regards.
Whenever a business method is called on a session bean, the container creates a transaction for you if no transaction exists or joins the parent transaction when a transaction exists. This is the default behaviour unless you declare a specific transaction attribute type in the method level.

So if methodA has a default transaction attribute type, and it invokes methodB, methodB will inherit the transaction from methodA. If methodB fails, then methodA also fails.
You can play around with the transaction attribute types to control the transaction for each method.

I hope I answered your question.

Regards.

If you have business rules in selecting the messages where multiple listeners are interested, then you can use message filtering so that the provider can select the appropriate listener.

If you simply want to decorate the primary listener, then you can achieve this by using an interceptor.

Regards.
Hi Dhiren,

Yes. That will cause the error because the deployment descriptor is wrong.

Here is the modified ejb-jar.xml



Regards.
Oh. Dependency injection works only in EJB 3.

Regards.
This will depend on the application and provider that binds session beans in the RMI registry.

Try the following -

1. Make a servlet
2. Declare the session bean as a instance variable of the servlet
3. Mark it with @EJB annotation
4. Package the WEB and EJB component into an EAR
5. Remove the <ejb-ref> element in web.xml

Let us see if dependency injection succeeds.

Regards.
You need to pass the following parameters -



The code above assumes default binding in the RMI registry. Refer to glassfish docs for more information.

I hope this helps.

Regards.
In glassfish, you can use the appclient <jar-name> that simply runs the application in the environment of the application server. That is why DI works there.

However, for the said code above, it won't work because you are running the client as a stand alone application. For stand alone application, you need to create a Context supplying the
parameters for the provider(i.e. ORB host, port, provider url). DI on application client will only work if you packaged it within an EAR. I am not sure how to do this in JBoss though.

I suggest creating a new EAR and test the DI functionality in a servlet if the sole purpose is to test the DI functionality.

I hope this helps.