Struts 2.5 ClassNotFoundException Issue - java

I have a Struts problem. I'm upgrading an application from Struts 1.2.x to 2.5.8. I have a single war and multiple EJBs in a single EAR file deploying to WebSphere 8.5. Every time I try to access a simple hello world jsp via a Struts action, I get this stack trace in my browser:
Error Message: javax.servlet.ServletException: Filter [struts2]: could not be initialized
Error Code: 500
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack:
Unable to load configuration. - bean - wsjar:file:/WEB-INF/lib/struts2-core-2.5.8.jar!/struts-default.xml:92:181
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:499)
at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:75)
at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:63)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:607)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:514)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:319)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:392)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:931)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3928)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
Caused by: Unable to load configuration. - bean - wsjar:file/WEB-INF/lib/struts2-core-2.5.8.jar!/struts-default.xml:92:181
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:906)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:486)
... 28 more
Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - wsjar:file:/WEB-INF/lib/struts2-core-2.5.8.jar!/struts-default.xml:92:181
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:271)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:98)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 31 more
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.fileupload.FileUploadException
at java.lang.J9VMInternals.prepareClassImpl(Native Method)
at java.lang.J9VMInternals.prepare(J9VMInternals.java:283)
at java.lang.Class.getDeclaredConstructors(Class.java:721)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:263)
... 34 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at java.net.URLClassLoader.findClass(URLClassLoader.java:600)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:243)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:786)
at java.lang.ClassLoader.loadClass(ClassLoader.java:764)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:741)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:585)
at java.lang.ClassLoader.loadClass(ClassLoader.java:741)
... 38 more
I've verified that the required commons-fileupload jar is in the war and it's not in a shared library location that would cause namespace conflicts. Classloader setting is set to parent first, and due to the complexity of the project, I can't safely change it.
What do I need to do to get past this?
TIA
Alex

Looks like I spoke too soon. For some reason, my first search failed to turn up an older version of commons-fileupload in the AppServer/plugins folder. It appears this jar is being used by the app server, and with the parent first classloading in use, there's a class collision taking place. So now I have to figure out how to get around that, but the original problem has been solved.

As long as the classes in your commons-fileupload jar have no dependencies on your application or WAR classes, you can deploy this jar as an isolated shared library and associate it to your application or WAR, whichever has the dependency on the jar. The classloading semantics for isolated shared libraries are described in topic "Isolating open source packages" in the WebSphere Application Server Knowledge Center for versions 8.5.5 and 9.0.
Isolating open source packages:
https://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/welc6tech_opensource_isolate.html
If you are using a recent version of 8.5.5, you might also try always-protected packages, which is also described in "Isolating open source packages". Note that always-protected packages can impact every application running on the application server.

Related

grails 1.1.1 will support java 1.7

Currently my application is running on grails 1.1.1 with java 1.6 on web sphere server. My application is working in old server with java 1.6.Recently server team upgrade the websphere server 8.5.5 and they asked us to deploy an ear with java 1.7. I have deployed the ear with java 1.7. now I am getting below error:
Error Page Exception
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.
Original Exception:
Error Message: javax.servlet.ServletException: Filter [charEncodingFilter]: could not be initialized
Error Code: 500
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at java.security.AccessController.doPrivileged(AccessController.java:426)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1704)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:411)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1379)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2189)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:435)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:378)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:126)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:653)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5477)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5603)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:667)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:611)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1269)
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1261)
at java.security.AccessController.doPrivileged(AccessController.java:426)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:92)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1255)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1093)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:832)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:814)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$QueuedWork.run(SSLReadServiceContext.java:1981)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
... 43 more
Caused by: java.lang.reflect.InvocationTargetException
... 43 more
Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [customer.CustomerController]!
... 43 more
Caused by: java.lang.TypeNotPresentException: Type CustomerSegment not present
at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:399)
at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:126)
at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:84)
at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:68)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1164)
at java.beans.Introspector.getBeanInfo(Introspector.java:428)
at java.beans.Introspector.getBeanInfo(Introspector.java:175)
at java.security.AccessController.doPrivileged(AccessController.java:456)
at customer.CustomerController.$getStaticMetaClass(CustomerController.groovy)
at base.BdwBaseController.<init>(BdwBaseController.groovy)
at customer.CustomerController.<init>(CustomerController.groovy)
... 43 more
Caused by: java.lang.ClassNotFoundException: CustomerSegment
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:302)
... 54 more
I have a few questions:
Grails 1.1.1 will support java 1.7?
if not do I need to upgrade grails?
What are all the steps to upgrade grails?
web sphere 8.5.5 will not support java 1.6?
to resolve this error what I need to check?
Do I need to update jars?
please find below jars which I am using in my application:
jar files
Going to try to answer as much as I can, but it's a best-effort since you're asking way too many questions in one post!
1 - Probably not. Grails 1.1.1 came out in 2009, and Java 1.7 came out in 2011, and was a major change over 1.6. You might be able to force them to work together, but you're going to struggle to find good information six (plus) years later.
2 - Yes.
3 - You can start here: http://docs.grails.org/1.2.0/ and go from there.
4 - See comment below. (Originally I said, but was wrong: IBM recommends Java 8 with WebSphere 8.)
5 - Probably not important, if you're upgrading everything anyway.
6 - Yes.

