[JBoss Messaging] - Serious JBoss MQ Issue
by kjc5664
The following code worked in JBoss 3.2.7
Which now fails using JBoss 4.0.3SP1,JDK1.5,LinuxOS(Intel).
|
|
|
| (Client)
| Properties properties = new Properties();
| properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| properties.put(Context.PROVIDER_URL, "localhost:1099");
|
| InitialContext iniCtx = new InitialContext(properties);
| Object tmp = iniCtx.lookup("ConnectionFactory");
| QueueConnectionFactory connFactory = (QueueConnectionFactory) tmp;
| logger.info("obtained the queue connection factory..");
| QueueConnection conn = connFactory.createQueueConnection();
| Queue que = (Queue) iniCtx.lookup(Const.TEST_QUEUE);
| logger.info("obtained the queue");
|
| QueueSession session = conn.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
| QueueSender sender = session.createSender(que);
| long fileSz = f.length();
| BufferedReader reader = new BufferedReader(new FileReader(f));
| char[] buf = new char[(int)fileSz];
| reader.read(buf);
|
|
| String data = new String(buf);
| MyMessage msg = null;
| msg = parser.parse(data);
|
| ObjectMessage objMessage = session.createObjectMessage();
|
| objMessage.setObject(msg);
| sender.send(que,objMessage);
|
|
(Server)[\b]
On the server side. I receive the following exception.
javax.jms.MessageFormatException: ClassNotFoundException: Invalid use of destroyed classloader, UCL destroyed at:
16:46:35,050 INFO [STDOUT] at org.jboss.mq.SpyObjectMessage.getObject(SpyObjectMessage.java:136
I traced the exception to this line of code in the RepositoryClassLoader
| if( repository == null )
| {
| String msg = "Invalid use of destroyed classloader, UCL destroyed at:";
| throw new ClassNotFoundException(msg, this.unregisterTrace);
| }
|
Line: 431-435
Can someone please tell me. What the heck is going on. Or. If JBAS version
4.0.4 fixes this problem.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960204#3960204
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960204
19 years, 9 months
[JBoss Seam] - booking example and db2
by goik
Starting the 'booking' example with 1.0.1 GA I tried to configure a db2 DB server. Following http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpADB2Datasource I changed booking-ds.xml to:
<datasources>
| <local-tx-datasource>
| <jndi-name>bookingDatasource</jndi-name>
| <connection-url>jdbc:db2://localhost:10000/hdm</connection-url>
| <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
| <user-name>midb2</user-name>
| <password>XXX</password>
| <min-pool-size>0</min-pool-size>
|
| <metadata>
| <type-mapping>DB2</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources>
My persistence.xml has an added DB2 dialect property:
<persistence>
| <persistence-unit name="bookingDatabase">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/bookingDatasource</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.dialect" value="org.hibernate.dialect.DB2Dialect"/>
| <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
| </properties>
| </persistence-unit>
| </persistence>
Starting the application on jboss-4.0.4.GA app. server I can register a new user, browse the list of available hotels. When I try to create a reservation I can still reach the "confirmation" window. But by clicking the "Confirm" button the application hangs.
The corresponding log entries are:
00:09:44,726 INFO [STDOUT] Hibernate: select user_.username, user_.name as name2_, user_.password as password2_ from User user_ where user_.username=?
| 00:09:44,732 INFO [STDOUT] Hibernate: insert into Booking (id, user_username, checkinDate, checkoutDate, hotel_id, creditCard, smoking, beds, creditCardName, creditCardExpiryMonth, creditCardExpiryYear) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
| 00:09:44,742 INFO [STDOUT] Hibernate: values identity_val_local()
| 00:09:44,747 INFO [HotelBookingAction] New booking: 1 for goiki
| 00:09:44,754 INFO [STDOUT] Hibernate: select booking0_.id as id0_, booking0_.user_username as user10_0_, booking0_.checkinDate as checkinD2_0_, booking0_.checkoutDate as checkout3_0_, booking0_.hotel_id as hotel11_0_, booking0_.creditCard as creditCard0_, booking0_.smoking as smoking0_, booking0_.beds as beds0_, booking0_.creditCardName as creditCa7_0_, booking0_.creditCardExpiryMonth as creditCa8_0_, booking0_.creditCardExpiryYear as creditCa9_0_ from Booking booking0_ where booking0_.user_username=? order by booking0_.checkinDate
| 00:14:44,739 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=goiki/32, BranchQual=, localId=32] timed out. status=STATUS_ACTIVE
| 00:14:44,756 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=goiki/33, BranchQual=, localId=33] timed out. status=STATUS_ACTIVE
I can still access the 'User' and 'Hotel' tables via SQL. The 'booking' table cannot be accessed so there seems to be some sort of locked up transaction. There are definitely no other users accessing the RDBMS. Am I missing something?
My system: Linux Fedora core 5, DB2 UDB 8.2, IBM's standard JDBC driver, SUN's java 1.5.0_07-b03 .
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960202#3960202
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960202
19 years, 9 months
[Persistence, JBoss/CMP, Hibernate, Database] - style and idioms for @ManyToMany definition and update
by dbatcn
Hi,
I've done plenty of programming with OOP and RDBMS, but am new to the magic world of EJB3/ORM, so I hope somebody could point me in the right direction. I'm building an application with Seam and EJB3 (as well as MyFaces, although I don't think that matters here). I hope this is the proper forum for this question.
I've got two entity beans, User and Group, with a many-to-many relationship where User is the owner. I have a GroupManagerBean class which is a stateful session bean where I'd like to have a create() method that will create a new group with an initial user. I'm trying to figure out exactly how to annotate the classes and do the data update; my first few attempts haven't worked and I was hoping somebody could offer some advice about how to get this right: cascade types, idioms for object linking and update, etc.
I've tried to extract the relevant code snippets below. Pointers on how to do this or to previous discussions of this topic gratefully accepted.
Thanks.
User.java
| @Entity
| @Name("user")
| @Role(name="currentUser", scope=SESSION)
| @Table(name="USERS")
| public class User implements Serializable {
| ...
| private Set<Group> groups = new HashSet<Group>();
| @ManyToMany(cascade=CascadeType.ALL)
| @JoinTable(name="USER_GROUP",
| joinColumns={@JoinColumn(name="USER_ID")},
| inverseJoinColumns={@JoinColumn(name="GROUP_ID")})
| public Set<Group> getGroups() {
| return groups;
| }
| public void setGroups( Set<Group> groups ) {
| this.groups = groups;
| }
| }
|
Group.java
| @Entity
| @Name("group")
| @Table(name="GROUPS")
| public class Group implements Serializable {
| ...
| @ManyToMany(cascade=CascadeType.ALL)
| @JoinTable(name="USER_GROUP",
| joinColumns={@JoinColumn(name="USER_ID")},
| inverseJoinColumns={@JoinColumn(name="GROUP_ID")})
| public Set<Group> getGroups() {
| return groups;
| }
| public void setGroups( Set<Group> groups ) {
| this.groups = groups;
| }
| }
|
GroupManagerBean.java
| @Stateful
| @Name("groupManager")
| @LoggedIn
| public class GroupManagerBean implements GroupManager, Serializable {
| ...
| public void create() {
| group = new Group();
| group.setGroupname( newGroupname() );
| orgmobDatabase.persist( group );
| // User owns the bidirectional many-to-many relationship with Group
| user.getGroups().add( group );
| orgmobDatabase.merge( user );
| orgmobDatabase.refresh( group );
| // PROBLEM:
| // I thought that group.getUsers() would contain user, but it doesn't!
| //debug
| log.debug( "for user "+user+" created group: "+group);
| log.debug( "user "+user+" has "+user.getGroups().size()+" groups");
| log.debug( "group "+group+" has "+group.getUsers().size()+" users");
| for ( Group g : user.getGroups() ) {
| log.debug( "a group for user "+user+": "+g);
| }
| for ( User u : group.getUsers() ) {
| log.debug( "a user for group"+group+": "+u);
| }
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960200#3960200
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960200
19 years, 9 months