Not able to start Jetty in embedded mode - jetty

I am trying to start Jetty in embedded mode to deploy a war file. I am using jetty lib versioned 9.4.6
I have following task created in Gradle for starting Jetty and deploying the web application.
println 'Starting Jetty............'
project.ext.server = new Server();
ServerConnector connector = new ServerConnector(project.ext.server);
connector.setPort(jettyPort);
project.ext.server.addConnector(connector);
WebAppContext webapp = new WebAppContext()
webapp.setContextPath('/')
def warPath = 'build/libs/';
warPath += 'test-' + project.version + '.war';
println("Deploying WAR File : --> ${warPath}");
webapp.setWar(warPath)
project.ext.server.setHandler(webapp);
project.ext.server.start();
println 'Server started, waiting...'
new StopMonitor(jettyStopPort, project.ext.server).start();
println 'Jetty started.'
but above script fails with following error
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jetty.server.session.SessionHandler
Exact line from the script which is failing is
WebAppContext webapp = new WebAppContext()
Even if I keep this line as the single line in the script and remove everything, I get the same error.
Interestingly, the class for which it is complaining is present in the jar file jetty-server. Same script used to work with jetty libs 8.1
Note: In order to make the script work with jetty 9.4, i had to use ServerConnector class instead of BlockingConnectot, which was removed in jetty 9.4, rest of the script is same.
I am not sure why this failing.

You are probably missing required jar files.
Would strongly encourage you to use a proper build tool, you have many to choose from.
Here's the jar dependency list (in tree form) for the example project at...
https://github.com/jetty-project/embedded-servlet-3.1
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # embedded-servlet-3.1 ---
[INFO] org.eclipse.jetty.demo:embedded-servlet-3.1:war:1-SNAPSHOT
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- org.eclipse.jetty:jetty-webapp:jar:9.4.6.v20170531:compile
[INFO] | +- org.eclipse.jetty:jetty-xml:jar:9.4.6.v20170531:compile
[INFO] | | \- org.eclipse.jetty:jetty-util:jar:9.4.6.v20170531:compile
[INFO] | \- org.eclipse.jetty:jetty-servlet:jar:9.4.6.v20170531:compile
[INFO] | \- org.eclipse.jetty:jetty-security:jar:9.4.6.v20170531:compile
[INFO] | \- org.eclipse.jetty:jetty-server:jar:9.4.6.v20170531:compile
[INFO] | +- org.eclipse.jetty:jetty-http:jar:9.4.6.v20170531:compile
[INFO] | \- org.eclipse.jetty:jetty-io:jar:9.4.6.v20170531:compile
[INFO] \- org.eclipse.jetty:jetty-annotations:jar:9.4.6.v20170531:compile
[INFO] +- org.eclipse.jetty:jetty-plus:jar:9.4.6.v20170531:compile
[INFO] | \- org.eclipse.jetty:jetty-jndi:jar:9.4.6.v20170531:compile
[INFO] +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] +- org.ow2.asm:asm:jar:5.1:compile
[INFO] \- org.ow2.asm:asm-commons:jar:5.1:compile
[INFO] \- org.ow2.asm:asm-tree:jar:5.1:compile

Related

WSO2IS and CVE-2021-44228