ClassNotFoundException: SanitizerLogWrapper while starting WebSphere Application server with Liferay

I've deployed Liferay 6.1 on WAS 8.5.5. While trying to start the server via Eclipse Juno, I'm getting a ClassNotFoundException which points to com.liferay.portal.kernel.log.SanitizerLogWrapper. Does someone know what the cause might be?
Here are the logs:
[8/6/15 9:09:39:152 EDT] 0000005a webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
java.lang.NoClassDefFoundError: com.liferay.portal.kernel.log.SanitizerLogWrapper
at com.liferay.portal.util.InitUtil.init(InitUtil.java:115)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:169)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1678)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1175)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:774)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2182)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: java.lang.ClassNotFoundException: com.liferay.portal.kernel.log.SanitizerLogWrapper
at java.net.URLClassLoader.findClass(URLClassLoader.java:599)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:743)
at java.lang.ClassLoader.loadClass(ClassLoader.java:720)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
... 23 more
It seems you are missing portal-kernel.jar or portal-service.jar
More here
Liferay requires some classes on the global classpath. You can download them as so called "dependencies". Among them is portal-service.jar
If you deployed Liferay according to the Administration Guide for Websphere 8.5, everything should run (I'm linking the 6.2 version of the docs, but I expect no big changes. If you're on CE, you should update anyways, because 6.1 CE is discontinued for quite a while now)

Gerrit JDBC Driver not found

I have installed gerrit on a Linux Mint machine, and I'm trying to use a mysql database connection for HTTP authentication.
But when I try to start gerrit, I get the following error:
ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
com.google.gerrit.common.Die: Cannot connect to SQL database
at com.google.gerrit.pgm.util.AbstractProgram.die(AbstractProgram.java:88)
at com.google.gerrit.pgm.util.SiteProgram.createDbInjector(SiteProgram.java:158)
at com.google.gerrit.pgm.Daemon.start(Daemon.java:275)
at com.google.gerrit.pgm.Daemon.run(Daemon.java:204)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
at Main.main(Main.java:25)
Caused by: java.sql.SQLException: Driver class com.mysql.jdbc.Driver not available
at com.google.gwtorm.jdbc.SimpleDataSource.loadDriver(SimpleDataSource.java:171)
at com.google.gwtorm.jdbc.SimpleDataSource.<init>(SimpleDataSource.java:85)
at com.google.gerrit.server.schema.DataSourceProvider.open(DataSourceProvider.java:144)
at com.google.gerrit.server.schema.DataSourceProvider.get(DataSourceProvider.java:65)
at com.google.gerrit.pgm.util.SiteLibraryBasedDataSourceProvider.get(SiteLibraryBasedDataSourceProvider.java:52)
at com.google.gerrit.pgm.util.SiteLibraryBasedDataSourceProvider.get(SiteLibraryBasedDataSourceProvider.java:32)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:73)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:63)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1059)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
at com.google.inject.Guice.createInjector(Guice.java:96)
at com.google.gerrit.pgm.util.SiteProgram.createDbInjector(SiteProgram.java:152)
... 11 more
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.google.gwtorm.jdbc.SimpleDataSource.loadDriver(SimpleDataSource.java:168)
... 33 more
I am copied mysql-connector-java-5.1.28.jar in /usr/share/java but still, this error persists.
Can somebody point me to a direction?
Better to leave /usr/share/java untouched. Anything you put there will be lost when you upgrade the next time. Instead, define your own common location for your drivers. If it is just for you, a subdirectory of your home location might be good: mkdir ~/jdbc.
Then copy your .jar for your jdbc driver in that location.
Then depending on how you run your java code, you will have to figure out how to include your jar's into your classpath.
standalone java program started with command-line java, then use the -cp parameter option.
Application Servers like Tomcat, or Weblogic, refer their documentation. Note that many suggest a drop location within the app server install, but for the same reasons as for the /usr/share/java, I would advise not to do so. Actually tomcat allows you to separate out CATALINA_HOME from CATALINA_BASE to solve that issue.
Either way, it appears that the exception was generated from a simple main, not a web app, so I assume you can go for the first option.

