The error is somewhere else, possibly in TopLink Essentials which is
trying to create the schema for you. It shows up only when you actually
reference the persistence unit. That is because GlassFish does not
create the schema for a persistence unit unless user actually references
a persistence unit. One way to reference a persistence unit is by
injecting an EntityManager for that persistence unit, which is what you
do in your code.
To trace the actual bug, you have to supply a test case with entity
class definitions.
Thanks,
Sahoo
glassfish_at_javadesktop.org wrote:
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>