Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Problems getting Tomcat server working
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
reichmyu
n00b
n00b


Joined: 19 Oct 2015
Posts: 18

PostPosted: Tue Oct 16, 2018 10:54 pm    Post subject: [Solved] Problems getting Tomcat server working Reply with quote

Hi!

I'm having some problems getting Tomcat to work on my gentoo installation. Whenever I try to launch it using startup.sh it says that it has started successfully but logs do not say the same :P
I have tried some googling and some searching in this forum but couln't come up with a solution.
Here is my log:
Code:
17-Oct-2018 00:45:49.866 ADVERTENCIA [main] org.apache.catalina.startup.ClassLoaderFactory.validateFile Problem with directory [/usr/share/tomcat-9/bin/${gentoo.classpath}], exists: [false], isDirectory: [false], canRead: [false]
17-Oct-2018 00:45:49.942 GRAVE [main] org.apache.catalina.startup.Catalina.initDirs No puedo hallar carpeta temporal especificada en [/usr/share/tomcat-9/temp]
17-Oct-2018 00:45:50.328 GRAVE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw error
 java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
   at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   at java.lang.Class.getDeclaredMethods0(Native Method)
   at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
   at java.lang.Class.privateGetPublicMethods(Class.java:2902)
   at java.lang.Class.getMethods(Class.java:1615)
   at org.apache.tomcat.util.IntrospectionUtils.findMethods(Unknown Source)
   at org.apache.tomcat.util.IntrospectionUtils.setProperty(Unknown Source)
   at org.apache.tomcat.util.IntrospectionUtils.setProperty(Unknown Source)
   at org.apache.catalina.startup.SetAllPropertiesRule.begin(Unknown Source)
   at org.apache.tomcat.util.digester.Digester.startElement(Unknown Source)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
   at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
   at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
   at org.apache.tomcat.util.digester.Digester.parse(Unknown Source)
   at org.apache.catalina.startup.Catalina.load(Unknown Source)
   at org.apache.catalina.startup.Catalina.load(Unknown Source)
   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:498)
   at org.apache.catalina.startup.Bootstrap.load(Unknown Source)
   at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
   at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   ... 41 more


It looks like the servlet api is missing but dev-java/tomcat-servlet-api is installed in my system.

Any ideas?

Thanks in advance :D


Last edited by reichmyu on Wed Oct 17, 2018 9:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30915
Location: here

PostPosted: Wed Oct 17, 2018 6:02 am    Post subject: Reply with quote

Why you not start tomcat with /etc/init.d/tomcat-9 ?
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
reichmyu
n00b
n00b


Joined: 19 Oct 2015
Posts: 18

PostPosted: Wed Oct 17, 2018 2:14 pm    Post subject: Reply with quote

fedeliallalinea wrote:
Why you not start tomcat with /etc/init.d/tomcat-9 ?

Same results when executing it using the .init file
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30915
Location: here

PostPosted: Wed Oct 17, 2018 2:38 pm    Post subject: Reply with quote

I found this, but not sure if can help
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
reichmyu
n00b
n00b


Joined: 19 Oct 2015
Posts: 18

PostPosted: Wed Oct 17, 2018 7:35 pm    Post subject: Reply with quote

fedeliallalinea wrote:
I found this, but not sure if can help

I had already read that thread before, it helped me placing the config and init files where they should be but couldn't get it fully working though.
Thank you very much anyway :)
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Wed Oct 17, 2018 7:50 pm    Post subject: Reply with quote

Don't know if this is the answer but seems similar to your problem


https://qiita.com/tkprof/items/d71af7899c9df96444cc

Quote:
with running Tomcat 7 and Tomcat 8 with same conf/ files, the change has been made as following:

http://tomcat.apache.org/tomcat-8.0-doc/changelog.html

55620: Enable Tomcat to start when either $CATALINA_HOME and/or $CATALINA_BASE contains a comma character. Prevent Tomcat from starting when $CATALINA_HOME and/or $CATALINA_BASE contains a semi-colon on Windows. Prevent Tomcat from starting when $CATALINA_HOME and/or $CATALINA_BASE contains a colon on inux/FreeBSD/etc.`

now running OK both 7 and 8


Edit to add: also this although it's from tomcat 7

https://stackoverflow.com/questions/38135009/catalina-configuration-test-catalina-sh-configtest
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
reichmyu
n00b
n00b


Joined: 19 Oct 2015
Posts: 18

PostPosted: Wed Oct 17, 2018 9:44 pm    Post subject: Reply with quote

Finally found it!

In the file /usr/share/tomcat-9/package.env the servlet jar file was not appearing inside the CLASSPATH variable. Added its location and now it works perfectly!

Thank you all very much :D
Back to top
View user's profile Send private message
*zensiert*
n00b
n00b


Joined: 10 Oct 2004
Posts: 55
Location: Germany

PostPosted: Fri Jul 31, 2020 12:52 pm    Post subject: Reply with quote

reichmyu wrote:
In the file /usr/share/tomcat-9/package.env the servlet jar file was not appearing inside the CLASSPATH variable. Added its location and now it works perfectly!


Thank you, I had the same problem, that also fixed it.

However, I'm not sure this is the right place to fix it, as this file gets overwritten after every update of the package. Therefore, I raised a bug:
https://bugs.gentoo.org/734948
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum