Mark Sohm

Greenhorn
+ Follow
since Jul 11, 2007
Merit badge: grant badges
For More
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 Mark Sohm

Hi all,

I have an architecture type question for an EJB 3.0 app.

Currently, I have an session bean that runs on a time. Every X minutes it wakes up and does the following.

1. Reads some records from a database.
2. Loops through each record

While looping through each record it:
1. Makes a connection to web server A to download information.
2. Makes a connection to web server B to deliver information.
3. Updates record

This works fine when the number of records is relatively low. But I'm looking for a better way to be able to scale the application. The number of records that need to be processed in each cycle is growing and can result in more work in the allotted time. The bottleneck is the communication between web server A and B, there is little computational processing going on. So I need to be able to process multiple records simultaneously, but at the same time make sure that the same record isn't processed more than once.

I'm fairly new to EJB design, so am looking for some suggestions.

One thought I had was to move the work done in the loop into a message bean. Meaning the timer just reads the database records and fires off a message for each record to be processed. But I'm not sure how the server would actually handle this. Would it process multiple messages simultaneously? I think it would. If so, does it have a queuing mechanism or would it try to process them all at once? I want to have this done as quickly as possible but not bring the server to its knees. Would I be able to poll to see if my messages have completed or not? I'd want to avoid sending duplicate messages (i.e. Avoid a timer firing a second time that sends off the same records to be processed that are currently in the server's message queue).

Thoughts, suggestions or recommended documentation is appreciated. I have a few books, but they cover things at a lower level and don't get into recommended design.

DaHunter
It's a EJB3 app. I'm not sure what annotated classes are. I created the app in JBoss Eclipse, so I assume it would have created what it needed.

Here is a link to the log file:

Log

Mark
16 years ago
No problem, I appreciate the help. I've been away myself as well.

I've made some progress in reproducing, the problem, although I'm still without a solution. The other server was running 4.0.5GA, where I had 4.0.4GA. I installed 4.0.5GA and now mirror the problem on my local PC.

Nothing about my app shows up in the java: Namespace or Global JNDI Namespace when deployed as an ear (same file deployed in both versions), but I do see it listed under Web Applications.

The output from JBoss after I deploy the app is below. Are there new deployment requirements for the later version of JBoss?

Mark

16 years ago
I just found out that this is the first application deployed on this server that makes use of EJBs. Can anyone recommend any kind of official JBoss reference ear I could have them test to make sure the server is working?

Something simple that works in JBoss and involves JSPs talking to an EJB so we can verify that the server is working ok.

Mark
16 years ago
I made that change to the application.xml file but nothing changed. I see the same behaviour in the cluster server and nothing new shows up in the JNDI Namespace. Any other ideas?

Mark
16 years ago
Here is my application.xml file:



I confirmed that there are only 2 servers in this cluster, and that the log from server 1 (posted about) is the master.

Mark
16 years ago
I'm back from vacation, so back to wrestling with this thing...

Neither server has anything listed in the HA-JNDI Namespace section.

I'll get the answers to your previous post.

Mark
16 years ago
I don't have direct access to that directory, but here is the output from my local PC. Or if you think the output would be different on that server I can get someone to run that command there.



Mark
16 years ago
There aren't any binding messages in the logs, nor does anything related to my app show up in the JNDI view (using the steps you posted earlier).

Mark
16 years ago
Sorry, I'm not sure what "all" server referrs to. If you let me know what to check I'll try and get the info. Here is the startup of my app from the server log files.

server1.log



server2.log



Mark
16 years ago
I'm stuck on this issue again. I did get this working on a JBoss server running on my PC, when I tried to deploy it to a production server I'm facing the same error again. But this time, nothing related to my app shows up in the Global JNDI Namespace. The JBoss version is the same, the only difference is that server is a 2 server cluster. Does that setup require different configuration of my app?

Mark
16 years ago
That was it!

When using jar/war, I could use beanName/local. In the ear format I had to use ejbAppName/beanName/local.

Thanks a lot for the help!

Mark
16 years ago
Hi,

I have created some EJBs that are packaged in a jar, and jsp pages that are packaged in a war. If I deploy them the JBoss they work fine.

My problem comes when I try to package them both together in a ear file. JBoss seems like it is deploying both files from the ear, but none of my jsp pages can access the EJBs. I'm connecting through the local interface using:

Context ic = new InitialContext();
Object o = ic.lookup("UserManagerBean/local");

When I try this, I get this exception:

javax.naming.NameNotFoundException: local not bound

I've also found that if I copy the ear and jar file, everything works. So for whatever reason the jsp pages can't access the EJBs when they are packaged in the ear file.

Here is the structure of my ear file:

myApp.jar
myApp.war
meta-inf\application.xml

Here is application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">

<application>

<module>
<java>myApp.jar</java>
</module>

<module>
<web>
<web-uri>myApp.war</web-uri>
<context-root>myApp</context-root>
</web>
</module>
</application>

This is the first ear file I've tried to create, so I'm probably doing something wrong there. I've searched around and found lots of docs about the ear spec, but not many examples. Can anyone help? Thanks!

Mark
16 years ago
I finally did get this to work how I wanted. I removed all references to EntityManager from my bean with the loop. I then set the method that creates the log entry to require a new trascation. This wrote out the database entry right away, but my loop still timed out writting to Oracle. To fix that problem I specified that the method that contains the loop does not support transaction, so JBoss doesn't try to do it all in a single transaction. Since I didn't have any reference to EntityManager anymore, JBoss was fine with that method not supporting transactions.

Mark
16 years ago
The Message bean idea didn't work either... JBoss is still forcing my method to use a transaction, so I'm back to square 1. Actually, I'm 2 steps back now. After testing with larger data sets, meaning my loop runs longer, I'm getting commit timeouts writing to Oracle. So none of the data is being commited.

There has to be a way to tell EJB/JBoss to commit now, or else how does anyone handle a long running batch operation?

DaHunter
16 years ago