Tomcat errors when executing tutorial - java

I was executing the code from the tuorial from http://viralpatel.net/blogs/tutorial-create-struts-2-application-eclipse-example/ and I am getting the following errors
janv. 09, 2014 11:20:02 AM org.apache.struts2.dispatcher.Dispatcher error
Grave: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/K:/sop/java/code/.
metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/W
EB-INF/lib/struts2-core-2.3.16.jar!/struts-default.xml:64:179
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Configu
rationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatche
r.java:445)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperation
s.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(S
trutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilte
rConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilter
Config.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterCon
fig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:47
75)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:
5452)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:15
59)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:15
49)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.Mul
tiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est - bean - jar:file:/K:/sop/java/code/.metadata/.plugins/org.ecli
pse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/WEB-INF/lib/struts2-core-2.
3.16.jar!/struts-default.xml:64:179
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(X
mlConfigurationProvider.java:245)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlC
onfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(Def
aultConfiguration.java:234)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Configu
rationManager.java:67)
... 16 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUpl
oadBase$SizeLimitExceededException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getDeclaredConstructors(Unknown Source)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(X
mlConfigurationProvider.java:235)
... 19 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileU
ploadBase$SizeLimitExceededException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1547)
... 23 more
The jars that I use are:
commons-logging-1.1.3.jar
commons-lang3-3.1.jar
commons-logging-1.1.3.jar
freemaker-2.3.19.jar
javassist-3.11.0.GA.jar
ongl-3.0.6.jar
struts2-core-2.3.16.jar
xwork-core-2.3.16.jar
Can someone tell me what am I wrong? Is the Tomcat server? Is the code?
Another problem is that I was trying more tutorials on the internet and every time I get errors when applying struts2 to the web page. Can someone tell me What am I missing with Tomcat?
P.S. I am using Eclipse kepler, Could it be it th problem?

Javassist library is missing. You can download it from maven below is the link. This is mentioned in the exception itself :)
http://mvnrepository.com/artifact/javassist/javassist

Related

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger in XPages

In our XPages project now we have to use Quartz Scheduler. I've tried to import all necessary jars which includes the following:
c3p0-0.9.5.2
log4j-1.2.16.jar
quartz-2.3.0-SNAPSHOT.jar
quartz-jobs-2.3.0-SNAPSHOT.jar
slf4j-api-1.7.7.jar
slf4j-log4j12-1.7.7.jar
I've imported all the jars to our project but when loading a page (which doesn't even call quartz or anything) I get the following exception:
Error 500
HTTP Web Server: Command Not Handled Exception
In a log I see:
01.12.19 2:04: Exception Thrown
java.lang.RuntimeException: com.ibm.xsp.FacesExceptionEx: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException
at com.ibm.designer.runtime.domino.adapter.ComponentModule.initModule(ComponentModule.java:473)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.initModule(NSFComponentModule.java:498)
at com.ibm.domino.xsp.module.nsf.NSFService.createNSFModule(NSFService.java:752)
at com.ibm.domino.xsp.module.nsf.NSFService.loadModule(NSFService.java:735)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:588)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Caused by: com.ibm.xsp.FacesExceptionEx: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException
at com.ibm.xsp.config.CLBootStrap.initContext(CLBootStrap.java:89)
at com.ibm.xsp.config.BootStrap.init(BootStrap.java:82)
at com.ibm.xsp.config.ConfigureCoreListener.contextInitialized(ConfigureCoreListener.java:39)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.initModule(ComponentModule.java:465)
... 8 more
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:414)
at org.apache.commons.digester.Digester.<init>(Digester.java:346)
at com.sun.faces.config.ConfigureListener.digester(ConfigureListener.java:1005)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:383)
at com.ibm.xsp.config.CLBootStrap.initContext(CLBootStrap.java:81)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor1791.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
... 17 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:102)
... 21 more
I suspect that this problem is related to Axis 1.4 log4j-1.2.8.jar incompatible with XPages?
I've tried to follow the advice and added the following to java.policy (section grant codeBase):
permission java.lang.RuntimePermission "setContextClassLoader";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
But still with no luck.
What's the problem?
Thanks in advance
I've resolved the issue by adding all logging libraries:
log4j-1.2.16.jar
slf4j-api-1.7.7.jar
slf4j-log4j12-1.7.7.jar
to lib/ext

