[EJB 3.0] - Re: JBoss 4.2.2 and TimerService null pointer exception
by jaikiran
"kyle.bober" wrote : I have a Stateless session bean that is also a WebService. When I attempt to inject a TimerService and create a new timer Instance the TimerService is always returned as null. It seems the TimerService is never injected.
|
I have not tried injecting the TimerService in any of my sample applications. So i am not sure whether that is working or not. But i just found this open issue in the JIRA https://jira.jboss.org/jira/browse/EJBTHREE-1391
"kyle.bober" wrote :
| I also attempted injecting the SessionContext as well using @Resource and obtaining the TimerService via the SessionContext but the SessionContext is also null.
I don't think there should be a problem with the SessionContext injection. Post your exact code and also the exception stacktrace and the server.log logs (from the point when your application is being deployed). Which version of JBoss and Java do you use?
P.S: While posting logs or xml content or code, remember to wrap it in a code block, by using the Code button in the message editor window. Please hit the Preview button before posting to ensure that the post is correctly formatted.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170752#4170752
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170752
17 years, 11 months
[EJB 3.0] - Re: Using Connection Pool in EJB 3.0
by jaikiran
"mabimal" wrote : Hi all,
| I am in the requirement of developing EJB without entity beans and simply using stateless beans. In this scenario how can i connect to database?
|
Through datasource.
"mabimal" wrote :
| and Can i use the existing connection pool.
|
Yes, you can.
"mabimal" wrote :
| It's saved in XML file as a configuration file. This is working connection pool in web container.
|
Which xml file? JBoss has its own datasource pooling implementation where you configure the datasource through a -ds.xml file. Is this the same that you are talking about? If not, please provide more details.
"mabimal" wrote :
| How to make it run in ejb jar file. It has been successfully tested on web modules. How to change it so that it will run on ejb jar.
|
The datasource is created at the server level. It will be accessible through JNDI for both the web component and the ejb component.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170747#4170747
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170747
17 years, 11 months
[Beginners Corner] - Re: javax.crypto.Mac
by rstaveley
Here's a full dump:
Linkage error in javax.crypto.Mac
java.lang.NoClassDefFoundError
at javax.crypto.Mac.getInstance(DashoA12275)
at org.apache.jsp.test_jsp._jspService(test_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)
Using...
<%!
public static String getStackTrace(Throwable e) {
final java.io.Writer result = new java.io.StringWriter();
final java.io.PrintWriter writer = new java.io.PrintWriter(result);
e.printStackTrace(writer);
return result.toString();
}
%>
<%
try {
javax.crypto.Mac mac = javax.crypto.Mac.getInstance("HmacSHA1");
if (mac == null) {
out.print("No Mac found for HmacSHA1");
}
else {
java.security.Provider provider = mac.getProvider();
out.print("Mac instance: "+mac.getClass().getName()+"\r\n");
out.print("Provider: "+provider.getClass().getName()+" - "+provider.getInfo()+"\r\n");
out.print("Algorithm: "+mac.getAlgorithm()+"\r\n");
}
}
catch (Exception e) {
out.print("Exception thrown, while inspecting crypto for HmacSHA1\n"+e.getMessage()+"\r\n");
}
catch (LinkageError le) {
out.print("Linkage error in javax.crypto.Mac\r\n"+getStackTrace(le).replace("\n","")+"\r\n");
}
%>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170745#4170745
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170745
17 years, 11 months
[EJB 3.0] - JBoss 4.2.2 and TimerService null pointer exception
by kyle.bober
I have a Stateless session bean that is also a WebService. When I attempt to inject a TimerService and create a new timer Instance the TimerService is always returned as null. It seems the TimerService is never injected. I also attempted injecting the SessionContext as well using @Resource and obtaining the TimerService via the SessionContext but the SessionContext is also null. Here is the code:
package somepackage;
import java.rmi.RemoteException;
import java.util.Date;
import java.util.Set;
import javax.annotation.Resource;
import javax.ejb.Remote;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import org.jboss.annotation.ejb.RemoteBinding;
import org.jboss.annotation.ejb.Service;
/**
* Class which contains each of the services calls used by the client side.
* @author pcrane
*
*/
@WebService
@Stateless
@Remote(IMemberService.class)
@RemoteBinding(jndiBinding="MemberService/remote")
public class MemberService implements IMemberService
{
// @Resource
// public SessionContext theSessionContext;
@Resource
public TimerService theTimerService;
@Timeout
public void deleteUnauthorizedMembers(Timer aTimer) throws RemoteException
{
Long memberID = (Long) aTimer.getInfo();
MemberServiceImpl.deleteMember(memberID);
}
/* (non-Javadoc)
* @see com.thesearchagency.transformer.services.member.IMemberService#memberServiceUpdateAccount()
*/
@WebMethod
@WebResult(name = "memberID")
public String memberServicePersistMember(@WebParam(name="memberProfile") MemberServiceUser aUser) throws RemoteException
{
TimerService ts = theSessionContext.getTimerService();
ts.createTimer(timerExecutionDate, aUser.getMemberId());
return MemberServiceImpl.memberServicePersistMember(aUser);
}
}
package somepackage;
import java.rmi.RemoteException;
import java.util.Date;
import java.util.Set;
public interface IMemberService
{
String memberServicePersistMember(MemberServiceUser aUser) throws RemoteException;
}
Please help! I ahve been racking my brain on this for a few hours now and Timers should be fairly easy in EJB3.0!
Thanks,
Kyle
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170743#4170743
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170743
17 years, 11 months