[Performance Tuning] - Re: Monitoring Tool
by stevesouza
Check out http://www.javaperformancetuning.com for a complete list of tools, and tuning advice for java apps.
Here is some info on my own JAMon open source monitoring tool. The JAMon servlet filter, and JAMon jdbc proxy driver are no-code solutions for timing page hits, and database sql (for any jdbc driver). Read on for more info...
One strength of jamon is the diversity of things that it can monitor and the ease with which you can do it.
1) JDBC/SQL Monitoring - You can monitor you sql/jdbc without changing
code, by using the new driver. Next I will work on providing a DataSource
which will make using it in J2EE apps easier. Here are some samples of
how you can monitor your SQL/JDBC WITHOUT changing your code. I tested the
the new jamon monitoring driver with a couple jdbc drivers
(HSQLDB/ASA/IQ/OpenA). The driver to use in class.forName(...) is:
com.jamonapi.proxy.JAMonDriver
jdbc:jamon:sybase:Tds:localhost:2638?jamonrealdriver=com.sybase.jdbc2.jdbc.SybDriver
jdbc:jamon:sybase:Tds:eagu62.fss.gsa.gov:2638?jamonrealdriver=com.sybase.jdbc2.jdbc.SybDriver&PROTOCOL_CAPTURE=/opt/sw/eas/eas5/sched.log
jdbc:jamon:opena:jamonrealdriver=com.asgardsw.OpenA.OpenADriver&159.142.46.162:3987/M10CSTEST/DBTESTPB/
(OPENA)CONFIG/AMWEB/DEV
ON SOFTWARE
2) Servlet Filter - You can use the servlet filter to monitor pages in your
web app without changing a line of code. Simply add some lines to your
web.xml
3) Interface Monitoring - ANY java interface as well as the exceptions it
throws can be monitored with 1 line of code.
MyInterface mine=(MyInterface) MonProxyFactory.monitor(new MyObject());
4) Exceptions/SQL Details - Previous versions of JAMon only allowed you to look at the jamon summary report. Now you can look at an Exception buffer of the most n recent exceptions any monitored interface have thrown (including jdbc interfaces such as Connection). You can also look at the most N recent query that was thrown.
5) Dynamic Changes to Monitor Strings - As jamon uses strings which can be created at runtime you can monitor runtime data such as pagehits by user, by day, and many other things.
Monitor mon=MonitorFactory.start("pageHit."+userName);
....
mon.stop();
6) More Info - My web site does a good job of explaining these capabilities
and more. I also have a couple releases planned with some cool new
features over the next couple months.
A demo can be found at http://www.ssouza.com/jamon ,and JAMon can be
downloaded at http://www.jamonapi.com
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967980#3967980
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967980
19 years, 8 months
[JBoss Messaging] - Re: Problems at Startup with MySQL 5 and XAConnection
by felipeal
"timfox" wrote :
| As already mentioned, it's completely pointless using an XADatasource for the messaging database connection, since internally we suspend any current tx and create a new tx for the duration of the database operation.
|
Forgive my ignorance (on the JBoss internals - I'm not really thaaat stupid when it comes to Java EE/XA/JTA,etc... :-), but how to achieve 2PC commit then? I mean, suppose I'm using a XADatasource for both my app's DB and my JBossMQ DB, add 100 messages in the queue, try to update the DB, get an exception and set the transaction for rollback. According to the 2PC/DTP land, the JBossMQ transaction should rollback as well. Of course, what must be rolled back is the transaction of the JBossMQ resource, not necessary its underlying database. But if the resource suspended my global-tx and started a new local-tx one, once I finished posting the 100 messages, that new tx would be committed (and ready to be consumed), right? Or am I missing something (I hope so...)?
"timfox" wrote :
| 1) Use the XAResource directly (this is a bit fiddly and I suggest you read the JTA spec first to ensure you know what you are doing)
|
That's too hardcore, and lacks all the Java EE fun - that code you showed looked more like the DTP/XA samples for C than Java/Java EE :-(
"timfox" wrote :
| Alternatively, if you are executing in a managed (read, JCA enabled) environment then you can use a UserTransaction, this is a whole lot easier.
|
Yes, that's what I'm doing; I'm even using Spring to start the UserTransaction for me...
"timfox" wrote :
| To do this, just start a user transaction, send your message and do your database update, commit and that should all happen in the same global tx.
|
That's what I did initially, and I thought JBoss would (by default) manage to enroll the 2 local transactions (DB and JMS) in a global/XA transaction. But once I deployed the application, the MDBs started to consume the messages before the global tx committed, so I realized something was not set correctly...
"timfox" wrote :
| You just need to make sure you are using the jms JCA resource adapter - this is the one normally available at java:/jmsXA, and are using a JCA managed data source for your database access.
|
To be honest, that was my first reaction - I've even found the java:/jmsXA reference somewhere (either on the wiki page on some XML file in the deploy dir), but after looking on some other places, I thought I would need to set a <xa-datasource> instead of <local-tx-datasource>...
"timfox" wrote :
| See the JCA wiki pages for more information.
|
Hmm, I think I got it now (http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossJMSRA): I just need to change the JNDI name when getting the factory (somewhere in the Spring XML wasteland :-). I will try it tomorrow....
Thanks again for you help (and patience :-)
-- Felipe
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967977#3967977
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967977
19 years, 8 months
[EJB 3.0] - Exception while creating entities in SLSB
by cuoz
I have a SLSB method that I call from a portlet. I am trying to create an entity and also modify a many-to-many relationship.
The exception I'm getting is:
20:51:46,215 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
20:51:46,216 ERROR [JDBCExceptionReporter] failed batch
20:51:46,217 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
The SLSB method code is:
Client client = new ClientEJB(username, password, domainName);
| Role userRole = RoleEJB.findByName(em, "user");
| client.getRoles().add(userRole);
| em.persist(client);
If I comment out adding the role, the client entity does get created just fine.
Is there something I need to do in order to persist the new entity with the relationship? I've tried using em.flush() after creating the entity with no luck.
I'm somewhat new to EJB3, so thanks in advance for any help,
Gary.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967976#3967976
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967976
19 years, 8 months
[JBoss Seam] - Re: JBoss Seam don´t work.
by SmokingAPipe
"nicola9000" wrote : It is a bit hard if you did not work with JSF and EJB3 before ( like me )
| When it start working it is nr. 1 :-)
Right, exactly. I had never used JSF or EJB3 before. I have used Hibernate and I really liked it, and EJB3 is very similar to Hibernate in concept (and uses a lot of Hibernate code).
What I didn't like about Hibernate was the Session management stuff. The only good way to do it in Hibernate is to have the Session controlled by a filter so entities could stay attached as the page renders. And there were other problems. EJB3 + Seam solves all that, and also adds a ton of other cool features. It's just non-trivial to get it set up.
What would be great would be a stand-alone application framework file set, that has everything ready to go. All the examples that come with Seam have build.xml files with stuff like include="../../build.xml", which makes them pretty hard to use in a new project.
I'm trying to put together a generic app framework that has all the stuff I need, plus login and authorization filters, and the Tomahawk components, and it's stand-alone ready to build. That would be a tremendous help in getting people started on it.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967973#3967973
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967973
19 years, 8 months