[EJB 3.0] - illegal access to loading collection
by grafl
Hi
Reading the Hibernate ref. I decided to try a small example, the weblog.
I am using JBOSS-4.0.4.GA, EJB3 and hibernate-3.2.
These are the Java sources:
- the Blogs.java (ENTITY)
| package weblog;
|
| 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.Id;
| import javax.persistence.OneToMany;
| import javax.persistence.Table;
| import javax.persistence.UniqueConstraint;
|
| @Entity
| @Table(name = "weblog.blogs", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }) })
| public class Blogs implements java.io.Serializable {
|
| private static final long serialVersionUID = 255571063365822285L;
| private int blogId;
| private String name;
| private Set<BlogItems> blogItemses = new HashSet<BlogItems>(0);
|
| public Blogs() {}
|
| public Blogs(int blogId) {
| this.blogId = blogId;
| }
|
| public Blogs(int blogId, String name) {
| this.blogId = blogId;
| this.name = name;
| }
|
| public Blogs(int blogId, String name, Set<BlogItems> blogItemses) {
| this.blogId = blogId;
| this.name = name;
| this.blogItemses = blogItemses;
| }
|
| @Id
| @Column(name = "blog_id", unique = true, nullable = false, insertable = true, updatable = true)
| public int getBlogId() { return this.blogId; }
| public void setBlogId(int blogId) { this.blogId = blogId; }
|
| @Column(name = "name", unique = true, nullable = false, insertable = true, updatable = true, length = 50)
| public String getName() { return this.name; }
| public void setName(String name) { this.name = name; }
|
| @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "blogs")
| public Set<BlogItems> getBlogItemses() { return this.blogItemses; }
| public void setBlogItemses(Set<BlogItems> blogItemses) { this.blogItemses = blogItemses; }
|
| @Override
| public int hashCode() {
| final int PRIME = 31;
| int result = 1;
| result = PRIME * result + blogId;
| result = PRIME * result + ((blogItemses == null) ? 0 : blogItemses.hashCode());
| result = PRIME * result + ((name == null) ? 0 : name.hashCode());
| return result;
| }
|
| @Override
| public boolean equals(Object obj) {
| if (this == obj)
| return true;
| if (obj == null)
| return false;
| if (getClass() != obj.getClass())
| return false;
| final Blogs other = (Blogs) obj;
| if (blogId != other.blogId)
| return false;
| if (blogItemses == null) {
| if (other.blogItemses != null)
| return false;
| } else if (!blogItemses.equals(other.blogItemses))
| return false;
| if (name == null) {
| if (other.name != null)
| return false;
| } else if (!name.equals(other.name))
| return false;
| return true;
| }
|
| }
|
- the BlogItems (ENTITY)
| package weblog;
|
| import java.util.Date;
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.FetchType;
| import javax.persistence.Id;
| import javax.persistence.JoinColumn;
| import javax.persistence.ManyToOne;
| import javax.persistence.Table;
| import javax.persistence.Temporal;
| import javax.persistence.TemporalType;
|
| @Entity
| @Table(name = "weblog.blog_items", uniqueConstraints = {})
| public class BlogItems implements java.io.Serializable {
|
| private static final long serialVersionUID = 288936795343606406L;
| private int blogItemId;
| private Blogs blogs;
| private String title;
| private String text;
| private Date datetime;
|
| public BlogItems() { }
|
| public BlogItems(int blogItemId, String title) {
| this.blogItemId = blogItemId;
| this.title = title;
| this.text = title;
| this.datetime = new Date();
| }
|
| public BlogItems(int blogItemId, Blogs blogs, String title, String text,
| Date datetime) {
| this.blogItemId = blogItemId;
| this.blogs = blogs;
| this.title = title;
| this.text = text;
| this.datetime = datetime;
| }
|
| @Id
| @Column(name = "blog_item_id", unique = true, nullable = false, insertable = true, updatable = true)
| public int getBlogItemId() {
| return this.blogItemId;
| }
|
| public void setBlogItemId(int blogItemId) {
| this.blogItemId = blogItemId;
| }
|
| @ManyToOne(cascade = {}, fetch = FetchType.LAZY)
| @JoinColumn(name = "blog", unique = false, nullable = false, insertable = true, updatable = true)
| public Blogs getBlogs() {
| return this.blogs;
| }
|
| public void setBlogs(Blogs blogs) {
| this.blogs = blogs;
| }
|
| @Column(name = "title", unique = false, nullable = false, insertable = true, updatable = true, length = 50)
| public String getTitle() {
| return this.title;
| }
|
| public void setTitle(String title) {
| this.title = title;
| }
|
| @Column(name = "text", unique = false, nullable = false, insertable = true, updatable = true, length = 50)
| public String getText() {
| return this.text;
| }
|
| public void setText(String text) {
| this.text = text;
| }
|
| @Temporal(TemporalType.DATE)
| @Column(name = "datetime", unique = false, nullable = false, insertable = true, updatable = true, length = 4)
| public Date getDatetime() {
| return this.datetime;
| }
|
| public void setDatetime(Date datetime) {
| this.datetime = datetime;
| }
|
| @Override
| public int hashCode() {
| final int PRIME = 31;
| int result = 1;
| result = PRIME * result + blogItemId;
| result = PRIME * result + ((blogs == null) ? 0 : blogs.hashCode());
| result = PRIME * result + ((datetime == null) ? 0 : datetime.hashCode());
| result = PRIME * result + ((text == null) ? 0 : text.hashCode());
| result = PRIME * result + ((title == null) ? 0 : title.hashCode());
| return result;
| }
|
| @Override
| public boolean equals(Object obj) {
| if (this == obj)
| return true;
| if (obj == null)
| return false;
| if (getClass() != obj.getClass())
| return false;
| final BlogItems other = (BlogItems) obj;
| if (blogItemId != other.blogItemId)
| return false;
| if (blogs == null) {
| if (other.blogs != null)
| return false;
| } else if (!blogs.equals(other.blogs))
| return false;
| if (datetime == null) {
| if (other.datetime != null)
| return false;
| } else if (!datetime.equals(other.datetime))
| return false;
| if (text == null) {
| if (other.text != null)
| return false;
| } else if (!text.equals(other.text))
| return false;
| if (title == null) {
| if (other.title != null)
| return false;
| } else if (!title.equals(other.title))
| return false;
| return true;
| }
|
| }
|
and the STATELESS beans:
| package weblog;
|
| import javax.ejb.Stateless;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
|
| @Stateless
| public class BlogsBean implements BlogsRemote, BlogsLocal, java.io.Serializable {
|
| private static final long serialVersionUID = 2078312303442351155L;
| private static final Log log = LogFactory.getLog(BlogsBean.class);
|
| @PersistenceContext(unitName="webloan")
| private EntityManager entityManager;
|
| public void persist(Blogs transientInstance) {
| log.debug("persisting Blogs instance");
| try {
| entityManager.persist(transientInstance);
| log.debug("persist successful");
| } catch (RuntimeException re) {
| log.error("persist failed", re);
| throw re;
| }
| }
|
| public void remove(Blogs persistentInstance) {
| log.debug("removing Blogs instance");
| try {
| entityManager.remove(persistentInstance);
| log.debug("remove successful");
| } catch (RuntimeException re) {
| log.error("remove failed", re);
| throw re;
| }
| }
|
| public Blogs merge(Blogs detachedInstance) {
| log.debug("merging Blogs instance");
| try {
| Blogs result = entityManager.merge(detachedInstance);
| log.debug("merge successful");
| return result;
| } catch (RuntimeException re) {
| log.error("merge failed", re);
| throw re;
| }
| }
|
| public Blogs findById(int id) {
| log.debug("getting Blogs instance with id: " + id);
| try {
| Blogs instance = entityManager.find(Blogs.class, id);
| log.debug("get successful");
| return instance;
| } catch (RuntimeException re) {
| log.error("get failed", re);
| throw re;
| }
| }
|
| public void addItem(int blog_id, int blogitem_id, String text) {
| log.debug("1");
| try {
| Blogs instance = entityManager.find(Blogs.class, blog_id);
| BlogItems bi = new BlogItems(blogitem_id, text);
| instance.getBlogItemses().add(bi);
| Blogs result = entityManager.merge(instance);
| log.debug("merge successful");
| } catch (RuntimeException re) {
| log.error("merge failed", re);
| throw re;
| }
| }
|
| }
|
| package gl.weblog;
|
| import javax.ejb.Stateless;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
|
| @Stateless
| public class BlogItemsBean implements BlogItemsRemote, BlogItemsLocal, java.io.Serializable {
|
| private static final long serialVersionUID = -6463759247311226709L;
| private static final Log log = LogFactory.getLog(BlogItemsBean.class);
|
| @PersistenceContext(unitName="webloan")
| private EntityManager entityManager;
|
| public void persist(BlogItems transientInstance) {
| log.debug("persisting BlogItems instance");
| try {
| entityManager.persist(transientInstance);
| log.debug("persist successful");
| } catch (RuntimeException re) {
| log.error("persist failed", re);
| throw re;
| }
| }
|
| public void remove(BlogItems persistentInstance) {
| log.debug("removing BlogItems instance");
| try {
| entityManager.remove(persistentInstance);
| log.debug("remove successful");
| } catch (RuntimeException re) {
| log.error("remove failed", re);
| throw re;
| }
| }
|
| public BlogItems merge(BlogItems detachedInstance) {
| log.debug("merging BlogItems instance");
| try {
| BlogItems result = entityManager.merge(detachedInstance);
| log.debug("merge successful");
| return result;
| } catch (RuntimeException re) {
| log.error("merge failed", re);
| throw re;
| }
| }
|
| public BlogItems findById(int id) {
| log.debug("getting BlogItems instance with id: " + id);
| try {
| BlogItems instance = entityManager.find(BlogItems.class, id);
| log.debug("get successful");
| return instance;
| } catch (RuntimeException re) {
| log.error("get failed", re);
| throw re;
| }
| }
| }
|
When I want to create a new BlogItems object, by adding it to the list of BlogItems, wich belongs to Blogs entity, I get the
| illegal access to loading collection
|
error message.
My client source looks like this:
| package weblog;
|
| import java.util.List;
| import java.util.Properties;
| import javax.naming.InitialContext;
|
| public class Test01 {
| Blogs ablogok;
| BlogItems ablogitemek;
|
| Test01(String blog_id, String blogitem_id, String blogitem_title) {
| System.out.println("- 0:"+blog_id);
| System.out.println("- 1:"+blogitem_id);
| System.out.println("- 2:"+blogitem_title);
| }
|
| public void addItemToBlog(String blog_id, String blogitem_id, String blogitem_title) {
| Integer BLOG_ID = new Integer(blog_id);
| Integer BLOGITEM_ID = new Integer(blogitem_id);
| try {
| Properties properties = new Properties();
| properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
| properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
| properties.put("java.naming.provider.url","192.1xx.1xx.1xx:1099");
| InitialContext ctx = new InitialContext();
| BlogsInterface bf = (BlogsInterface) ctx.lookup("BlogsBean/remote");
| bf.addItem(BLOG_ID.intValue(), BLOGITEM_ID.intValue(), blogitem_title);
| } catch(Exception ex) {
| System.out.println("ERROR: "+ex.getMessage()+"\n");
| //ex.printStackTrace();
| }
| }
|
| public static void main(String[] args) {
| Test01 t1 = new Test01(args[0], args[1], args[2]);
| t1.addItemToBlog(args[0], args[1], args[2]);
| t1 = null;
| }
| }
|
and the error stack
| 15:27:50,075 ERROR [LazyInitializationException] illegal access to loading collection
| org.hibernate.LazyInitializationException: illegal access to loading collection
| at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
| at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
| at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:355)
| at weblog.Blogs.hashCode(Blogs.java:58)
| at weblog.BlogItems.hashCode(BlogItems.java:101)
| at java.util.HashMap.put(HashMap.java:372)
| at java.util.HashSet.add(HashSet.java:200)
| at java.util.AbstractCollection.addAll(AbstractCollection.java:238)
| at org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:273)
| at org.hibernate.engine.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:183)
| at org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:268)
| at org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:249)
| at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:866)
| at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:853)
| at org.hibernate.loader.Loader.doQuery(Loader.java:717)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
| at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
| at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
| at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:541)
| at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
| at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1705)
| at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
| at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
| at org.hibernate.collection.AbstractPersistentCollection.readElementExistence(AbstractPersistentCollection.java:142)
| at org.hibernate.collection.PersistentSet.add(PersistentSet.java:162)
| at weblog.BlogsBean.addItem(BlogsBean.java:69)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:589)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:225)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
| 15:27:50,081 ERROR [BlogsBean] merge failed
| org.hibernate.LazyInitializationException: illegal access to loading collection
| at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
| at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
| at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:355)
| at weblog.Blogs.hashCode(Blogs.java:58)
| at weblog.BlogItems.hashCode(BlogItems.java:101)
| at java.util.HashMap.put(HashMap.java:372)
| at java.util.HashSet.add(HashSet.java:200)
| at java.util.AbstractCollection.addAll(AbstractCollection.java:238)
| at org.hibernate.collection.PersistentSet.endRead(PersistentSet.java:273)
| at org.hibernate.engine.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:183)
| at org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:268)
| at org.hibernate.engine.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:249)
| at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:866)
| at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:853)
| at org.hibernate.loader.Loader.doQuery(Loader.java:717)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
| at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
| at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
| at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:541)
| at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
| at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1705)
| at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
| at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
| at org.hibernate.collection.AbstractPersistentCollection.readElementExistence(AbstractPersistentCollection.java:142)
| at org.hibernate.collection.PersistentSet.add(PersistentSet.java:162)
| at weblog.BlogsBean.addItem(BlogsBean.java:69)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:589)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:225)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
|
Please help me.
Thank you
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010048#4010048
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010048
19Â years, 2Â months
[JBoss Eclipse IDE (users)] - Can not start JBOss 4.0.4 (running on Linux)
by srini6699
I'm getting the errors below when I start JBoss on Linux. I'm logged on as root and jboss-service.xml which its complaining about is owned by root..I'd appreciate any help from you..
Failed to boot JBoss:
org.jboss.deployment.DeploymentException: Could not initialise deployment: file:/usr/local/jboss-4.0.4.GA/server/default/conf/jboss-service.xml; - nested throwable: (java.lang.NullPointerException)
at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException (DeploymentException.java:53)
at org.jboss.deployment.MainDeployer.deploy (MainDeployer.java:805)
at org.jboss.deployment.MainDeployer.deploy (MainDeployer.java:773)
at org.jboss.deployment.MainDeployer.deploy (MainDeployer.java:756)
at java.lang.reflect.Method.invoke (libgcj.so.7)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke (ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch (Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke (Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke (AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke (MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke (MBeanProxyExt.java:210)
at $Proxy4.deploy (Unknown Source)
at org.jboss.system.server.ServerImpl.doStart (ServerImpl.java:487)
at org.jboss.system.server.ServerImpl.start (ServerImpl.java:367)
at org.jboss.Main.boot (Main.java:201)
at org.jboss.Main$1.run (Main.java:470)
at java.lang.Thread.run (libgcj.so.7)
Caused by: java.lang.NullPointerException
at java.lang.String.startsWith (libgcj.so.7)
at org.jboss.deployment.MainDeployer.inLocalCopyDir (MainDeployer.java:1185)
at org.jboss.deployment.MainDeployer.init (MainDeployer.java:915)
at org.jboss.deployment.MainDeployer.deploy (MainDeployer.java:798)
...15 more
09:27:47,441 INFO [ServerInfo] Java version: 1.4.2,Free Software Foundation, Inc.
09:27:47,441 INFO [ServerInfo] Java VM: GNU libgcj 4.1.0 20060304 (Red Hat 4.1.0-3),Free Software Foundation, Inc.
09:27:47,441 INFO [ServerInfo] OS-System: Linux 2.6.15-1.2054_FC5,i386
09:27:48,022 WARN [ServiceController] Problem creating service jboss.system:service=MainDeployer
java.lang.NoClassDefFoundError: $Proxy1
at java.lang.Class.initializeClass (libgcj.so.7)
at java.lang.reflect.Field.set (libgcj.so.7)
at java.lang.reflect.Field.set (libgcj.so.7)
at java.lang.reflect.Field.set (libgcj.so.7)
at java.lang.reflect.Proxy$ClassFactory.generate (libgcj.so.7)
at java.lang.reflect.Proxy.getProxyClass (libgcj.so.7)
at java.lang.reflect.Proxy.newProxyInstance (libgcj.so.7)
at org.jboss.mx.util.MBeanProxyExt.create (MBeanProxyExt.java:395)
at org.jboss.mx.util.MBeanProxyExt.create (MBeanProxyExt.java:349)
at org.jboss.mx.util.MBeanProxyExt.create (MBeanProxyExt.java:335)
at org.jboss.system.server.ServerConfigLocator.locate (ServerConfigLocator.java:42)
at org.jboss.deployment.MainDeployer.createService (MainDeployer.java:471)
at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate (ServiceMBeanSupport.java:261)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle (ServiceMBeanSupport.java:243)
at java.lang.reflect.Method.invoke (libgcj.so.7)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke (ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch (Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke (Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke (AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke (MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke (ServiceController.java:978)
at $Proxy0.create (Unknown Source)
at org.jboss.system.ServiceController.create (ServiceController.java:331)
at org.jboss.system.ServiceController.create (ServiceController.java:274)
at java.lang.reflect.Method.invoke (libgcj.so.7)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke (ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch (Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke (Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke (AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke (MBeanServerImpl.java:659)
at org.jboss.system.server.ServerImpl.startBootService (ServerImpl.java:564)
at org.jboss.system.server.ServerImpl.doStart (ServerImpl.java:446)
at org.jboss.system.server.ServerImpl.start (ServerImpl.java:367)
at org.jboss.Main.boot (Main.java:201)
at org.jboss.Main$1.run (Main.java:470)
at java.lang.Thread.run (libgcj.so.7)
Caused by: java.lang.ClassNotFoundException: javax.management.MBeanServer
at java.lang.ClassLoader.findClass (libgcj.so.7)
at java.lang.ClassLoader.loadClass (libgcj.so.7)
at java.lang.ClassLoader.loadClass (libgcj.so.7)
at org.jboss.mx.util.MBeanProxyExt$2.loadClass (MBeanProxyExt.java:375)
at java.lang.Class.initializeClass (libgcj.so.7)
...35 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010047#4010047
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010047
19Â years, 2Â months
[JBoss Portal] - Re: How to configure the portal from code
by Antoine_h
question : why can't you use the usual *-object.xml to describe the pages, windows etc... of your portal ?
and put all this in a webapp (.war file) and deploy it like that ?
do you have a specific need ?
seems more simple to use the xml descriptor than programatically write all this setup of your portal.
for the users : see also how it is done the first time the portal launch, for the creation of the two default user (user and admin).
they are set by a file :
\deploy\jboss-portal_2_4_1SP1.sar\conf\hibernate\user\setup.txt
this file is used by hibernate to populate the user and role tables at first launch.
It shows how to populate some user with the UserImpl and RoleImpl classes. You can reuse this to write some better way to do it than just replacing this file.
you could also launch a sql script to populate automatically the tables with your user definition.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010045#4010045
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010045
19Â years, 2Â months
[EJB/JBoss] - Stateless session bean cyclic reference
by vstoyanov
I am having the following issue:
There is an application in which the stateless beans are referencing each other cyclically, because they have to use each others' methods. It is done with the Local interface.
Unfortunately, each SLB is obtaining references to the others in its ejbCreate() which causes a endless loop (actually it ends - with a StackOveflowException). However the application runs just fine on jboss prior to 4.0.2 and on several other appservers.
So the facts are - the app is perfectly running on jboss 4.0.1 and prior, and when run on jboss 4.0.2 it crashes uppon the first SLB creation with a mile-long stack trace and StackOverflowException.
We have also tried running it on various jre's, to assure that it is not a low-level problem.
I have read through the jboss forums and have seen a post by one of the jboss team members which says that the two significant changes in jboss from 4.0.1 to 4.0.2 are the hibernate version and the classloading model. Hibernate isn't used in that project.
We've tried various configuration file modifications including <ignore-dependencies /> and setting a explicit CL repository with <loader-repository> in the jboss-application.xml.
Unfortunately none of this really gave any result. So I wonder if it might be a jboss problem (e.g. bug introduced in the 4.0.2 version or st.)
I can give a simple application, we made to idenrify the problem, which has only 2 stateless session beans calling each other in the same fashion like the real app. It has the same behaviour - working on the jb <=4.0.1 and glassfish and geronimo and crashing on jb >=4.0.2
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010039#4010039
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010039
19Â years, 2Â months