'No suitable driver' exception implementing Olap4J XMLA Server - olap

I'm trying to implement olap4j-xmlaserver to access Mondrian via HTTP/XMLA. I compiled the project, created a war file (including a web.xml file) and deployed it in Tomcat 7. Problem is that I'm getting an exception when the pivot client application sends an XMLA request:
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/foodmart?user=root&password=xxx;Catalog=/WEB-INF/FoodMart.xml'
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at mondrian.xmla.impl.Olap4jXmlaServlet$Olap4jPoolingConnectionFactory.getConnection(Olap4jXmlaServlet.java:300)
at mondrian.xmla.XmlaHandler.getConnection(XmlaHandler.java:2917)
... 33 more
Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver (DriverManager.java:315)
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
... 37 more
The web.xml I put together (I couldn't find a sample in the olap4j-xmlaserver project). I'm sure this web.xml file needs to be fixed to solve the problem, especially the connection string:
<web-app ....
<display-name>olap4j-xmlaserver</display-name>
<description>
Olap4J XML/A server
</description>
<servlet>
<servlet-name>xmla</servlet-name>
<servlet-class>mondrian.xmla.impl.Olap4jXmlaServlet</servlet-class>
<init-param>
<param-name>OlapDriverClassName</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</init-param>
<init-param>
<param-name>OlapDriverConnectionString</param-name>
<param-value>
jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/foodmart?user=root&password=xxx;Catalog=/WEB-INF/FoodMart.xml
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>xmla</servlet-name>
<url-pattern>/xmla</url-pattern>
</servlet-mapping>
</web-app>
Any ideas how to fix the web.xml configuration or pointers to relevant documentation will be greatly appreciated.

You are missing the Java driver for MySQL in your classpath. Add it to your webapp in the folder named 'WEB-INF/lib'.

Related

Deploying an ear with web.xml on websphere changes the web.xml or create web_merged.xml with changed attributes for multi-part

I have an ear file built which has a war file inside.The war has web.xml which has servlet defined:
<servlet>
<servlet-name>ExcelDownload</servlet-name>
<servlet-class>web.ExcelDownload</servlet-class>
<multipart-config>
**<!--<max-file-size>1048576</max-file-size> -->**
</multipart-config>
</servlet>
The problem here is my in ear file max-file-size is commented that means there are no attributes defined for the multipart-config. But when I deploy my ear on WebSphere 8.5.5.9, it changes my web.xml to:
<servlet>
<servlet-name>ExcelDownload</servlet-name>
<servlet-class>com.ofss.infra.web.ExcelDownload</servlet-class>
<multipart-config>
<max-file-size>0</max-file-size>
**<max-request-size>0</max-request-size>**
<file-size-threshold>0</file-size-threshold>
</multipart-config>
</servlet>
Since the max-file-size attribute is defined as zero in web.xml I am not not able to use HTTP request to upload the file to server.
I need help on to understand why the attribute is being added by WAS though its not available in ear. I did my digging I tried during deployment not to use metadata-complete attribute to false then instead of changing web.xml WAS has created a new file web_merged.xml (this has max-file-size set to zero) and am still facing the issue.

Weblogic upgrade to 12c: deployment fails because url mapped to multiple servlet

I've recently setup a new Weblogic 12c environment. On deploying an application that I know works in Weblogic 11g I get the error "The url-pattern /resources/* in web application is mapped to multiple Servlets."
The mapping it's referring to is in the web.xml inside the application.ear that's being deployed, but it's only mapped once:
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
The project doesn't contain any other references to the url pattern /resources/*, can someone explain where the duplicated mapping is coming from and how I can work around it?
The closest issue I could find is this: https://bugster.forgerock.org/jira/si/jira.issueviews:issue-html/OPENAM-7947/OPENAM-7947.html, which has been marked as unreproducible.
Full stack trace from deployment:
<Error> <Deployer> <BEA-149205> <Failed to initialize the application "<application_name>" due to error weblogic.application.ModuleException: weblogic.management.DeploymentException: [HTTP:101401]The url-pa
ttern /resources/* in web application <application_name> is mapped to multiple Servlets.
weblogic.application.ModuleException: weblogic.management.DeploymentException: [HTTP:101401]The url-pattern /resources/* in web application <application_name> is mapped to multiple Servlets.
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
at weblogic.application.utils.StateMachineDriver.nextStateInParallel(StateMachineDriver.java:144)
at weblogic.application.internal.flow.ModuleStateDriver.parallelPrepare(ModuleStateDriver.java:46)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:75)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:55)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:731)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:243)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:66)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65)
at weblogic.deploy.internal.targetserver.AppDeployment.prepare(AppDeployment.java:158)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:41)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:193)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:31)
at weblogic.management.deploy.internal.ConfiguredDeployments$2.doItem(ConfiguredDeployments.java:684)
at weblogic.management.deploy.internal.parallel.BucketInvoker.invoke(BucketInvoker.java:138)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionAppsParallel(ConfiguredDeployments.java:692)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:322)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:202)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:207)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:129)
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:76)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1262)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:332)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:374)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:232)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:85)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2020)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
If you use web annotations in java code, you don't have to declare the servlet in the web.xml file any more.
You can try by removing the corresponding "servlet" and "servlet-mapping" tags in web.xml
It seems that WebLogic 12.1.3 can deal with double declaration (inline annotation & xml) but not anymore in WebLogic 12.2.
I had this error with #webservice annotation when I specified the "serviceName" parameter and when I declared the servlet in web.xml file with the same value.
The issue doesn't exist in version 12.1.3 (which happened to be the version we were meant to be upgrading to).
Weblogic as of version 12.2.1.3 automatically registers a JAX-RS servlet to the path /resources/* in certain scenarios (e.g. some dependency like jackson-jaxrs-json-provider "requests" it via annotation/spi/moduleinfo). But if this path is already registered by another service the mentioned error is thrown.
There are 3 possible solutions one can try:
In our case the issue was coming from classpath scanning for web services components, and finding annotated services in the webservices-rt jar. That scanning needed to be switched off.
Setting the metadata-complete attribute to true in the web.xml descriptor if your Web application does not have any annotations and if you have the version set to 2.5 or higher to avoid unnecessary scanning of the Web applications classes for annotations. E.g.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">
<servlet>
<servlet-name>sample</servlet-name>
<servlet-class>Sample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>sample</servlet-name>
<url-pattern>/sample</url-pattern>
</servlet-mapping>
</web-app>
Alternatively, you can turn off annotation processing and DI for all the Web applications by setting -Dweblogic.servlet.DIDisabled=true flag when starting WebLogic Server.
Registering another path for jersey in the web.xml to e.g. /jersey/*
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/jersey/*</url-pattern>
</servlet-mapping>
Try removing the FATP jars which were added after 12.2 upgrade. This worked for me.

No mapping found for HTTP request with URI warning for Font-awesome font files

I recently started using font-awesome v4.5.0. It was working like a charm until I upgraded to java 8 from java 7 and spring framework to v4.0 from v3.2
Now, font-awesome icons appear as squares. Browser console (firebug) shows-
NetworkError: 404 Not Found - http://localhost/myapp/fonts/fontawesome-webfont.woff2?v=4.5.0
and tomcat's catalina.out logs show following warnings-
No mapping found for HTTP request with URI [/myapp/fonts/fontawesome-webfont.woff2 in DispatcherServlet with name 'myappservlet'
No mapping found for HTTP request with URI [/myapp/fonts/fontawesome-webfont.woff] in DispatcherServlet with name 'myappservlet'
No mapping found for HTTP request with URI [/myapp/fonts/fontawesome-webfont.ttf] in DispatcherServlet with name 'myappservlet'
Location of 'fonts' folder is correctly specified in font-awesome.min.css's #font-face src. (There are no changes apart from java version and spring framework version. It suddenly stopped working)
I had the same issue.
do you have something like this in your web.xml?
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Comment those lines solved the problem for me.

Weblogic 12c versions, servlet failed to preload

Been scratching my head for about a day, I'd really appreciate any help.
Using Weblogic 12c version 12.2.1 and Jersey 1.19 everything is OK
Using Weblogic 12c version 12.1.3 I'm getting this error:
Servlet:"ServletAdaptor" failed to preload on startup in Web application: "PapWeb".java.lang.ArrayIndexOutOfBoundsException:
65281
Edit: I also see this related(?) warning when running the 12.1.3 server:
The application is using ServletContainerInitializer class
com.sun.jersey.server.impl.container.servlet.JerseyServletContainerInitializer
that is loaded
from:file:/D:/servers/wls12130/oracle_common/modules/jersey-servlet-1.18.jar.
This initializer overrides the one available in the system.
WEB_INF/lib includes those jars:
jersey-1.19
jersey-core-1.19
jersey-multipart-1.19
My web.xml has:
<servlet>
<servlet-name>ServletAdaptor</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>gr.modas.core.bussiness.services</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.server.provider.packages</param-name>
<param-value>gr.modas.core.bussiness.services</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
<param-value>gr.modas.core.bussiness.services.PapyrosRequestFilter</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ServletAdaptor</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
The code below (in weblogic.xml) solved the issue...
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<container-descriptor>
<prefer-web-inf-classes>**true**</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>

Class Not Found exception: STS

Everything was working properly until i added a new java package to my project, when i run my application the stack trace shows java.lang.ClassNotFoundException, i had to reference another class library as i could not figure out how to compile fresh new classes using eclipse. I added an external folder to my build path to temporarily fix the problem but now i am faced with the same problem.
Stack Trace and web.xml are below:
My question is, how do you do compile a project to create new classes using eclipse?
Caused by: java.lang.ClassNotFoundException: org.bixin.dugsi.security.JpaRealm
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1271)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1242)
... 38 more
WEB XML:
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>Dugsi_Manager Vaadin Application Servlet</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>org.bixin.dugsi.web.DugsiManagerApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Dugsi_Manager Vaadin Application Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Did a mvn clean and a mvn build to clear the cache of all old classes and create new classes

Resources