Running application with Java 9, module java.base does not "opens java.io"

I tried to run my application (front-end developed in Java Swing, server developed with EJB deployed on Wildfly 8) with Java 9.
When the client tries to establish an EJB connection got the following exception:
09:53:42,358 INFO [xnio] XNIO version 3.2.0.Final
09:53:42,465 INFO [nio] XNIO NIO Implementation Version 3.2.0.Final
09:53:42,507 DEBUG [nio] Started channel thread 'Remoting "config-based-naming-client-endpoint" I/O-1', selector sun.nio.ch.WindowsSelectorImpl#4b4a5caf
RmiServiceFactpry ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.<init>(RemotingConnectionEJBReceiver.java:148)
at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.<init>(RemotingConnectionEJBReceiver.java:106)
at org.jboss.ejb.client.EJBClientContext.registerConnection(EJBClientContext.java:465)
at org.jboss.naming.remote.client.ejb.RemoteNamingStoreEJBClientHandler.associate(RemoteNamingStoreEJBClientHandler.java:78)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.<init>(RemoteNamingStoreV1.java:71)
at org.jboss.naming.remote.protocol.v1.VersionOne.getRemoteNamingStore(VersionOne.java:50)
at org.jboss.naming.remote.protocol.Versions.getRemoteNamingStore(Versions.java:55)
at org.jboss.naming.remote.client.RemoteContextFactory.createVersionedStore(RemoteContextFactory.java:73)
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:202)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:130)
at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
at java.naming/javax.naming.InitialContext.lookup(Unknown Source)
at com.dataloy.client.core.RmiServiceFactory.createRemote(RmiServiceFactory.java:105)
at com.dataloy.client.core.RmiServiceFactory.getServiceImpl(RmiServiceFactory.java:96)
at com.dataloy.core.AbstractServiceFactory.getService(AbstractServiceFactory.java:58)
at com.dataloy.DataloyEngine.getService(DataloyEngine.java:198)
at com.dataloy.DataloyEngine.login(DataloyEngine.java:548)
at com.dataloy.client.login.LoginPanel.doLogin(LoginPanel.java:511)
at com.dataloy.client.login.LoginPanel.access$500(LoginPanel.java:56)
at com.dataloy.client.login.LoginPanel$5.run(LoginPanel.java:452)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make java.io.OptionalDataException(boolean) accessible: module java.base does not "opens java.io" to unnamed module #312002a1
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Constructor.setAccessible(Unknown Source)
at org.jboss.marshalling.Marshalling$OptionalDataExceptionCreateAction$1.run(Marshalling.java:385)
at org.jboss.marshalling.Marshalling$OptionalDataExceptionCreateAction$1.run(Marshalling.java:381)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.jboss.marshalling.Marshalling$OptionalDataExceptionCreateAction.<init>(Marshalling.java:381)
at org.jboss.marshalling.Marshalling$OptionalDataExceptionCreateAction.<init>(Marshalling.java:376)
at org.jboss.marshalling.Marshalling.<clinit>(Marshalling.java:374)
... 23 more
I see there is some problem with the new module management introduced in Java 9, but I cannot understand what should do.
Regards,
Andrea
As per this answer you need to add --add-opens java.base/java.io=ALL-UNNAMED to the java command that launches the application.
Adding the following JVM parameters:
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
the above exception it is not reached anymore, it fails before with this exception:
java.lang.ClassNotFoundException: com.dataloy.client.Main
at jdk.deploy#9-ea/com.sun.deploy.security.DeployURLClassLoader.findClass(Unknown Source)
at jdk.javaws#9-ea/com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at jdk.javaws#9-ea/com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at jdk.javaws#9-ea/com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at jdk.javaws#9-ea/com.sun.javaws.Launcher.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
I need to make visible more modules but I struggling to understand which one.
Andrea

