3 Replies Latest reply on Jan 4, 2009 7:05 PM by Peter Johnson

    ClassNotFoundException

    Marcin Kwiatkowski Newbie

      Hi!

      I'm getting this exception while deploying application:
      00:21:33,142 INFO [AnnotationBinder] Binding entity from annotated class: User
      00:21:33,142 INFO [AnnotationBinder] Binding type definition: encryptedString
      00:21:33,146 WARN [ServiceController] Problem starting service persistence.units:ear=Orchid.ear,jar=OrchidEJB.jar,unitName=OrchidEJBPU
      java.lang.TypeNotPresentException: Type org.jasypt.hibernate.type.EncryptedStringType not present
       at sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(Unknown Source)
       at sun.reflect.annotation.AnnotationInvocationHandler.invoke(Unknown Source)
       at $Proxy67.typeClass(Unknown Source)
       at org.hibernate.cfg.AnnotationBinder.bindTypeDef(AnnotationBinder.java:894)
       at org.hibernate.cfg.AnnotationBinder.bindTypeDefs(AnnotationBinder.java:879)
       at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:407)
       at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:452)
       at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:268)
       at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
       at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
       at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:407)
       at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
       at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
       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.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:417)
       at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy132.start(Unknown Source)
       at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:120)
       at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:627)
       at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:351)
       at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:417)
       at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy33.start(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:512)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
       at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
       at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
       at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
       at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy34.start(Unknown Source)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
       at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy9.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.jasypt.hibernate.type.EncryptedStringType
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
       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 sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(Unknown Source)
       at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Unknown Source)
       at sun.reflect.generics.tree.ClassTypeSignature.accept(Unknown Source)
       at sun.reflect.annotation.AnnotationParser.parseSig(Unknown Source)
       at sun.reflect.annotation.AnnotationParser.parseClassValue(Unknown Source)
       at sun.reflect.annotation.AnnotationParser.parseMemberValue(Unknown Source)
       at sun.reflect.annotation.AnnotationParser.parseAnnotation(Unknown Source)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations2(Unknown Source)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations(Unknown Source)
       at java.lang.Class.initAnnotationsIfNecessary(Unknown Source)
       at java.lang.Class.getAnnotation(Unknown Source)
       at java.lang.Class.isAnnotationPresent(Unknown Source)
       at org.hibernate.reflection.java.JavaAnnotationReader.isAnnotationPresent(JavaAnnotationReader.java:25)
       at org.hibernate.reflection.java.JavaXAnnotatedElement.isAnnotationPresent(JavaXAnnotatedElement.java:43)
       at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:240)
       ... 106 more


      EntityBean looks like this:
      @Entity
      @TypeDef(
      name="encryptedString",
      typeClass=EncryptedStringType.class,
      parameters={
      @Parameter(name="encryptorRegisteredName", value="hibernateStringEncryptor")
      })
      public class User {

      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;

      @Type(type="encryptedType")
      private String password;

      public User() {
      }

      public Long getId() {
      return this.id;
      }

      public void setId(Long id) {
      this.id = id;
      }


      public String getPassword() {
      return password;
      }

      public void setPassword(String password) {
      this.password = password;
      }

      public int hashCode() {
      return (this.id == null) ? 0 : this.id.hashCode();
      }

      public boolean equals(Object object) {
      if (object instanceof User) {
      final User obj = (User) object;
      return (this.id != null) ? this.id.equals(obj.id)
      : (obj.id == null);
      }
      return false;
      }

      }

      I have really no idea what may cause this exception, any help would be appreciated


        • 1. Re: ClassNotFoundException
          Peter Johnson Master

          Looks like this class cannot be found:

          Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.jasypt.hibernate.type.EncryptedStringType


          Is it one of your classes (it is not part of Hibernate)?

          How is your application packaged? As a WAR or EAR? Is the missing class located within your app's archive, and if so, where? One of the possibilities is that the missing class is in a JAR file in the WEB-INF/lib directory of your WAR file, in which case Hibernate cannot see it because of scoping rules.

          Also, what version of JBoss AS and what JDK?


          • 2. Re: ClassNotFoundException
            Marcin Kwiatkowski Newbie

            org.jasypt.hibernate.type.EncryptedStringType is part of jasypyt-1.5.jar and is not located in EAR archive - I'm guessing thats's the problem since JBoss is requiring it while deploying.

            I'm using JBoss 4.2.3.

            • 3. Re: ClassNotFoundException
              Peter Johnson Master

              According to these lines from your source code:

              @TypeDef(
              name="encryptedString",
              typeClass=EncryptedStringType.class,


              it would appear that it is your code that requires that class. You need to package the JAR file with your EAR file.