Solr on Websphere 8.5.5 : Linkage Error with org.slf4j.LoggerFactory

I am installing solr ( 4.10.2 ) on WAS 8.5.5 with IBM jdk 7. <br>
I deployed the `solr` as a `war` and added `solr.data.dir` and `solr.solr.home` to the application custom properties.
<br>
Upon accessing the url: http://localhost:9080/solr, <br>
I see the 'Linkage Error' in the logs.
4/03/15 06:50:58:277 GMT] 000000ae webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor]: java.lang.NoClassDefFoundError: org.apache.solr.servlet.SolrDispatchFilter (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:176)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1600)
..........................<br>
...........................<br>
used by: **java.lang.LinkageError: org.slf4j.LoggerFactory**
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:295)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
I modified the lib of the downloaded solr.war. On the top of the jars already present in the solr.war/WEB-INF/lib, I added an additional set of jars from the downloaded solr package
All the jars from \solr-4.10.2\solr-4.10.2\dist
All the jars from \solr-4.10.2\solr-4.10.2\dist\solrj-lib
All the jars from \solr-4.10.2\solr-4.10.2\example\lib\ext
Modified the application Class Loading to 'PARENT_LAST'.
Have been scratching my head for over 16 hours.
Even tried removing the all the slf4j*.jars from the solr.war\WEB-INF\lib but the same error persists.
Some help is highly solicited.
Finally was able to make SOLR up and running on Websphere 8.5.5
I have enumerated the different steps on my blog.
Solr 4.10.2 Deployment on WebSphere855

ClassNotFound Exception GlassFish Netbeans Library project

I have an entreprise application with an EJB and WAR project that have to use a library project (Model).
I've imported the library project in the library folder of both projects.
It seems to work until now, I do not know why but when I start the project I get a ClassNotFound Exception in Server Logs.
I'm using GlassFish Server and JSF Framework (Java Server Faces).
So this is the error I got in the server log :
Caused by: java.lang.TypeNotPresentException: Type model.GameModel not present
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.MethodRepository.getReturnType(MethodRepository.java:68)
at java.lang.reflect.Method.getGenericReturnType(Method.java:241)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedMethod.<init>(BackedAnnotatedMethod.java:38)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedMethod.of(BackedAnnotatedMethod.java:32)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.computeValue(BackedAnnotatedType.java:193)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.computeValue(BackedAnnotatedType.java:186)
at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:154)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.<init>(BackedAnnotatedType.java:186)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.<init>(BackedAnnotatedType.java:186)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:66)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:47)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:83)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:80)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3589)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2374)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2337)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2252)
at com.google.common.cache.LocalCache.get(LocalCache.java:3990)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3994)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4878)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:175)
... 49 more
Caused by: java.lang.ClassNotFoundException: model.GameModel
at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:833)
at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:742)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
... 78 more
I already have tried to remove/re-import the library
To check all the imports.
To clean & build, run, deploy, restart the server, remove the server
and add it again, etc.
To start NetBeans as administrator.
But I've no idea what's going wrong here, if someone could give me clue I'll appreciate.
Edit : I tried to add a package "model" inside both projects instead of calling my library, it's working but that's not how I want to implement my model.
(Sorry for my english, I'm not a native speaker)

Categories

Resources