2 Replies Latest reply on Jan 26, 2009 12:27 PM by Michael Menzel

    UserType for EntityBeany can't be used due to failure during

    Michael Menzel Newbie

      Hey everybody,

      I'm currently developing an app with entity beans based on the openGIS plugin for postgreSQL. JDBC drivers for postgis und postgresql are already in lib folder of the used server configuration (default) and the datasource.xml is also created. Datasource is running fine.

      Now, let me explain the problem.
      For being able to store openGIS geometry objects in the postgreSQL database a GeometryType Class needs to be used.
      A openGIS Geometry field in an entity bean looks then like:

      @Type(type="org.postgis.hibernate.GeometryType")
      private org.postgis.Geometry point;

      This already worked on a 4.2.2 JBoss but needed a newer hibernate version to be installed.
      With JBoss 5.0.0 it ends in an ClassLoader error after deployment (java.lang.NoClassDefFoundError: UserType). Seems classloader doesn't find the <server_home>/common/lib jars or doesn't check'em at all. The hibernate-core.jar in the common/lib folder includes the class demanded during deployment (org.hibernate.usertype.UserType).

      So how does it come jbos throws an error during deployment? why isn't the UserType class found then?

      thx + regards
      Michael

        • 1. Re: UserType for EntityBeany can't be used due to failure du
          Michael Menzel Newbie

          I forgot to add the Java stacktrace:

          11:51:15,772 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=geoservice_app.ear/geoservice_ejb.jar#postGIS state=Create
          java.lang.NoClassDefFoundError: UserType
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClass(Unknown Source)
          at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:62)
          at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:509)
          at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:469)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:467)
          at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:444)
          at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
          at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
          at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)
          at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:254)
          at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:148)
          at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:256)
          at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1099)
          at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:735)
          at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:378)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClassInternal(Unknown Source)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Unknown Source)
          at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:123)
          at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.java:246)
          at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:283)
          at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:276)
          at org.hibernate.mapping.Property.isValid(Property.java:207)
          at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:458)
          at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
          at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
          at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
          at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:311)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
          at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
          at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
          at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
          at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
          at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
          at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
          at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
          at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
          at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
          at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
          at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
          at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
          at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
          at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
          at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
          at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
          at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
          at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
          at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
          at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
          at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
          at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
          at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
          at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
          at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
          at org.jboss.Main.boot(Main.java:209)
          at org.jboss.Main$1.run(Main.java:547)
          at java.lang.Thread.run(Unknown Source)
          Caused by: java.lang.ClassNotFoundException: UserType
          at java.net.URLClassLoader$1.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClassInternal(Unknown Source)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Unknown Source)
          at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:276)
          at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1099)
          at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:735)
          at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:378)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClassInternal(Unknown Source)
          ... 83 more

          • 2. Re: UserType for EntityBeany can't be used due to failure du
            Michael Menzel Newbie

            Problem solved!
            Instead of having the ColumgType that is extending hibernate's userType class in a referenced jar I now added the columnType class to the source of the EJB project and seems now the class loading sequence has the correct order making it work.