Spring resource not found - 3.2

We have a project which is using Spring with 3.0 xsd running on tomcat 7. I tried to change the xsd to Spring 3.2 as we have been using spring jars for spring 3.2.4 and 'exclude-mapping' cannot be used with spring 3.0 xsd.
After this change, application stops working, though it does not throw any errors while starting/stopping the server or adding and removing the application.
After the change any request to the application fails with error 404.
Here are the Jars we are using:
beandoc-0.7.0.jar
commons-fileupload-1.2.2.jar
commons-io-1.3.2.jar
commons-logging-1.2-javadoc.jar
commons-logging-1.2.jar
jstl.jar
log4j-1.2.14.jar
ojdbc6.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
spring-beandoc-0.7.1.jar
spring-beans-3.2.4.RELEASE.jar
spring-context-3.2.4.RELEASE.jar
spring-context-support-3.2.4.RELEASE.jar
spring-core-3.2.4.RELEASE.jar
spring-dao-2.0.8.jar
spring-expression-3.2.4.RELEASE.jar
spring-jdbc-3.2.4.RELEASE.jar
spring-web-3.2.4.RELEASE.jar
spring-webmvc-3.2.4.RELEASE.jar
spring-webmvc-portlet-3.2.4.RELEASE.jar
standard.jar
When we try to clean the server, it results in the below exception:
SEVERE: Exception starting Context with name [/COETOOLSACCL]
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/COETOOLSACCL]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:4119)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:425)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1341)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1542)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1520)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/support/ServletRequestHandledEvent
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:139)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:416)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:890)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:387)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5503)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.support.ServletRequestHandledEvent
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1891)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1734)
... 22 more
This exception prevails regardless of the xsd versions and with 3.0 application runs normal despite we get this error while cleaning the server.
Please help.

class not found exception spring

i tried to compile and run my application code but i get a class not found exception i will print the stack trace i hope there is someone can help me .
236 [main] INFO org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#37eaab: startup date [Sat May 03 21:15:12 CEST 2014]; root of context hierarchy
472 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - L oading XML bean definitions from URL [file:/C:/Users/housseminfo/workspace/ERP_PCD/target/classes/META- INF/applicationContext.xml]
1017 [main] INFO org.springframework.context.annotation.ClassPathBeanDefinitionScanner - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
1242 [main] INFO org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
1272 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#59727ed4: defining beans [datasource,persistenceUnitManager,entityManagerFactory,entityManager,transactionManager,o g.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annot ation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.Tr ansactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,op manager,metier,org.springframework.context.annotation.internalConfigurationAnnotationProces sor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springf ramework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context .annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.intern alPersistenceAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassP ostProcessor.importAwareProcessor]; root of factory hierarchy
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/io/support/SpringFactoriesLoader
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(A bstractAutowireCapableBeanFactory.java:532)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(Abs tractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFacto ry.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(Default SingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.j ava:198)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(A bstractApplicationContext.java:741) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationC ontext.java:464)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init> (ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init> (ClassPathXmlApplicationContext.java:83)
at com.ensi.dao.Maintest.main(Maintest.java:13)
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/support/SpringFactoriesLoader
at org.springframework.beans.CachedIntrospectionResults.<clinit> (CachedIntrospectionResults.java:65)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.jav a:321)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:328)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterProperty DescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1279)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterProperty at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(A bstractAutowireCapableBeanFactory.java:1117)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(A bstractAutowireCapableBeanFactory.java:522)
.. 10 more
Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.support.SpringFactoriesLoader
at java.net.URLClassLoader$1.run(Unknown Source)
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)
... 17 more
Hi its very clear from your exception that , you dont have all spring jars in your classpath.
if you are using maven add all dependencies in pom.xml.
otherwise download the jars from spring source and add them into project classpath.
once you add and run , it will work properly.
i don't see any aplication related errors over there. its only jar problem.
either missing jars or version mismatch. check it properly.

