[Messaging, JMS & JBossMQ] - Re: Sending Entities in Messages?
by SmokingAPipe
I have all this set up, and I'm getting:
javax.naming.NameNotFoundException: TestQueue not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
| at javax.naming.InitialContext.lookup(InitialContext.java:392)
| etc
|
Here's my MDB:
@MessageDriven(activationConfig =
| {
| @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
| @ActivationConfigProperty(propertyName="destination",propertyValue="queue/TestQueue")
| })
| public class TestMDB implements MessageListener {
which should create teh TestQueue, right?
Any ideas on this? As with all things JBoss, getting the configuration right is half the battle.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996744#3996744
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996744
17 years, 8 months
[Installation, Configuration & Deployment] - Re: Starnge exception
by torben.frojonck
Hello Peter,
Here is the code. I have marked the call til Class.forName with bold.
private void createPingTest(
HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException {
PrintWriter out=resp.getWriter();
out.println("");
out.println("Dan test case");
out.println("");
try {
// Build up the job
String server=req.getParameter("server");
String emailAdress=req.getParameter("email");
if (!Configurator.isValidEmailAddress(emailAdress)){
out.println("Du skal angive en valid adresse.");
out.println("<a href=\"definerpingjob.jsp\">definer test" );
out.println("");
out.close();
return;
}
Integer tid=new Integer(req.getParameter("tid"));
if (tid==null || tid.intValue()<=0){
out.println("Antal test skal være st?rre end 0.");
out.println("<a href=\"definerpingjob.jsp\">definer test" );
out.println("");
out.close();
return;
}
Integer frekvens=new Integer(req.getParameter("frekvens"));
if (frekvens==null || frekvens.intValue()<=0){
out.println("Tid mellem to test skal være st?rre end 0.");
out.println("<a href=\"definerpingjob.jsp\">definer test" );
out.println("");
out.close();
return;
}
Integer husnr=new Integer(req.getParameter("husnr"));
if (husnr==null || husnr.intValue()<=0){
out.println("Husnummer skal bare være et tal");
out.println("<a href=\"definerpingjob.jsp\">definer test" );
out.println("");
out.close();
return;
}
StdSchedulerFactory factory= new StdSchedulerFactory();
Collection schedCollection= factory.getAllSchedulers();
Iterator iter=schedCollection.iterator();
Scheduler schedule=null;
while (iter.hasNext()){
schedule=(Scheduler) iter.next();
}
// Her defineres jobbet
Configurator conf=new Configurator();
Connection con=conf.getConnection();
PreparedStatement ps=con.prepareStatement("select nextval('job_id')");
ResultSet rs=ps.executeQuery();
Integer jobId=null;
while (rs.next()){
jobId=new Integer(rs.getInt(1));
}
rs.close();
ps.close();
Calendar cal=Calendar.getInstance(TimeZone.getTimeZone("UTC"));
Class detailClass=Class.forName("dk.frojonck.pingtest.schedule.PingTest");
JobDetail job=new JobDetail(jobId.toString(),"pingtest",
detailClass);
JobDataMap dataMap=job.getJobDataMap();
dataMap.put("server",server);
dataMap.put("email",emailAdress);
dataMap.put("antalping",Configurator.getProperty("antalping"));
dataMap.put("jobid",jobId.toString());
cal.add(Calendar.SECOND,10);
Date startTime=cal.getTime();
cal.add(Calendar.HOUR_OF_DAY,tid.intValue());
// cal.add(Calendar.MINUTE,tid.intValue());
Date endTime=cal.getTime();
SimpleTrigger trigger=new SimpleTrigger(jobId.toString(),"pingtest",
startTime,endTime,SimpleTrigger.REPEAT_INDEFINITELY,
((long) frekvens.intValue())*1000*60);
schedule.scheduleJob(job,trigger);
ps=con.prepareStatement("insert into pingtest "+
"(id, husnr, email,start_time, end_time, antal, interval,pinghost,bruger_id) "+
"values (?,?,?,?,?,?,?,?,?)"
);
ps.setInt(1,jobId.intValue());
ps.setInt(2,husnr.intValue());
ps.setString(3,emailAdress);
ps.setTimestamp(4,new Timestamp(startTime.getTime()),cal);
ps.setTimestamp(5,new Timestamp(endTime.getTime()),cal);
ps.setInt(6,Integer.parseInt(Configurator.getProperty("antalping")));
ps.setInt(7,frekvens.intValue());
ps.setString(8,server);
ps.setString(9,req.getRemoteUser());
ps.execute();
// con.commit();
ps.close();
con.close();
String messagetext="Du har mulighed for at følge "+
" resultaterne på siden "+
" https://www.frojonck.dk/pingtest/resultatgraf.jsp?jobid="+
jobId.toString();
out.println(""+messagetext+"");
WriteMail mail=new WriteMail(Configurator.getProperty("smtphost"));
mail.setFrom(Configurator.getProperty("from"));
mail.addTo(emailAdress);
mail.setSubject("[PINGTEST] testcase er registreret");
mail.setTextPart(messagetext+
"\n bruger er ping \n kodeord er xxx");
mail.sendMessage();
}
catch (Exception e){e.printStackTrace();}
out.println("");
out.close();
// TODO Auto-generated method stub
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996741#3996741
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996741
17 years, 8 months