Is WSO2IS impacted by CVE-2021-44228 ?
If so, could we an update on https://docs.wso2.com/display/Security/2021+Advisories (on what versions are affected, and what the recommend remediation is)?
Ensure that you have "zip" and "unzip" commands installed on the server hosting the product.
Option 1: Navigate to the product-home folder and run the following command:
curl https://raw.githubusercontent.com/wso2/security-tools/master/internal/update-scripts/CVE-2021-44228-mitigation.sh | bash
Option 2: Or else download the script from https://raw.githubusercontent.com/wso2/security-tools/master/internal/update-scripts/CVE-2021-44228-mitigation.sh, copy the script into the product-home, and run the script from product-home, using the following command:
bash CVE-2021-44228-mitigation.sh
This is applicable to WSO2 Identity Server 5.9.0 and above versions only. There is a public announcement made by WSO2 on this.
https://docs.wso2.com/pages/viewpage.action?pageId=180948677
What about the plugins/extensions using some wso2 libraries further using log4j2 core?
For example: org.wso2.carbon:org.wso2.carbon.utils:jar:4.6.1 having pax logging as dependency which eventually has log4j 2.12.1 as provided dependency.
[INFO] +- org.wso2.carbon:org.wso2.carbon.utils:jar:4.6.1:compile
[INFO] | +- org.wso2.orbit.org.bouncycastle:bcprov-jdk15on:jar:1.60.0.wso2v1:compile
[INFO] | | \- org.bouncycastle:bcprov-jdk15on:jar:1.60:compile
[INFO] | +- org.wso2.carbon:org.wso2.carbon.user.api:jar:4.6.1:compile
[INFO] | | \- (org.wso2.carbon:org.wso2.carbon.base:jar:4.6.1:compile - omitted for duplicate)
[INFO] | +- org.wso2.carbon:org.wso2.carbon.bootstrap:jar:4.6.1:compile
[INFO] | | +- (org.ops4j.pax.logging:pax-logging-api:jar:1.11.3:compile - omitted for duplicate)
[INFO] | | \- wrapper:wrapper:jar:3.2.3:compile
[INFO] | +- org.ops4j.pax.logging:pax-logging-api:jar:1.11.3:compile
[INFO] | | +- org.osgi:osgi.core:jar:6.0.0:compile
[INFO] | | \- org.osgi:osgi.cmpn:jar:6.0.0:compile
[INFO] | +- **org.ops4j.pax.logging:pax-logging-log4j2:jar:1.11.3:compile**
[INFO] | | +- (org.ops4j.pax.logging:pax-logging-api:jar:1.11.3:compile - omitted for duplicate)
[INFO] | | +- (org.osgi:osgi.core:jar:6.0.0:compile - omitted for duplicate)
[INFO] | | \- (org.osgi:osgi.cmpn:jar:6.0.0:compile - omitted for duplicate)
This is irrespective of wso2 IS version.

Exception while reading RDS secrets from AWS secrets manager using aws-secretsmanager-jdbc

