Semantic–jserv Troubleshootings - odys-z/semantic-jserv GitHub Wiki
Error: java.sql.SQLException: Name [jdbc/inet-semantic] is not bound in this Context. Unable to find [jdbc].
It's connection pool not configured correctly.
Here is an example (context.xml):
<Context>
<Resource name="jdbc/inet-semantic" global="jdbc/inet-semantic"
auth="Container" type="javax.sql.DataSource"
maxActive="10" maxIdle="3" maxWait="10000"
username="user-name" password="*********" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://...:3306/db-name?useSSL=true"
connectionProperties="useUnicode=yes;characterEncoding=utf8;autoReconnect=true;autoReconnectForPools=true" />
<Parameter name="io.oz.root-key" value="*********" override="false"/>
</Context>
SEVERE: Servlet.service() for servlet [io.odysz.semantic.jserv.R.SQuery] in context with path [/semantic.jserv] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: io.odysz.transact.sql.parts.select.JoinTabl$1
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1343)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1173)
at io.odysz.transact.sql.parts.select.JoinTabl.sql(JoinTabl.java:60)
Try
- mvn clean package -U and
- eclipse -> right click project -> maven -> update project ... -> force update snapshot / release
When starting jserv-sample, the demo server, depending classes are not found.
This is probably the early version of semantic-jserv lib (semantic.jserv) is created as an web application and alwasys included in assemly as WAR even if the package method is changed to jar in semantic.jserv/pom.xml
If this happend, you may probably needing to export a jar file for deploying dependent web application.
Download semantic.jserv-x.x.x.jar from Maven or export one by yourself.
Totally avoid using switch / case block on enum.
To understand the cause, you may read a discussion about java synthetic class.
And it's not easy to workaround because jar packaging don't package the synthesized classes while war packing will packaging these class but into a different structure that can not been used as class lib by other web applications.
The are similar trying and even the official maven Overlay plugin don't helped me.
FYI here is what I tried
Depend on WAR.
-
package semantic.jserv to both jar and war.
-
don't let jserv-sample denpends on semantic.jserv with property classifier == classes
see Maven Overlays
- export jar to jserv-sample/webroot/WEB-INF/lib
With help of the tomcat plugin, export the jar lib to jserv-sample lib. In the author's workspace, this file is
semantic.jserv/target/semantic.jserv.jar.
Note: Don't user eclipse export jar. The exported jar won't work.
Error:
See similar reports [4].
- use "provide" scope, see pom.xml/denpency semantic.jserv
- export semantic.jserv.jar and include in bulid path/exports Use semantic.jserv/jserv-rt.jardesc (double click in Eclipse) to export the jar lib.
[1] similar issue
https://stackoverflow.com/questions/21237339/java-lang-classnotfoundexception-org-springframework-web-context-contextloaderl [2] maven scope
https://stackoverflow.com/questions/26975818/what-is-scope-under-dependency-in-pom-xml-for [3] maven war dependency, there be be a better solution
https://stackoverflow.com/questions/1769586/maven-war-dependency
[4] Java enum name in class file is in consistence.
https://stackoverflow.com/questions/24473247/java-enum-noclassdeffounderror