[JBoss jBPM] - Invalid byte 2 of 3-byte UTF-8 sequence in GPD / Eclipse
by tmanolat
Hi,
I try to use GPD to create a workflow definition. Some of the node names are expressed in Greek. When I edit the processdefinition.xml (manually or through the GUI), saving this file tries to update gpd.xml and here comes the problem:
"Invalid byte 2 of 3-byte UTF-8 sequence" in the line where the Greek characters occur.
Is this a problem of Eclipse in general or a problem of GPD? Please kindly help me because I need to define the process in Greek.
Some final notes:
- If no Greek characters are put in the file, then there is no problem and the gpd.xml is created ok.
- Both gpd.xml and processdefinition.xml are encoded in UTF-8, the same applies for the xml data:
Code:
<?xml version="1.0" encoding="UTF-8"?>
- My Environment is:
Eclipse 3.2.1
JBoss jBPM Designer Plug-in 3.0.12
JPDL Core Plug-In 3.0.12
Thanks for your time!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988129#3988129
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988129
19Â years, 5Â months
[JBoss Seam] - [booking example]: question regarding the HotelBookingAction
by ellenzhao
The code in question:
| @In(required=false)
| @Out(required=false)
| private Booking booking;
|
|
I thought a booking without a Booking instance sounds weird, so that I removed the (required=false) for the @In annotation. But then got an org.jboss.seam.RequiredException. But in the RegisterAction.java, there is
| @In
| private User user;
|
And it works. I looked for the more precise explanation about the "required" attribute, but the documentation didn't answer my question: Required from what? Required for what? (I thought a Booking instance should be required for a booking action, logically. But it seems that it is "required" from the context.... I changed the annotation to @In (create = true) and it worked again, but I guess the created instance would soon be an orphan in the heap since there is this line:
| booking = new Booking(hotel, user);
|
in the bookHotel() method. )
More changes I made to the code: after user login, the pageflow is managed by a jpdl file.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988122#3988122
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988122
19Â years, 5Â months
[Microcontainer] - Re: disable connection pool
by gedel
>>I dont understand why do you want to this
It is for test purposes only. I need to shutdown Embeded HSQLDB to backup dbase.script file after exporting dbase schema (by hibernate), before my tests started. But connection with closed HSQLDB retain in the pool. Then application access to it ... ba-ba-ah!!!. Therefore I need to manually close it.
I can'to solve my problem with direct JDBC code, because my application accesses to Datasources and UserTransaction through JNDI. I'm use microcontainer only for this purposes (JNDI & Tx). Certainty I can implement by my hands, but i afraid that it will be painful ...
I was expect that "no-pooling" mode is easy configurable on xml.
Ok. Which classes I should extends to provide "no-pooling" mode?
I think that is WrappedConnection, CachedConnectionManager, LocalTxDataSource
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988121#3988121
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988121
19Â years, 5Â months
[JBoss Seam] - Re: Some philosophy on the context name and access to Java B
by toni
Hi Gavin,
I'm currently looking into seam and there are a few things, which confuse me a bit.
For example, how do we initalize "context variables" appearing in .jsp pages, which do not contain any method or value binding expressions, leaving the referenced "context variables" in the .jsp file out of scope.
I read in the seam manual that there are several ways to tackle this problem. In 3.3 it says that one could use a @Create, @Factory or Page Action.
I don't see how the first two would solve my problem, because they only come into the picture, when a seam component gets created, which requires a reference to it from the .jsp page, which does not exist in the first place.
Defining a Page Action is indeed a solution, but I find it cumbersome to create a page action for every .jsp page, which solely displays information and any CRUD applicaton does so plenty.
Because of that I get the feeling that one should avoid context variables inside of .jsp files and rather use them inside Seam Components. What would be the right stratey?
I'm basically looking for a pattern, which helps me to display base data information on .jsp pages, which get directly accessed by bookmarked GET requests, without any GET Parameters.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988120#3988120
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988120
19Â years, 5Â months
[EJB 3.0] - Re: EJB 2.1 problems with EJB 3.0
by ola.hamforsï¼ diabol.se
You might need the cronjob entity as well..
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.omxgroup.cds.entity.CdsBaseEntity;
/**
* Entity representing a CronJob.
* @author olhm
*
*/
@Entity
@Table(name = "CDS_CRON_JOB")
public class CronJob extends CdsBaseEntity implements Serializable {
@SuppressWarnings("unused")
private final static String RCS_ID = "$Id: CronJob.java,v 1.5 2006/11/22 18:02:50 JAJH Exp $";
private static final long serialVersionUID = 1L;
private String description;
private String qualifiedBeanClassName;
private String cronExpression;
private String method;
private Date lastExecution;
@Override
public String toString() {
return new ToStringBuilder(this).append("id", getId()).append(
"description", getDescription()).append("qualifiedBeanClassName",
getQualifiedBeanClassName()).append("method", getMethod()).append(
"cronExpression", getCronExpression()).toString();
}
@Basic
@Column(name = "CRON_EXPRESSION")
public String getCronExpression() {
return cronExpression;
}
public void setCronExpression(String cronExpression) {
this.cronExpression = cronExpression;
}
@Basic
@Column(name = "DESCRIPTION")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Basic
@Column(name = "LAST_EXECUTION")
public Date getLastExecution() {
return lastExecution;
}
public void setLastExecution(Date lastExecution) {
this.lastExecution = lastExecution;
}
@Basic
@Column(name = "QUALIFIED_BEAN_CLASSNAME")
public String getQualifiedBeanClassName() {
return qualifiedBeanClassName;
}
public void setQualifiedBeanClassName(String qualifiedBeanClassName) {
this.qualifiedBeanClassName = qualifiedBeanClassName;
}
@Basic
@Column(name = "METHOD")
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988118#3988118
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988118
19Â years, 5Â months
[EJB 3.0] - Re: EJB 2.1 problems with EJB 3.0
by ola.hamforsï¼ diabol.se
I have written a EJB3InvokerJob.
----------------- EJB3Invoker.java --------------------------
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.apache.log4j.Logger;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;
/**
*
* @author ola.hamfors(a)diabol.se
*
*/
public class EJB3InvokerJob implements StatefulJob{
@SuppressWarnings("unused")
private final static String RCS_ID = "$Id: EJB3InvokerJob.java,v 1.6 2006/08/18 08:04:37 STNO Exp $";
public static final String EJB_JNDI_NAME_KEY = "ejb";
public static final String EJB_METHOD_KEY = "method";
public static final String EJB_INTERFACE_CLASS = "interfaceClass";
public static final String EJB_ARG_TYPES_KEY = "argTypes";
public static final String EJB_ARGS_KEY = "args";
public static final String INITIAL_CONTEXT_FACTORY = "java.naming.factory.initial";
public static final String PROVIDER_URL = "java.naming.provider.url";
Logger logger = Logger.getLogger(getClass().getName());
public EJB3InvokerJob() {
super();
}
public void execute(JobExecutionContext context)
throws JobExecutionException {
JobDetail detail = context.getJobDetail();
JobDataMap dataMap = detail.getJobDataMap();
String ejb = dataMap.getString(EJB_JNDI_NAME_KEY);
String method = dataMap.getString(EJB_METHOD_KEY);
String interfaceClass = dataMap.getString(EJB_INTERFACE_CLASS);
logger.debug("Trying to execute {ejb=" + ejb + ",method="
+ method + ",intefaceClass=" + interfaceClass + "}");
Object[] arguments = (Object[]) dataMap.get(EJB_ARGS_KEY);
if (arguments == null) {
arguments = new Object[0];
}
if (ejb == null) {
throw new JobExecutionException();
}
InitialContext jndiContext = null;
try {
jndiContext = getInitialContext(dataMap);
} catch (NamingException ne) {
throw new JobExecutionException(ne);
}
Object value = null;
try {
value = jndiContext.lookup(ejb);
} catch (NamingException ne) {
throw new JobExecutionException(ne);
}
Class beanClass;
try {
beanClass = Class.forName(interfaceClass);
} catch (ClassNotFoundException e) {
throw new JobExecutionException(e);
}
Method methodExecute = null;
Class[] argTypes = (Class[]) dataMap.get(EJB_ARG_TYPES_KEY);
if (argTypes == null) {
argTypes = new Class[arguments.length];
for (int i = 0; i < arguments.length; i++) {
argTypes = arguments.getClass();
}
}
// get all interfaces
Class[] interfaces = beanClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
try {
// try to find the method and use the first interface if we do
methodExecute = interfaces.getDeclaredMethod(method,
argTypes);
break;
} catch (NoSuchMethodException nsme) {
// do nothing
}
throw new JobExecutionException("No interface with method "
+ method + " declaired. Your Bean {" + beanClass.getName()
+ "} has to implement the Local interface");
}
try {
methodExecute.invoke(value, arguments);
} catch (IllegalAccessException iae) {
throw new JobExecutionException(iae);
} catch (InvocationTargetException ite) {
throw new JobExecutionException(ite);
}
}
@SuppressWarnings("unchecked")
private InitialContext getInitialContext(JobDataMap jobDataMap)
throws NamingException {
Hashtable params = new Hashtable(2);
String initialContextFactory = jobDataMap
.getString(INITIAL_CONTEXT_FACTORY);
if (initialContextFactory != null) {
params.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
}
String providerUrl = jobDataMap.getString(PROVIDER_URL);
if (providerUrl != null) {
params.put(Context.PROVIDER_URL, providerUrl);
}
return new InitialContext(params);
}
}
-----------------------------
---------------- CronJobListener ---------------
import java.util.Date;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.apache.log4j.Logger;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobListener;
import com.omxgroup.cds.entity.batch.CronJob;
import com.omxgroup.cds.entity.util.JndiNameCreator;
import com.omxgroup.cds.server.api.CronJobApi;
import com.omxgroup.cds.server.api.CronJobApiBean;
/**
* A CronJobListener that updates the lastexecutiondate of the cronjob
*
* @author ola.hamfors(a)diabol.se
*
*/
public class CronJobListener implements JobListener {
@SuppressWarnings("unused")
private final static String RCS_ID = "$Id: CronJobListener.java,v 1.6 2006/11/22 18:02:25 JAJH Exp $";
public static final String CDS_JOB_LISTENER_NAME = "CDS CronJob Listener";
public static final String CDS_CRON_JOB_ID = "cronjobid";
public String getName() {
return CDS_JOB_LISTENER_NAME;
}
private Logger logger = Logger.getLogger(getClass().getName());
public void jobToBeExecuted(JobExecutionContext ctx) {
// do nothing
}
public void jobExecutionVetoed(JobExecutionContext ctx) {
// do nothing
}
public void jobWasExecuted(JobExecutionContext ctx,
JobExecutionException exception) {
JobDetail jobDetail = ctx.getJobDetail();
JobDataMap map = jobDetail.getJobDataMap();
long cronJobId = map.getLong(CDS_CRON_JOB_ID);
InitialContext jndiCtx;
try {
jndiCtx = new InitialContext();
CronJobApi cronJobApi = (CronJobApi) jndiCtx
.lookup(JndiNameCreator.getLocalJndiName(CronJobApiBean.class));
CronJob job = cronJobApi.getCronJob(cronJobId);
if (job != null) {
job.setLastExecution(new Date());
cronJobApi.update(job);
}
} catch (NamingException e) {
logger.warn("Couldn't lookup CronJobApiBean", e);
}
}
}
-----------------------------
And this is how I use it.
public String startAllCronJobs() throws SchedulerException {
List list = cronJobApi.getAllCronJobs();
logger.info("Starting " + list.size() + " "
+ ((list.size() == 1) ? "cronjob" : "cronjobs"));
Scheduler sched = StdSchedulerFactory.getDefaultScheduler();
sched.addJobListener(new CronJobListener());
for (CronJob job : list) {
logger.info("Starting job " + job);
CronJobDetail jd = new CronJobDetail(job.toString(), job
.getDescription(), EJB3InvokerJob.class);
jd.addJobListener(CronJobListener.CDS_JOB_LISTENER_NAME);
Class beanClass = null;
try {
beanClass = Class.forName(job.getQualifiedBeanClassName());
} catch (ClassNotFoundException e) {
logger.error("Cron Job class "
+ job.getQualifiedBeanClassName() + "not found", e);
continue;
}
String jndiName = JndiNameCreator.getLocalJndiName(beanClass);
jd.getJobDataMap().put(EJB3InvokerJob.EJB_JNDI_NAME_KEY, jndiName);
jd.getJobDataMap().put(EJB3InvokerJob.EJB_METHOD_KEY,
job.getMethod());
jd.getJobDataMap().put(EJB3InvokerJob.EJB_INTERFACE_CLASS,
job.getQualifiedBeanClassName());
Object[] jdArgs = new Object[0];
jd.getJobDataMap().put(EJB3InvokerJob.EJB_ARGS_KEY, jdArgs);
jd.getJobDataMap()
.put(CronJobListener.CDS_CRON_JOB_ID, job.getId());
String jobName = job.toString();
String group = "CDS Quartz Group";
CronTrigger cronTrigger = new CronTrigger(jobName, group);
try {
cronTrigger.setCronExpression(job.getCronExpression());
// cronTrigger.addTriggerListener(CronJobTriggerListener.CRON_TIGGER_NAME);
} catch (ParseException e) {
logger.warn("Invalid syntax on cron expression", e);
continue;
}
sched.scheduleJob(jd, cronTrigger);
logger.info("Job " + job + " scheduled");
}
sched.start();
return "Started";
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988117#3988117
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988117
19Â years, 5Â months