I am using AWS SDK for java on my project and now want to use the AWS secrets manager to store RDS details. while integrating aws-secretsmanager-jdbc, getting a below error while running a query against database:
java.lang.NoSuchFieldError: SERVICE_ID
at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.executeDescribeSecret(AWSSecretsManagerClient.java:885)
at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.describeSecret(AWSSecretsManagerClient.java:866)
at com.amazonaws.secretsmanager.caching.cache.SecretCacheItem.executeRefresh(SecretCacheItem.java:102)
at com.amazonaws.secretsmanager.caching.cache.SecretCacheItem.executeRefresh(SecretCacheItem.java:32)
at com.amazonaws.secretsmanager.caching.cache.SecretCacheObject.refresh(SecretCacheObject.java:188)
at com.amazonaws.secretsmanager.caching.cache.SecretCacheObject.getSecretValue(SecretCacheObject.java:286)
at com.amazonaws.secretsmanager.caching.SecretCache.getSecretString(SecretCache.java:123)
at com.amazonaws.secretsmanager.sql.AWSSecretsManagerDriver.connectWithSecret(AWSSecretsManagerDriver.java:321)
at com.amazonaws.secretsmanager.sql.AWSSecretsManagerDriver.connect(AWSSecretsManagerDriver.java:384)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
I did some research and found out that this might be the version conflict issue between sdk-core and secretsmanager. Here is the maven dependency tree:
[INFO] | +- software.amazon.awssdk:secretsmanager:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:aws-json-protocol:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:protocol-core:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:sdk-core:jar:2.10.30:compile
[INFO] | | | \- software.amazon.awssdk:profiles:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:auth:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:http-client-spi:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:regions:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:annotations:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:utils:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:aws-core:jar:2.10.30:compile
[INFO] | | +- software.amazon.awssdk:apache-client:jar:2.10.30:runtime
[INFO] | | \- software.amazon.awssdk:netty-nio-client:jar:2.10.30:runtime
[INFO] +- com.amazonaws.secretsmanager:aws-secretsmanager-jdbc:jar:1.0.3:compile
[INFO] | +- com.amazonaws.secretsmanager:aws-secretsmanager-caching-java:jar:1.0.0:compile
[INFO] | +- com.amazonaws:aws-java-sdk-secretsmanager:jar:1.11.418:compile
[INFO] | | +- com.amazonaws:aws-java-sdk-core:jar:1.11.281:compile
[INFO] | | \- com.amazonaws:jmespath-java:jar:1.11.281:compile
[INFO] +- software.amazon.awssdk:secretsmanager:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:aws-json-protocol:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:protocol-core:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:sdk-core:jar:2.10.30:compile
[INFO] | | \- software.amazon.awssdk:profiles:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:auth:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:http-client-spi:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:regions:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:annotations:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:utils:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:aws-core:jar:2.10.30:compile
[INFO] | +- software.amazon.awssdk:apache-client:jar:2.10.30:runtime
[INFO] | \- software.amazon.awssdk:netty-nio-client:jar:2.10.30:runtime
[INFO] \- com.amazonaws:aws-java-sdk-s3:jar:1.11.281:compile
[INFO] \- com.amazonaws:aws-java-sdk-kms:jar:1.11.281:compile
FYI, I am using bom file for AWS JAVA SDK and that has version 2.5.47 while aws-secretsmanager-jdbc have AWS JAVA SDK version 1.11.418
I am trying to use AWS wrapper to connect with database AWS Secrets Manager JDBC
Any idea on how to fix this issue?
Figured this out, its the issue happening because of the wrong version of the core library. I was trying to use AWS SDK 2.x and 1.x in the same project so I had this version conflict.
Fixed by adding versions to pom as below:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.418</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>jmespath-java</artifactId>
<version>1.11.418</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-secretsmanager</artifactId>
<version>1.11.418</version>
</dependency>

.NoSuchMethodError: io.opencensus.trace.Span.addMessageEvent occured when getting Blob from GCP storage

