users@glassfish.java.net

When using _at_PersistenceContext deploying returns a string index out of rang

From: <glassfish_at_javadesktop.org>
Date: Wed, 12 Sep 2007 00:38:31 PDT

This is my session bean:

[code]
package byelex.advisor.webbased_designer.kb_beans;

import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author kaas
 */
@Stateless
@WebService
public class NewSessionBean implements NewSessionRemote {
    @PersistenceContext
    private EntityManager em;
    
    /** Creates a new instance of NewSessionBean */
    public NewSessionBean() {
    }

    public String helloWorld() {
        return "Hello World";
    }
}
[/code]

when I deploy it i get the error at the bottom of this post. When i comment the lines:
    @PersistenceContext
    private EntityManager em;

It all works properly (I reduced my class to this for testing in the real class I will use jpa).

This is a newly installed Glassfish v2 rc 8 (build 58). so perhaps i need to do an additional setting to get jpa running?

I'm using netbeans 5.5.1 to deploy my project

[code]
Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: Deployment Error -- String index out of range: -1
        at java.lang.String.substring(String.java:1768)
        at oracle.toplink.essentials.internal.helper.Helper.truncate(Helper.java:1891)
        at oracle.toplink.essentials.tools.schemaframework.TableDefinition.buildForeignKeyConstraintName(TableDefinition.java:460)
        at oracle.toplink.essentials.tools.schemaframework.TableDefinition.buildForeignKeyConstraint(TableDefinition.java:429)
        at oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.addForeignKeyConstraint(DefaultTableGenerator.java:735)
        at oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.addJoinColumnsFkConstraint(DefaultTableGenerator.java:646)
        at oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.addForeignMappingFkConstraint(DefaultTableGenerator.java:437)
        at oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.addForeignKeyFieldToSourceTargetTable(DefaultTableGenerator.java:416)
        at oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.postInitTableSchema(DefaultTableGenerator.java:309)
        at oracle.toplink.essentials.tools.schemaframework.DefaultTableGenerator.generateDefaultTableCreator(DefaultTableGenerator.java:162)
        at oracle.toplink.essentials.tools.schemaframework.SchemaManager.getDefaultTableCreator(SchemaManager.java:802)
        at oracle.toplink.essentials.tools.schemaframework.SchemaManager.replaceDefaultTables(SchemaManager.java:853)
        at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createOrReplaceDefaultTables(EntityManagerFactoryProvider.java:426)
        at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.writeDDLsToFiles(EntityManagerFactoryProvider.java:449)
        at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.generateDDLFiles(EntityManagerFactoryProvider.java:335)
        at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:230)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
        at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.loadPersistenceUnitBundle(PersistenceProcessor.java:513)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.createTablesInDB(PersistenceProcessor.java:353)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processAppBundle(PersistenceProcessor.java:219)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:146)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:211)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:172)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:122)
        at com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:79)
        at com.sun.enterprise.deployment.backend.ModuleDeployer.handlePostDeployEvent(ModuleDeployer.java:636)
        at com.sun.enterprise.deployment.backend.ModuleDeployer.postDeploy(ModuleDeployer.java:625)
        at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:188)
        at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:191)
        at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:919)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:279)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:788)
        at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
        at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:223)
[/code]
[Message sent by forum member 'johnnyvdlaar' (johnnyvdlaar)]

http://forums.java.net/jive/thread.jspa?messageID=234993