[JBoss Messaging] - Re: JBoss Messaging client app fails to reconnect after rest
by pgervais
After further investigation, it seems that the problem is due to a cleanup problem with the org.jboss.remoting.InvokerRegistry. The client invoker and server invoker from the previously created connection are not cleaned when the close method fails. I modified my code to clean this up manually
using the following code before trying to recreate a connection:
| ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();
| for (ServerInvoker invoker : serverInvokers)
| {
| invoker.stop();
| invoker.destroy();
| InvokerRegistry.destroyServerInvoker(invoker);
| }
| ClientInvoker[] clientInvokers = InvokerRegistry.getClientInvokers();
| for (ClientInvoker invoker : clientInvokers)
| {
| InvokerRegistry.destroyClientInvoker(invoker.getLocator(), null);
| }
|
and the connection could be created without stopping my application, this also took care of the WorkerThread that I mentionned in my previous post.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037747#4037747
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037747
19 years, 2 months
[EJB 3.0] - Re: ManyToOne and Composite Keys
by jimk1723
I think I answered my own question - I was hung up on the seam-gen'ed code; I implemented my own entities which seem to work fine.
I removed the mappedBy attribute on the @OneToMany annotation and added a @JoinColumn annotation - that seemed to fix things.
package com.mydomain.example;
|
| import java.util.HashSet;
| import java.util.Set;
|
| import javax.persistence.CascadeType;
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.FetchType;
| import javax.persistence.GeneratedValue;
| import javax.persistence.Id;
| import javax.persistence.JoinColumn;
| import javax.persistence.OneToMany;
| import javax.persistence.Table;
|
| import org.hibernate.validator.NotNull;
|
| /**
| * Department generated by hbm2java
| */
| @Entity
| @Table(name = "DEPARTMENT")
| public class Department implements java.io.Serializable {
|
| private long departmentId;
|
| private Set<DepartmentStrings> strings = new HashSet<DepartmentStrings>(0);
|
| public Department() {
| }
|
| public Department(long departmentId) {
| this.departmentId = departmentId;
| }
|
| public Department(long departmentId,
| Set<DepartmentStrings> departmentStringses) {
| this.departmentId = departmentId;
|
| this.strings = departmentStringses;
| }
|
| @Id
| @Column(name = "DEPARTMENT_ID", unique = true, nullable = false, precision = 16, scale = 0)
| @NotNull
| @GeneratedValue
| public long getDepartmentId() {
| return this.departmentId;
| }
|
| public void setDepartmentId(long departmentId) {
| this.departmentId = departmentId;
| }
|
| @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
| @JoinColumn(name = "DEPARTMENT_ID")
| public Set<DepartmentStrings> getStrings() {
| return this.strings;
| }
|
| public void setStrings(Set<DepartmentStrings> strings) {
| this.strings = strings;
| }
|
| }
|
package com.mydomain.example;
|
| import javax.persistence.AttributeOverride;
| import javax.persistence.AttributeOverrides;
| import javax.persistence.Column;
| import javax.persistence.EmbeddedId;
| import javax.persistence.Entity;
| import javax.persistence.Table;
|
| import org.hibernate.validator.NotNull;
|
| /**
| * DepartmentStrings generated by hbm2java
| */
| @Entity
| @Table(name = "DEPARTMENT_STRINGS")
| public class DepartmentStrings implements java.io.Serializable {
|
| private DepartmentStringsId id;
|
| private String name;
|
| public DepartmentStrings() {
| }
|
| public DepartmentStrings(DepartmentStringsId id) {
| this.id = id;
| }
|
| @Column(name = "NAME")
| public String getName() {
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| @EmbeddedId
| @AttributeOverrides( {
| @AttributeOverride(name = "department", column = @Column(name = "DEPARTMENT_ID", precision = 16, scale = 0)),
| @AttributeOverride(name = "langCode", column = @Column(name = "LANG_CODE", nullable = false, length = 5)) })
| @NotNull
| public DepartmentStringsId getId() {
| return this.id;
| }
|
| public void setId(DepartmentStringsId id) {
| this.id = id;
| }
| }
|
package com.mydomain.example;
|
| import java.io.Serializable;
|
| import javax.persistence.Column;
| import javax.persistence.JoinColumn;
| import javax.persistence.ManyToOne;
|
| public class DepartmentStringsId implements Serializable {
|
| private Department department;
|
| private String langCode;
|
| public DepartmentStringsId() {
| }
|
| public DepartmentStringsId(Department department, String langCode) {
| super();
| this.department = department;
| this.langCode = langCode;
| }
|
| @ManyToOne
| @JoinColumn(name = "DEPARTMENT_ID")
| public Department getDepartment() {
| return department;
| }
|
| public void setDepartment(Department department) {
| this.department = department;
| }
|
| @Column(name = "LANG_CODE")
| public String getLangCode() {
| return langCode;
| }
|
| public void setLangCode(String langCode) {
| this.langCode = langCode;
| }
| }
|
...and some quick TestNG methods:
| @Test(enabled = true)
| public void testCreateWithString() throws Exception {
| EntityManagerFactory emf = Persistence
| .createEntityManagerFactory("ejbexample");
| EntityManager em = emf.createEntityManager();
| em.getTransaction().begin();
|
| Department d = new Department();
|
| DepartmentStrings ds1 = new DepartmentStrings(new DepartmentStringsId(
| d, "en-us"));
| ds1.setName("Test name");
|
| DepartmentStrings ds2 = new DepartmentStrings(new DepartmentStringsId(
| d, "es-mx"));
| ds2.setName("Pruebe el nombre");
|
| d.getStrings().add(ds1);
| d.getStrings().add(ds2);
|
| em.persist(d);
| em.getTransaction().commit();
|
| this.departmentId = d.getDepartmentId();
| }
|
| @Test(enabled = true, dependsOnMethods = "testCreateWithString")
| public void testLookup() throws Exception {
| EntityManagerFactory emf = Persistence
| .createEntityManagerFactory("ejbexample");
| EntityManager em = emf.createEntityManager();
| Department d = em.find(Department.class, this.departmentId);
|
| assert d.getStrings().size() == 2;
|
| for (DepartmentStrings ds : d.getStrings()) {
| assert ds.getName().equals("Test name")
| || ds.getName().equals("Pruebe el nombre");
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037738#4037738
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037738
19 years, 2 months
[JBoss Eclipse IDE (users)] - JDWP unable to get necessary JVMTI capabilities
by vulee
Jboss AS 4.03 SP1 Running on Linux
Eclipse 3.1.2 running on XP
Though I could remotely debug jboss AS which ran on my window, I could not debug when Jboss AS ran on Linux. First, I modified the wrapper.conf to specify additional parameter as
...
wrapper.java.additional.4=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4142,suspend=n
wrapper.debug=true
....
After jboss app server had started, I tried but could not establish connection to the remote AS from Eclipse remote java application. I searched and could not find '4142' in the server.log.
On the second attempt, I tried to start jboss by run.sh script. I modified this file to add
...
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4142,suspend=n"
....
I restarted jboss AS and got this exception.
JDWP unable to get necessary JVMTI capabilities
>From google, I knew this error occured in jdk 5.0.1, but my jdk is 5.0.6.
Since my jdk version on window is the same as the one on Linux and I have been successfully remotely debug AS on window, I don't think jdk could be an issue.
Have any one successfully remote debug on Linux using jdk 1.5?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037723#4037723
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037723
19 years, 2 months