[EJB 3.0] - Re: NullPointerException in JavaEEComponentHelper with JBoss
by jaikiran
"japase" wrote :
|
| 1) As I understand we should remove the Classpath entries from _all_ the jar deployments: not only EJBs, but also all the plain jar files in the "lib" folder.
|
You can let the plain jars have the ClassPath entries to point to other plain jars. Infact the EJB jars too can have Classpath entries pointing to *plain jar* files. But just make sure the EJB jars do not point to other EJB jars through Classpath attribute in the MANIFEST.MF. The reason i asked you to remove all Classpath entries was to keep it simple :)
"japase" wrote :
| 2) What about plain jar referring each other, i.e. if we have a plain jar file in the "lib" folder referring another plain jar file from the same "lib" folder? Will it work without Classpath specification?
|
Yes, it will work without the need for ClassPath attribute in MANIFEST.MF.
"japase" wrote :
| 3) What about war files and jar files within war files? The jar files within war files need to access the plain jar files from the earÃÂÃÂÃÂâÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂs "lib" folder,
|
The plain jars in the "lib" of the EAR are available to all components, including the jars in the WAR file, within that EAR. So it will work.
"japase" wrote :
| The jar files within war files need to access the plain jar files from the earÃÂÃÂÃÂâÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂs "lib" folder, but also EJBs.
|
Yes, the EJBs (placed at the root of the EAR) too will be available to the WARs (and the jars within that WAR).
"japase" wrote :
| Do we need to have any Classpath specification for those jar and war files?
|
No, not needed.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227682#4227682
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227682
15 years, 7 months
[Persistence, JBoss/CMP, Hibernate, Database] - problem in concurrent access of database
by Heilien
good day all,
I am running 2 program on separate JVM on the same server. both use hibernate to access the database. It seems that program1 always wait for program2 's database access complete and continue, or vice versa. It looks like sequential execution.
I guess it's something wrong with my code. anyone can help me with it?
below is the hibernate util class
import org.hibernate.*;
import org.hibernate.cfg.*;
public class HibernateUtil {
private static SessionFactory sessionFactory;
|
| static {
| try {
| sessionFactory = new Configuration().configure().buildSessionFactory();
| } catch (Throwable ex) {
| throw new RuntimeException (ex);
| }
| }
|
| public static SessionFactory getSessionFactory() {
| return sessionFactory;
| }
|
| }
every method i access the database i will use the following pattern to get session and commit
public static ArticleType createArticleType(String description) {
| ArticleType ArticleType = new ArticleType();
| ArticleType.setDescription(description);
| Session session = HibernateUtil.getSessionFactory().getCurrentSession();
| session.beginTransaction();
| session.save(ArticleType);
| session.getTransaction().commit();
| return ArticleType;
| }
I am wondering should I open and close session for every call to the database, to prevent the blocking of other process.
thanks in advance
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227680#4227680
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227680
15 years, 7 months
[JBoss AOP] - Client interceptor giving an NPE
by adamw
Hello,
I've already posted on the EJB3 forum, but didn't get any replies there, so I thought that maybe on the AOP forum I'll have more luck. If any of you get this post twice, sorry :)
First, my setup. I have an .ear application, deployed on one jboss instance (4.2.3), which contains an EJB with a remote interface.
I also have a web application, deployed on another jboss instance (also 4.2.3), which calls a method on the EJB.
Now, I'd like to add a client interceptor. I found a testcase in the ejb3 module of jbossas svn, but I must be missing some crucial step :).
The client interceptor class is very simple and is deployed both with the .ear and .war (on both jbosses) in /lib:
| public class CustomInterceptor implements Interceptor, Serializable {
| private static final long serialVersionUID = 3228182870246296423L;
| public String getName() { return "Custom interceptor"; }
| public Object invoke(Invocation invocation) throws Throwable {
| System.out.println("!!! INTERCEPTING !!!");
| invocation.getMetaData().addMetaData("jboss.ejb3.client.invocation.metadata", "xxx", "yyy", PayloadKey.AS_IS);
| return invocation.invokeNext();
| }
| }
|
To bind the interceptor with the bean, I deploy a jboss-aop.xml file (in the .ear), which has the following:
| <aop xmlns="urn:jboss:aop-beans:1.0">
| <interceptor class="example.CustomInterceptor" scope="PER_VM"/>
|
| <stack name="CustomStatelessSessionClientInterceptors">
| <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
| <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
| <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
| <interceptor-ref name="example.CustomInterceptor"/>
| <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
| </stack>
| </aop>
|
Also, on the bean class, I have the @RemoteBinding annotation, as in the testcase:
| @Stateless
| @RemoteBinding(interceptorStack="CustomStatelessSessionClientInterceptors")
| public class HelloBean implements LocalHello, RemoteHello, Hello {
| ...
| }
|
Everything deploys fine, however when I invoke a bean's method from the client web application, I get the following exception:
| java.lang.NullPointerException
| org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
| org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
| org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
| org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
| $Proxy58.printToSysOut(Unknown Source)
| client.ClientServlet.doGet(ClientServlet.java:47)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
| org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
|
Looks like the first three interceptors work fine, but then it fails on mine. Any ideas what can be wrong? I don't see any special messages when deploying.
Thanks,
Adam
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227670#4227670
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227670
15 years, 7 months