This is my stacktrace of the issue :-
SEVERE: Unhandled exception
java.lang.NoSuchMethodError: io.opencensus.trace.Span.addMessageEvent(Lio/opencensus/trace/MessageEvent;)V
at com.google.api.client.http.OpenCensusUtils.recordMessageEvent(OpenCensusUtils.java:222)
at com.google.api.client.http.OpenCensusUtils.recordSentMessageEvent(OpenCensusUtils.java:190)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:994)
at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:429)
at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:157)
at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:145)
at com.google.auth.http.HttpCredentialsAdapter.initialize(HttpCredentialsAdapter.java:91)
at com.google.cloud.http.HttpTransportOptions$1.initialize(HttpTransportOptions.java:159)
at com.google.cloud.http.CensusHttpModule$CensusHttpRequestInitializer.initialize(CensusHttpModule.java:109)
at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:88)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:300)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at com.google.cloud.storage.spi.v1.HttpStorageRpc.get(HttpStorageRpc.java:436)
at com.google.cloud.storage.StorageImpl$5.call(StorageImpl.java:244)
at com.google.cloud.storage.StorageImpl$5.call(StorageImpl.java:241)
at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:105)
at com.google.cloud.RetryHelper.run(RetryHelper.java:76)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
at com.google.cloud.storage.StorageImpl.get(StorageImpl.java:240)
at com.google.cloud.storage.StorageImpl.get(StorageImpl.java:258)
This is my dependency tree :-
+- com.google.apis:google-api-services-compute:jar:beta-rev91-1.23.0:compile
[INFO] | \- com.google.api-client:google-api-client:jar:1.23.0:compile
[INFO] | +- com.google.oauth-client:google-oauth-client:jar:1.23.0:compile
[INFO] | \- com.google.http-client:google-http-client-jackson2:jar:1.23.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.1.3:compile
[INFO] +- com.infiverve.flint.sdk:flint-sdk:jar:5.0.0.0:provided
[INFO] +- com.google.guava:guava:jar:28.1-jre:compile
[INFO] | +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] | +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] | +- org.checkerframework:checker-qual:jar:2.8.1:compile
[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.3.2:compile
[INFO] | +- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.18:compile
[INFO] \- com.google.cloud:google-cloud-storage:jar:1.102.0:compile
[INFO] +- com.google.cloud:google-cloud-core-http:jar:1.91.3:compile
[INFO] | +- com.google.cloud:google-cloud-core:jar:1.91.3:compile
[INFO] | | +- com.google.protobuf:protobuf-java-util:jar:3.10.0:compile
[INFO] | | +- com.google.api.grpc:proto-google-common-protos:jar:1.17.0:compile
[INFO] | | +- com.google.api.grpc:proto-google-iam-v1:jar:0.13.0:compile
[INFO] | | +- org.threeten:threetenbp:jar:1.3.3:compile
[INFO] | | \- com.google.protobuf:protobuf-java:jar:3.10.0:compile
[INFO] | +- com.google.auth:google-auth-library-credentials:jar:0.18.0:compile
[INFO] | +- com.google.auth:google-auth-library-oauth2-http:jar:0.18.0:compile
[INFO] | | \- com.google.auto.value:auto-value-annotations:jar:1.6.6:compile
[INFO] | +- com.google.http-client:google-http-client:jar:1.32.1:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.10:compile
[INFO] | | | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | | | \- commons-codec:commons-codec:jar:1.11:compile
[INFO] | | \- org.apache.httpcomponents:httpcore:jar:4.4.12:compile
[INFO] | +- com.google.http-client:google-http-client-appengine:jar:1.32.1:compile
[INFO] | +- com.google.api:gax:jar:1.49.1:compile
[INFO] | +- com.google.api:gax-httpjson:jar:0.66.1:compile
[INFO] | | \- com.google.code.gson:gson:jar:2.8.5:compile
[INFO] | +- io.opencensus:opencensus-api:jar:0.24.0:compile
[INFO] | | \- io.grpc:grpc-context:jar:1.22.1:compile
[INFO] | +- io.opencensus:opencensus-contrib-http-util:jar:0.24.0:compile
[INFO] | \- com.google.api:api-common:jar:1.8.1:compile
[INFO] | \- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] \- com.google.apis:google-api-services-storage:jar:v1-rev20190910-1.30.3:compile
And I'm getting this issue on this line of my code:-
Storage storage = StorageOptions.newBuilder()
.setCredentials(ServiceAccountCredentials.fromStream(credentialsInputStream))
.setProjectId(flintRequestProjectID)
.build().getService();
Blob blob = storage.get(BlobId.of(billingBucketName, billingFileName)); <- (!!THis line of code!!)
I've tried this fix(link provided below) that i found regarding this issue but it did not worked.
Link to the fix i found on github and tried

java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

