Okay, I got it working by changing the code like this:
@PersistenceUnit(unitName = "org.jbpm.persistence.jpa")
private EntityManagerFactory emf;
public void runIt()
{
try
{
if (kbase == null)
{
// load up the knowledge base
kbase = readKnowledgeBase();
}
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
// create a new knowledge session that uses JPA to store the runtime
// state
StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
int sessionId = ksession.getId();
JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);
If anyone wants more details, I would be happy to provide them.