Jenkins Plugin having trouble using Class?

I'm trying to integrate scribe-java and write a Jenkins Plugin for it, but it seems Jenkins can't be used with Class? Does anyone know why is this?
Jenkins Plugin code:
OAuthService service =
new ServiceBuilder().provider( com.lookout.jenkins.publishoverbox.BoxApi20.class ).apiKey( clientId ).apiSecret(clientSecret ).callback(callbackUrl).grantType( OAuthConstants.AUTHORIZATION_CODE ).build();
Log:
SEVERE: Failed to create Guice container from all the plugins
com.google.common.collect.ComputationException: java.lang.NoClassDefFoundError: Lorg/scribe/oauth/OAuthService;
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:397)
at com.google.inject.internal.FailableCache.get(FailableCache.java:49)
at com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:66)
at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:73)
at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:36)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:38)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:355)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:393)
at com.google.inject.internal.FailableCache.get(FailableCache.java:49)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:127)
at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:506)
at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:171)
at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:44)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:123)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
at com.google.inject.Guice.createInjector(Guice.java:94)
at com.google.inject.Guice.createInjector(Guice.java:71)
at hudson.ExtensionFinder$GuiceFinder.<init>(ExtensionFinder.java:282)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:310)
at net.java.sezpoz.IndexItem.instance(IndexItem.java:181)
at hudson.ExtensionFinder$Sezpoz._find(ExtensionFinder.java:625)
at hudson.ExtensionFinder$Sezpoz.find(ExtensionFinder.java:600)
at hudson.ExtensionFinder._find(ExtensionFinder.java:151)
at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:318)
at hudson.ExtensionList.load(ExtensionList.java:295)
at hudson.ExtensionList.ensureLoaded(ExtensionList.java:248)
at hudson.ExtensionList.iterator(ExtensionList.java:138)
at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:311)
at hudson.ExtensionList.load(ExtensionList.java:295)
at hudson.ExtensionList.ensureLoaded(ExtensionList.java:248)
at hudson.ExtensionList.get(ExtensionList.java:153)
at hudson.PluginManager$PluginUpdateMonitor.getInstance(PluginManager.java:1066)
at hudson.maven.PluginImpl.init(PluginImpl.java:54)
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)
at hudson.init.InitializerFinder.invoke(InitializerFinder.java:120)
at hudson.init.InitializerFinder$TaskImpl.run(InitializerFinder.java:184)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
at jenkins.model.Jenkins$7.runTask(Jenkins.java:888)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoClassDefFoundError: Lorg/scribe/oauth/OAuthService;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2300)
at java.lang.Class.getDeclaredFields(Class.java:1745)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:651)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:358)
at com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:91)
at com.google.inject.internal.MembersInjectorStore.access$000(MembersInjectorStore.java:35)
at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:43)
at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:40)
at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:38)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:355)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:393)
... 56 more
Caused by: java.lang.ClassNotFoundException: org.scribe.oauth.OAuthService
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 71 more
Jun 3, 2013 11:37:17 AM jenkins.InitReactorRunner$1 onAttained
What ever you need in your plugin, you specify the same in dependencies.
Reason 1:
Jenkins loads each plugin into a separate class loader to avoid conflicts. Plugins can then participate to the system activities just like other Jenkins built-in classes do. They can participate in XStream-based persistence, they can provide "views" by Jelly, they can provide static resources like images, and from users, everything works seamlessly --- there's no distinction between functionalities that are built-in vs those from plugins.
Reason 2: You don't want to change your code when jenkins change their dependencies.

Categories

Resources