when i am trying to request to Rest service at time of response it getting exception..
Feb 21, 2013 2:34:49 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at de.vogella.jpa.simple.main.Main.getObj(Main.java:18)
at com.poshs.webapp.MyResource.setIt(MyResource.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
this result i get after run mvn dependency:tree
[INFO] +- com.sun.jersey:jersey-server:jar:1.8:compile
[INFO] | +- asm:asm:jar:3.1:compile
[INFO] | \- com.sun.jersey:jersey-core:jar:1.8:compile
[INFO] +- com.sun.jersey:jersey-json:jar:1.8:compile
[INFO] | +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] | | \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | \- javax.activation:activation:jar:1.1:compile
[INFO] | +- org.codehaus.jackson:jackson-core-asl:jar:1.7.1:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.7.1:compile
[INFO] | +- org.codehaus.jackson:jackson-jaxrs:jar:1.7.1:compile
[INFO] | \- org.codehaus.jackson:jackson-xc:jar:1.7.1:compile
[INFO] +- junit:junit:jar:4.8.2:test
[INFO] +- com.sun.jersey:jersey-client:jar:1.8:test
[INFO] +- org.glassfish.distributions:web-all:jar:10.0-build-20080430:test
[INFO] +- org.glassfish.embedded:gf-embedded-api:jar:1.0-alpha-4:test
[INFO] | +- org.glassfish.api:dtds:jar:resources:9.0.2:test
[INFO] | \- org.glassfish.api:schemas:jar:resources:9.0.2:test
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.0-alpha4:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.0-beta1:compile
[INFO] | \- commons-codec:commons-codec:jar:1.3:compile
[INFO] +- com.google.code.gson:gson:jar:2.2.2:compile
[INFO] +- org.apache.openejb:commons-dbcp-all:jar:1.3-r699049:compile
[INFO] +- org.apache.directory.studio:org.apache.commons.pool:jar:1.6:compile
[INFO] | \- commons-pool:commons-pool:jar:1.6:compile
[INFO] +- org.nuiton.thirdparty:asm-attrs:jar:1.5.4-snapshot:compile
[INFO] +- org.sonatype.sisu.inject:cglib:jar:2.2.2:compile
[INFO] +- org.jvnet.hudson.dom4j:dom4j:jar:1.6.1-hudson-3:compile
[INFO] +- org.hibernate:ejb3-persistence:pom:3.3.2.Beta1:compile
[INFO] +- org.hibernate:hibernate:jar:3.2.6.ga:compile
[INFO] | +- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] | +- javax.transaction:jta:jar:1.0.1B:compile
[INFO] | +- asm:asm-attrs:jar:1.5.3:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | \- cglib:cglib:jar:2.1_3:compile
[INFO] +- org.hibernate:hibernate-annotations:jar:3.2.1.ga:compile
[INFO] | \- javax.persistence:persistence-api:jar:1.0:compile
[INFO] +- org.hibernate:hibernate-commons-annotations:jar:3.0.0.ga:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.2.1.ga:compile
[INFO] | +- jboss:javassist:jar:3.3.ga:compile
[INFO] | \- jboss:jboss-archive-browsing:jar:5.0.0alpha-200607201-119:compile
[INFO] +- org.hibernate:hibernate-validator-annotation-processor:jar:5.0.0.Beta1:compile
[INFO] +- commons-beanutils:commons-beanutils-bean-collections:jar:1.8.3:compile
[INFO] +- jboss:jboss-common:jar:4.2.2.GA:compile
[INFO] +- javassist:javassist:jar:3.12.1.GA:compile
[INFO] +- hibernate:hibernate-entitymanager:pom:3.4.0.GA:compile
[INFO] | +- org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile
[INFO] | \- org.hibernate:hibernate-core:jar:3.3.0.SP1:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.0.0.Beta1:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Beta3:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.1.GA:compile
[INFO] | +- com.fasterxml:classmate:jar:0.8.0:compile
[INFO] | +- de.odysseus.juel:juel-spi:jar:2.2.5:compile
[INFO] | +- de.odysseus.juel:juel-api:jar:2.2.5:compile
[INFO] | \- de.odysseus.juel:juel-impl:jar:2.2.5:compile
[INFO] +- commons-collections:commons-collections:jar:3.1:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.2:compile
[INFO] +- com.google.sitebricks:slf4j:jar:0.8.3:compile
[INFO] | \- com.google.inject:guice:jar:2.0:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.2:compile
[INFO] | \- log4j:log4j:jar:1.2.17:compile
[INFO] +- postgresql:postgresql:jar:9.1-901.jdbc4:compile
[INFO] +- com.tunnelvisionlabs:antlr4:jar:4.0:compile
[INFO] | +- com.tunnelvisionlabs:antlr4-runtime:jar:4.0:compile
[INFO] | | \- org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1:compile
[INFO] | +- org.antlr:antlr-runtime:jar:3.5:compile
[INFO] | | \- org.antlr:stringtemplate:jar:3.2.1:compile
[INFO] | \- org.antlr:ST4:jar:4.0.7:compile
[INFO] +- cglib:cglib-nodep:jar:2.2.2:compile
[INFO] +- org.ow2.asm:asm:jar:4.1:compile
[INFO] \- org.ow2.asm:asm-util:jar:4.1:compile
[INFO] \- org.ow2.asm:asm-tree:jar:4.1:compile
This is get after run the mvn dependency:tree ,
i have checked my dependency for cglib but i not sure for version compatible, kindly check let me know which are compatible for my project.
Thanks
You probably miss a jar, for cglib.
When does this happen (unitTest, deployed)?
How do you build your project (Maven, ant ) ? Which version of Hibernate ? Hard to help you without some info.
EDIT : try to run mvn dependency:tree and post the result here, we should see what's wrong
EDIT : you have 2 versions of cglib. You should not manually include cglib as it is already included by hibernate as a transitive dependency.
Just check how many cglib JARs you have in your project. Try to ensure that for your project + framework versions, you have the required cglib JAR and not some extra ones floating around.
You something missed on the class path. So that is why it showing "MappableContainerException" . This exception is related to the DB manager. So could you please stop your server,clean and redeploy it. Thanks.

Can I use the current release of Unitils (3.1) with JPA 2.0?

Using Hibernate EntityManager 3.5.3-Final together with Unitils 3.1 results in:
unitilsAfterTestTearDown(com.unifiedpost.payments.model.TestAccount) Time elapsed: 0.02 sec <<< FAILURE!
java.lang.AbstractMethodError: org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:621)
at org.unitils.orm.jpa.util.provider.hibernate.UnitilsHibernatePersistenceProvider.createContainerEntityManagerFactory(UnitilsHibernatePersistenceProvider.java:47)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:227)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:281)
at org.unitils.orm.jpa.util.JpaEntityManagerFactoryLoader.createEntityManagerFactoryBean(JpaEntityManagerFactoryLoader.java:77)
This is also reported in: http://jira.unitils.org/browse/UNI-201
The reason is that unitils-orm depends on a 2.5.x release of Spring, which is not JPA2 ready yet.
[INFO] +- org.unitils:unitils-testng:jar:3.1:test
[INFO] +- org.unitils:unitils-orm:jar:3.1:test
[INFO] | +- org.unitils:unitils-spring:jar:3.1:test
[INFO] | | +- org.springframework:spring-core:jar:2.5.2:test
[INFO] | | +- org.springframework:spring-beans:jar:2.5.2:test
[INFO] | | +- org.springframework:spring-test:jar:2.5.2:test
[INFO] | | \- org.springframework:spring-tx:jar:2.5.2:test
See also:
http://jira.springframework.org/browse/SPR-6408
http://jira.springframework.org/browse/SPR-6705
You have 2 workaround options:
(1) Patch Unitils:
Checkout Unitils (http://www.unitils.org/source-repository.html)
Fix the root pom: Make it depend on a 3.0.1.RELEASE (or higher)
Build a release locally
Use this as your new Unitils package
<properties>
<spring.version>3.0.3.RELEASE</spring.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
(2) Include a patched MutablePersistenceUnitInfo
Duplicate Spring MutablePersistenceUnitInfo in your project (and make sure it preceeds the legacy Spring version in the classpath)
Add the missing methods to it.
#Override
public String getPersistenceXMLSchemaVersion() {
return "1.0";
}
#Override
public SharedCacheMode getSharedCacheMode() {
return SharedCacheMode.NONE;
}
#Override
public ValidationMode getValidationMode() {
return ValidationMode.NONE;
}
[Answered myself for later reference]
Also not a direct answer to the original question, but the trunk version (4.0-SNAPSHOT) has a Spring 3.0 dependency. Under the hood the JPA support will be re-engineered to use Spring (1).