You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Maxim Solodovnik <so...@gmail.com> on 2017/11/03 04:51:42 UTC

Start embedded Tomcat 9.0.1 server from java code

Hello,

I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
Everything works as expected except tests :(

I'm using following code to start embedded Tomcat and test CXF web services [1].
With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is not
being listened
What need to be changed?


[1] https://github.com/apache/openmeetings/blob/master/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java#L98

-- 
WBR
Maxim aka solomax

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks a lot for the review Konstantin,
I have correct our tests :)

Will Also contact CXF project
This code was taken from their tests: [1] :))

[1]
https://github.com/apache/cxf/blob/master/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/tomcat/AbstractTomcatServer.java#L45


On Wed, Nov 8, 2017 at 6:08 PM, Konstantin Kolinko <kn...@gmail.com>
wrote:

> I have several comments on
> [1] https://github.com/apache/openmeetings/blob/master/
> openmeetings-web/src/test/java/org/apache/openmeetings/webservice/
> AbstractWebServiceTest.java#L98
>
>
> 2017-11-07 20:07 GMT+03:00 Tobias Soloschenko
> <to...@googlemail.com>:
> > Hi Maxim,
> >
> > same for me I just created a simple setup like this:
> >
> >         String baseDir =".";
> >         String webappDirLocation = "src/main/webapp/";
> >         String webxmlDirLocation = "src/main/webapp/WEB-INF/web.xml";
> >         Tomcat tomcat = new Tomcat();
> >         tomcat.setPort(8080);
>
> 1) Maybe you will want to update the test to use a random port number,
> so that several tests could be run in parallel.
>
> Use connector.setPort(0) to enable random port number feature (see
> TomcatBaseTest.setUp())
> followed by connector.getLocalPort(); after startup  (see
> TomcatBaseTest.getPort())
>
> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/
> catalina/startup/TomcatBaseTest.java?revision=1812119&view=markup#l146
>
> An example of a simple test case and use of getPort():
> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/
> catalina/startup/TestTomcat.java?revision=1769263&view=markup#l189
>
> 2) Tomcat tests use address="localhost" on connector.
> See TomcatBaseTest.setUp()
>
> Running with localhost avoids opening ports on a public interface.
>
> (When running on Windows its Firewall pops up a dialog and asks
> whether to allow network access for this software.
> Using localhost avoid this dialog.)
>
> >         tomcat.setBaseDir(baseDir);
> >         tomcat.getHost().setAppBase(baseDir);
> >         tomcat.getHost().setDeployOnStartup(true);
> >         tomcat.getHost().setAutoDeploy(true);
> >         tomcat.enableNaming();
> >         StandardContext ctx = (StandardContext)
> tomcat.addWebapp("/project", new File(webappDirLocation).
> getAbsolutePath());
> >         File additionWebInfClasses = new File("target/classes");
> >         WebResourceRoot resources = new StandardRoot(ctx);
> >         resources.addPreResources(new DirResourceSet(resources,
> "/WEB-INF/classes",
> >                 additionWebInfClasses.getAbsolutePath(), "/"));
> >         ctx.setResources(resources);
> >         ctx.setDefaultWebXml(new File(webxmlDirLocation).
> getAbsolutePath());
> >         tomcat.start();
> >         tomcat.getServer().await();
> >
>
> 3) In an automated test both "deployOnStartup" and "autoDeploy" flags
> should be set to "false".
>
> Do you want that any random files and directories created in a
> temporary directory (baseDir) to be auto-deployed
> and exposed as web applications in Tomcat?  I guess that you do not
> want that, so set those flags to false.
>
> Tomcat.addWebapp explicitly configures a web application.
> Auto-deployment is not needed.
>
> > I just placed in a Servlet into my classpath and applied the mapping in
> the web.xml - with the dependencies of tomcat-embed-core and
> tomcat-embed-jasper of version 9.0.1 it is not working and with 8.5.23 it
> does.
> >
> > Here is the log of both.
> > [...]
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
WBR
Maxim aka solomax

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Konstantin Kolinko <kn...@gmail.com>.
I have several comments on
[1] https://github.com/apache/openmeetings/blob/master/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java#L98


2017-11-07 20:07 GMT+03:00 Tobias Soloschenko
<to...@googlemail.com>:
> Hi Maxim,
>
> same for me I just created a simple setup like this:
>
>         String baseDir =".";
>         String webappDirLocation = "src/main/webapp/";
>         String webxmlDirLocation = "src/main/webapp/WEB-INF/web.xml";
>         Tomcat tomcat = new Tomcat();
>         tomcat.setPort(8080);

1) Maybe you will want to update the test to use a random port number,
so that several tests could be run in parallel.

Use connector.setPort(0) to enable random port number feature (see
TomcatBaseTest.setUp())
followed by connector.getLocalPort(); after startup  (see
TomcatBaseTest.getPort())

http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?revision=1812119&view=markup#l146

An example of a simple test case and use of getPort():
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java?revision=1769263&view=markup#l189

2) Tomcat tests use address="localhost" on connector.
See TomcatBaseTest.setUp()

Running with localhost avoids opening ports on a public interface.

(When running on Windows its Firewall pops up a dialog and asks
whether to allow network access for this software.
Using localhost avoid this dialog.)

>         tomcat.setBaseDir(baseDir);
>         tomcat.getHost().setAppBase(baseDir);
>         tomcat.getHost().setDeployOnStartup(true);
>         tomcat.getHost().setAutoDeploy(true);
>         tomcat.enableNaming();
>         StandardContext ctx = (StandardContext) tomcat.addWebapp("/project", new File(webappDirLocation).getAbsolutePath());
>         File additionWebInfClasses = new File("target/classes");
>         WebResourceRoot resources = new StandardRoot(ctx);
>         resources.addPreResources(new DirResourceSet(resources, "/WEB-INF/classes",
>                 additionWebInfClasses.getAbsolutePath(), "/"));
>         ctx.setResources(resources);
>         ctx.setDefaultWebXml(new File(webxmlDirLocation).getAbsolutePath());
>         tomcat.start();
>         tomcat.getServer().await();
>

3) In an automated test both "deployOnStartup" and "autoDeploy" flags
should be set to "false".

Do you want that any random files and directories created in a
temporary directory (baseDir) to be auto-deployed
and exposed as web applications in Tomcat?  I guess that you do not
want that, so set those flags to false.

Tomcat.addWebapp explicitly configures a web application.
Auto-deployment is not needed.

> I just placed in a Servlet into my classpath and applied the mapping in the web.xml - with the dependencies of tomcat-embed-core and tomcat-embed-jasper of version 9.0.1 it is not working and with 8.5.23 it does.
>
> Here is the log of both.
> [...]

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks for the clarifications!
I'll update my code

On Wed, Nov 8, 2017 at 1:49 PM, Rémy Maucherat <re...@apache.org> wrote:

> On Wed, Nov 8, 2017 at 5:30 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > OK :)
> > I finally found the difference :)))
> >
> > Tomcat.java 8.5.23:
> >     public void start() throws LifecycleException {
> >         getServer();
> >         getConnector();
> >         server.start();
> >     }
> >
> > Tomcat.java 9.0.1:
> >     public void start() throws LifecycleException {
> >         getServer();
> >         server.start();
> >     }
> >
> > This is why Tomcat 9.0.2 has no connectors ....
> > Is it bug or feature?
> >
>
> The automatic connector creation, among other tings, was conflicting with
> other more sophisticated uses so it was refactored. It was not possible to
> start Tomcat without a connector so that capability was added in Tomcat 9.
> If you want to get a default connector, you have to call getConnector
> yourself.
> BZ60297, BZ60368, then a Tomcat 9 specific change.
>
> Rémy
>
> >
> >
> > On Wed, Nov 8, 2017 at 12:07 AM, Tobias Soloschenko <
> > tobiassoloschenko@googlemail.com> wrote:
> >
> > > Hi Maxim,
> > >
> > > same for me I just created a simple setup like this:
> > >
> > >         String baseDir =".";
> > >         String webappDirLocation = "src/main/webapp/";
> > >         String webxmlDirLocation = "src/main/webapp/WEB-INF/web.xml";
> > >         Tomcat tomcat = new Tomcat();
> > >         tomcat.setPort(8080);
> > >         tomcat.setBaseDir(baseDir);
> > >         tomcat.getHost().setAppBase(baseDir);
> > >         tomcat.getHost().setDeployOnStartup(true);
> > >         tomcat.getHost().setAutoDeploy(true);
> > >         tomcat.enableNaming();
> > >         StandardContext ctx = (StandardContext)
> > > tomcat.addWebapp("/project", new File(webappDirLocation).
> > > getAbsolutePath());
> > >         File additionWebInfClasses = new File("target/classes");
> > >         WebResourceRoot resources = new StandardRoot(ctx);
> > >         resources.addPreResources(new DirResourceSet(resources,
> > > "/WEB-INF/classes",
> > >                 additionWebInfClasses.getAbsolutePath(), "/"));
> > >         ctx.setResources(resources);
> > >         ctx.setDefaultWebXml(new File(webxmlDirLocation).
> > > getAbsolutePath());
> > >         tomcat.start();
> > >         tomcat.getServer().await();
> > >
> > > I just placed in a Servlet into my classpath and applied the mapping in
> > > the web.xml - with the dependencies of tomcat-embed-core and
> > > tomcat-embed-jasper of version 9.0.1 it is not working and with 8.5.23
> it
> > > does.
> > >
> > > Here is the log of both.
> > >
> > > 8.5.23
> > >
> > > Nov. 07, 2017 6:02:44 NACHM. org.apache.coyote.AbstractProtocol init
> > > INFORMATION: Initializing ProtocolHandler ["http-nio-8080"]
> > > Nov. 07, 2017 6:02:44 NACHM. org.apache.tomcat.util.net.
> NioSelectorPool
> > > getSharedSelector
> > > INFORMATION: Using a shared selector for servlet write/read
> > > Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardService
> > > startInternal
> > > INFORMATION: Starting service [Tomcat]
> > > Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardEngine
> > > startInternal
> > > INFORMATION: Starting Servlet Engine: Apache Tomcat/8.5.23
> > > Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.startup.ContextConfig
> > > getDefaultWebXmlFragment
> > > INFORMATION: No global web.xml found
> > > Nov. 07, 2017 6:02:45 NACHM. org.apache.coyote.AbstractProtocol start
> > > INFORMATION: Starting ProtocolHandler ["http-nio-8080“]
> > >
> > > 9.0.1
> > >
> > > Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardService
> > > startInternal
> > > INFORMATION: Starting service [Tomcat]
> > > Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardEngine
> > > startInternal
> > > INFORMATION: Starting Servlet Engine: Apache Tomcat/9.0.1
> > > Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.startup.ContextConfig
> > > getDefaultWebXmlFragment
> > > INFORMATION: No global web.xml found
> > >
> > > kind regards
> > >
> > > Tobias
> > >
> > > > Am 07.11.2017 um 15:56 schrieb Maxim Solodovnik <
> solomax666@gmail.com
> > >:
> > > >
> > > > Thanks for the hints :)
> > > >
> > > > I have created sample project: https://github.com/solomax/
> > > tomcat-from-java
> > > >
> > > > I have compared detailed logs.
> > > >
> > > > Following lines appears in logs while Tomcat8 is used
> > > >         Nov 07, 2017 9:1 PM org.apache.catalina.util.LifecycleBase
> > > > setStateInternal
> > > >         FINE: Setting state for [Connector[HTTP/1.1-8080]] to
> > > > [INITIALIZING]
> > > >         Nov 07, 2017 9:1 PM org.apache.tomcat.util.modeler.Registry
> > > > registerComponent
> > > >         FINE: Managed= Tomcat:type=Connector,port=8080
> > > >
> > > > These lines are missing while Tomcat9 is used
> > > >
> > > > Maybe you can tell me why?
> > > >
> > > > On Mon, Nov 6, 2017 at 7:55 PM, Mark Thomas <ma...@apache.org>
> wrote:
> > > >
> > > >> On 04/11/17 15:25, Maxim Solodovnik wrote:
> > > >>> Maybe I can set breakpoint somewhere? and check what is wrong?
> > > >>> Could you point me to the correct class?
> > > >>
> > > >> No idea where to look at this point. I'd probably start with the
> > start()
> > > >> method and go from there.
> > > >>
> > > >> Maybe try turning on debug logging?
> > > >>
> > > >> Mark
> > > >>
> > > >>
> > > >>>
> > > >>> On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <
> > solomax666@gmail.com
> > > >
> > > >>> wrote:
> > > >>>
> > > >>>> I'm OK to add missing code to my tests,
> > > >>>> but I'm not sure what need to be added :(
> > > >>>>
> > > >>>> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <
> > > solomax666@gmail.com>
> > > >>>> wrote:
> > > >>>>
> > > >>>>> I see no errors,
> > > >>>>> Using debugger I can see tomcat.server.state == STARTED
> > > >>>>>
> > > >>>>> Everything works as expected if I'm switching back to 8.5.23
> > without
> > > >> any
> > > >>>>> other changes
> > > >>>>>
> > > >>>>> nestat reports:
> > > >>>>> *netstat -an |grep 8080*
> > > >>>>> tcp6       0      0 :::8080                 :::*
> > > >>>>> LISTEN
> > > >>>>>
> > > >>>>> for 8.5.23
> > > >>>>>
> > > >>>>>
> > > >>>>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org>
> > > wrote:
> > > >>>>>
> > > >>>>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
> > > >>>>>>> Hello,
> > > >>>>>>>
> > > >>>>>>> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
> > > >>>>>>> Everything works as expected except tests :(
> > > >>>>>>>
> > > >>>>>>> I'm using following code to start embedded Tomcat and test CXF
> > web
> > > >>>>>> services [1].
> > > >>>>>>> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080
> is
> > > not
> > > >>>>>>> being listened
> > > >>>>>>> What need to be changed?
> > > >>>>>>
> > > >>>>>> If Tomcat isn't listening then there should be an exception or
> > error
> > > >>>>>> message reported at some point. Do you see anything in the logs?
> > > >>>>>>
> > > >>>>>> Mark
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>> [1] https://github.com/apache/openmeetings/blob/master/
> openmeeti
> > > >>>>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
> > > >>>>>> AbstractWebServiceTest.java#L98
> > > >>>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> ------------------------------------------------------------
> > > ---------
> > > >>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > >>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> > > >>>>>>
> > > >>>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> --
> > > >>>>> WBR
> > > >>>>> Maxim aka solomax
> > > >>>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>> --
> > > >>>> WBR
> > > >>>> Maxim aka solomax
> > > >>>>
> > > >>>
> > > >>>
> > > >>>
> > > >>
> > > >>
> > > >> ------------------------------------------------------------
> ---------
> > > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > >> For additional commands, e-mail: users-help@tomcat.apache.org
> > > >>
> > > >>
> > > >
> > > >
> > > > --
> > > > WBR
> > > > Maxim aka solomax
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Tobias Soloschenko <to...@googlemail.com>.
Thanks for the hints! :-)

kind regards

Tobias

> Am 08.11.2017 um 07:49 schrieb Rémy Maucherat <re...@apache.org>:
> 
> On Wed, Nov 8, 2017 at 5:30 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
> 
>> OK :)
>> I finally found the difference :)))
>> 
>> Tomcat.java 8.5.23:
>>    public void start() throws LifecycleException {
>>        getServer();
>>        getConnector();
>>        server.start();
>>    }
>> 
>> Tomcat.java 9.0.1:
>>    public void start() throws LifecycleException {
>>        getServer();
>>        server.start();
>>    }
>> 
>> This is why Tomcat 9.0.2 has no connectors ....
>> Is it bug or feature?
>> 
> 
> The automatic connector creation, among other tings, was conflicting with
> other more sophisticated uses so it was refactored. It was not possible to
> start Tomcat without a connector so that capability was added in Tomcat 9.
> If you want to get a default connector, you have to call getConnector
> yourself.
> BZ60297, BZ60368, then a Tomcat 9 specific change.
> 
> Rémy
> 
>> 
>> 
>> On Wed, Nov 8, 2017 at 12:07 AM, Tobias Soloschenko <
>> tobiassoloschenko@googlemail.com> wrote:
>> 
>>> Hi Maxim,
>>> 
>>> same for me I just created a simple setup like this:
>>> 
>>>        String baseDir =".";
>>>        String webappDirLocation = "src/main/webapp/";
>>>        String webxmlDirLocation = "src/main/webapp/WEB-INF/web.xml";
>>>        Tomcat tomcat = new Tomcat();
>>>        tomcat.setPort(8080);
>>>        tomcat.setBaseDir(baseDir);
>>>        tomcat.getHost().setAppBase(baseDir);
>>>        tomcat.getHost().setDeployOnStartup(true);
>>>        tomcat.getHost().setAutoDeploy(true);
>>>        tomcat.enableNaming();
>>>        StandardContext ctx = (StandardContext)
>>> tomcat.addWebapp("/project", new File(webappDirLocation).
>>> getAbsolutePath());
>>>        File additionWebInfClasses = new File("target/classes");
>>>        WebResourceRoot resources = new StandardRoot(ctx);
>>>        resources.addPreResources(new DirResourceSet(resources,
>>> "/WEB-INF/classes",
>>>                additionWebInfClasses.getAbsolutePath(), "/"));
>>>        ctx.setResources(resources);
>>>        ctx.setDefaultWebXml(new File(webxmlDirLocation).
>>> getAbsolutePath());
>>>        tomcat.start();
>>>        tomcat.getServer().await();
>>> 
>>> I just placed in a Servlet into my classpath and applied the mapping in
>>> the web.xml - with the dependencies of tomcat-embed-core and
>>> tomcat-embed-jasper of version 9.0.1 it is not working and with 8.5.23 it
>>> does.
>>> 
>>> Here is the log of both.
>>> 
>>> 8.5.23
>>> 
>>> Nov. 07, 2017 6:02:44 NACHM. org.apache.coyote.AbstractProtocol init
>>> INFORMATION: Initializing ProtocolHandler ["http-nio-8080"]
>>> Nov. 07, 2017 6:02:44 NACHM. org.apache.tomcat.util.net.NioSelectorPool
>>> getSharedSelector
>>> INFORMATION: Using a shared selector for servlet write/read
>>> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardService
>>> startInternal
>>> INFORMATION: Starting service [Tomcat]
>>> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardEngine
>>> startInternal
>>> INFORMATION: Starting Servlet Engine: Apache Tomcat/8.5.23
>>> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.startup.ContextConfig
>>> getDefaultWebXmlFragment
>>> INFORMATION: No global web.xml found
>>> Nov. 07, 2017 6:02:45 NACHM. org.apache.coyote.AbstractProtocol start
>>> INFORMATION: Starting ProtocolHandler ["http-nio-8080“]
>>> 
>>> 9.0.1
>>> 
>>> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardService
>>> startInternal
>>> INFORMATION: Starting service [Tomcat]
>>> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardEngine
>>> startInternal
>>> INFORMATION: Starting Servlet Engine: Apache Tomcat/9.0.1
>>> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.startup.ContextConfig
>>> getDefaultWebXmlFragment
>>> INFORMATION: No global web.xml found
>>> 
>>> kind regards
>>> 
>>> Tobias
>>> 
>>>> Am 07.11.2017 um 15:56 schrieb Maxim Solodovnik <solomax666@gmail.com
>>> :
>>>> 
>>>> Thanks for the hints :)
>>>> 
>>>> I have created sample project: https://github.com/solomax/
>>> tomcat-from-java
>>>> 
>>>> I have compared detailed logs.
>>>> 
>>>> Following lines appears in logs while Tomcat8 is used
>>>>        Nov 07, 2017 9:1 PM org.apache.catalina.util.LifecycleBase
>>>> setStateInternal
>>>>        FINE: Setting state for [Connector[HTTP/1.1-8080]] to
>>>> [INITIALIZING]
>>>>        Nov 07, 2017 9:1 PM org.apache.tomcat.util.modeler.Registry
>>>> registerComponent
>>>>        FINE: Managed= Tomcat:type=Connector,port=8080
>>>> 
>>>> These lines are missing while Tomcat9 is used
>>>> 
>>>> Maybe you can tell me why?
>>>> 
>>>>> On Mon, Nov 6, 2017 at 7:55 PM, Mark Thomas <ma...@apache.org> wrote:
>>>>> 
>>>>>> On 04/11/17 15:25, Maxim Solodovnik wrote:
>>>>>> Maybe I can set breakpoint somewhere? and check what is wrong?
>>>>>> Could you point me to the correct class?
>>>>> 
>>>>> No idea where to look at this point. I'd probably start with the
>> start()
>>>>> method and go from there.
>>>>> 
>>>>> Maybe try turning on debug logging?
>>>>> 
>>>>> Mark
>>>>> 
>>>>> 
>>>>>> 
>>>>>> On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <
>> solomax666@gmail.com
>>>> 
>>>>>> wrote:
>>>>>> 
>>>>>>> I'm OK to add missing code to my tests,
>>>>>>> but I'm not sure what need to be added :(
>>>>>>> 
>>>>>>> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <
>>> solomax666@gmail.com>
>>>>>>> wrote:
>>>>>>> 
>>>>>>>> I see no errors,
>>>>>>>> Using debugger I can see tomcat.server.state == STARTED
>>>>>>>> 
>>>>>>>> Everything works as expected if I'm switching back to 8.5.23
>> without
>>>>> any
>>>>>>>> other changes
>>>>>>>> 
>>>>>>>> nestat reports:
>>>>>>>> *netstat -an |grep 8080*
>>>>>>>> tcp6       0      0 :::8080                 :::*
>>>>>>>> LISTEN
>>>>>>>> 
>>>>>>>> for 8.5.23
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org>
>>> wrote:
>>>>>>>> 
>>>>>>>>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
>>>>>>>>>> Hello,
>>>>>>>>>> 
>>>>>>>>>> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
>>>>>>>>>> Everything works as expected except tests :(
>>>>>>>>>> 
>>>>>>>>>> I'm using following code to start embedded Tomcat and test CXF
>> web
>>>>>>>>> services [1].
>>>>>>>>>> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is
>>> not
>>>>>>>>>> being listened
>>>>>>>>>> What need to be changed?
>>>>>>>>> 
>>>>>>>>> If Tomcat isn't listening then there should be an exception or
>> error
>>>>>>>>> message reported at some point. Do you see anything in the logs?
>>>>>>>>> 
>>>>>>>>> Mark
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> [1] https://github.com/apache/openmeetings/blob/master/openmeeti
>>>>>>>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
>>>>>>>>> AbstractWebServiceTest.java#L98
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> ------------------------------------------------------------
>>> ---------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> WBR
>>>>>>>> Maxim aka solomax
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> WBR
>>>>>>> Maxim aka solomax
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> WBR
>>>> Maxim aka solomax
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>> 
>>> 
>> 
>> 
>> --
>> WBR
>> Maxim aka solomax
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Rémy Maucherat <re...@apache.org>.
On Wed, Nov 8, 2017 at 5:30 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> OK :)
> I finally found the difference :)))
>
> Tomcat.java 8.5.23:
>     public void start() throws LifecycleException {
>         getServer();
>         getConnector();
>         server.start();
>     }
>
> Tomcat.java 9.0.1:
>     public void start() throws LifecycleException {
>         getServer();
>         server.start();
>     }
>
> This is why Tomcat 9.0.2 has no connectors ....
> Is it bug or feature?
>

The automatic connector creation, among other tings, was conflicting with
other more sophisticated uses so it was refactored. It was not possible to
start Tomcat without a connector so that capability was added in Tomcat 9.
If you want to get a default connector, you have to call getConnector
yourself.
BZ60297, BZ60368, then a Tomcat 9 specific change.

Rémy

>
>
> On Wed, Nov 8, 2017 at 12:07 AM, Tobias Soloschenko <
> tobiassoloschenko@googlemail.com> wrote:
>
> > Hi Maxim,
> >
> > same for me I just created a simple setup like this:
> >
> >         String baseDir =".";
> >         String webappDirLocation = "src/main/webapp/";
> >         String webxmlDirLocation = "src/main/webapp/WEB-INF/web.xml";
> >         Tomcat tomcat = new Tomcat();
> >         tomcat.setPort(8080);
> >         tomcat.setBaseDir(baseDir);
> >         tomcat.getHost().setAppBase(baseDir);
> >         tomcat.getHost().setDeployOnStartup(true);
> >         tomcat.getHost().setAutoDeploy(true);
> >         tomcat.enableNaming();
> >         StandardContext ctx = (StandardContext)
> > tomcat.addWebapp("/project", new File(webappDirLocation).
> > getAbsolutePath());
> >         File additionWebInfClasses = new File("target/classes");
> >         WebResourceRoot resources = new StandardRoot(ctx);
> >         resources.addPreResources(new DirResourceSet(resources,
> > "/WEB-INF/classes",
> >                 additionWebInfClasses.getAbsolutePath(), "/"));
> >         ctx.setResources(resources);
> >         ctx.setDefaultWebXml(new File(webxmlDirLocation).
> > getAbsolutePath());
> >         tomcat.start();
> >         tomcat.getServer().await();
> >
> > I just placed in a Servlet into my classpath and applied the mapping in
> > the web.xml - with the dependencies of tomcat-embed-core and
> > tomcat-embed-jasper of version 9.0.1 it is not working and with 8.5.23 it
> > does.
> >
> > Here is the log of both.
> >
> > 8.5.23
> >
> > Nov. 07, 2017 6:02:44 NACHM. org.apache.coyote.AbstractProtocol init
> > INFORMATION: Initializing ProtocolHandler ["http-nio-8080"]
> > Nov. 07, 2017 6:02:44 NACHM. org.apache.tomcat.util.net.NioSelectorPool
> > getSharedSelector
> > INFORMATION: Using a shared selector for servlet write/read
> > Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardService
> > startInternal
> > INFORMATION: Starting service [Tomcat]
> > Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardEngine
> > startInternal
> > INFORMATION: Starting Servlet Engine: Apache Tomcat/8.5.23
> > Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.startup.ContextConfig
> > getDefaultWebXmlFragment
> > INFORMATION: No global web.xml found
> > Nov. 07, 2017 6:02:45 NACHM. org.apache.coyote.AbstractProtocol start
> > INFORMATION: Starting ProtocolHandler ["http-nio-8080“]
> >
> > 9.0.1
> >
> > Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardService
> > startInternal
> > INFORMATION: Starting service [Tomcat]
> > Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardEngine
> > startInternal
> > INFORMATION: Starting Servlet Engine: Apache Tomcat/9.0.1
> > Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.startup.ContextConfig
> > getDefaultWebXmlFragment
> > INFORMATION: No global web.xml found
> >
> > kind regards
> >
> > Tobias
> >
> > > Am 07.11.2017 um 15:56 schrieb Maxim Solodovnik <solomax666@gmail.com
> >:
> > >
> > > Thanks for the hints :)
> > >
> > > I have created sample project: https://github.com/solomax/
> > tomcat-from-java
> > >
> > > I have compared detailed logs.
> > >
> > > Following lines appears in logs while Tomcat8 is used
> > >         Nov 07, 2017 9:1 PM org.apache.catalina.util.LifecycleBase
> > > setStateInternal
> > >         FINE: Setting state for [Connector[HTTP/1.1-8080]] to
> > > [INITIALIZING]
> > >         Nov 07, 2017 9:1 PM org.apache.tomcat.util.modeler.Registry
> > > registerComponent
> > >         FINE: Managed= Tomcat:type=Connector,port=8080
> > >
> > > These lines are missing while Tomcat9 is used
> > >
> > > Maybe you can tell me why?
> > >
> > > On Mon, Nov 6, 2017 at 7:55 PM, Mark Thomas <ma...@apache.org> wrote:
> > >
> > >> On 04/11/17 15:25, Maxim Solodovnik wrote:
> > >>> Maybe I can set breakpoint somewhere? and check what is wrong?
> > >>> Could you point me to the correct class?
> > >>
> > >> No idea where to look at this point. I'd probably start with the
> start()
> > >> method and go from there.
> > >>
> > >> Maybe try turning on debug logging?
> > >>
> > >> Mark
> > >>
> > >>
> > >>>
> > >>> On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <
> solomax666@gmail.com
> > >
> > >>> wrote:
> > >>>
> > >>>> I'm OK to add missing code to my tests,
> > >>>> but I'm not sure what need to be added :(
> > >>>>
> > >>>> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <
> > solomax666@gmail.com>
> > >>>> wrote:
> > >>>>
> > >>>>> I see no errors,
> > >>>>> Using debugger I can see tomcat.server.state == STARTED
> > >>>>>
> > >>>>> Everything works as expected if I'm switching back to 8.5.23
> without
> > >> any
> > >>>>> other changes
> > >>>>>
> > >>>>> nestat reports:
> > >>>>> *netstat -an |grep 8080*
> > >>>>> tcp6       0      0 :::8080                 :::*
> > >>>>> LISTEN
> > >>>>>
> > >>>>> for 8.5.23
> > >>>>>
> > >>>>>
> > >>>>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org>
> > wrote:
> > >>>>>
> > >>>>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
> > >>>>>>> Hello,
> > >>>>>>>
> > >>>>>>> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
> > >>>>>>> Everything works as expected except tests :(
> > >>>>>>>
> > >>>>>>> I'm using following code to start embedded Tomcat and test CXF
> web
> > >>>>>> services [1].
> > >>>>>>> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is
> > not
> > >>>>>>> being listened
> > >>>>>>> What need to be changed?
> > >>>>>>
> > >>>>>> If Tomcat isn't listening then there should be an exception or
> error
> > >>>>>> message reported at some point. Do you see anything in the logs?
> > >>>>>>
> > >>>>>> Mark
> > >>>>>>
> > >>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> [1] https://github.com/apache/openmeetings/blob/master/openmeeti
> > >>>>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
> > >>>>>> AbstractWebServiceTest.java#L98
> > >>>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>> ------------------------------------------------------------
> > ---------
> > >>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> > >>>>>>
> > >>>>>>
> > >>>>>
> > >>>>>
> > >>>>> --
> > >>>>> WBR
> > >>>>> Maxim aka solomax
> > >>>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>> --
> > >>>> WBR
> > >>>> Maxim aka solomax
> > >>>>
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> For additional commands, e-mail: users-help@tomcat.apache.org
> > >>
> > >>
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Maxim Solodovnik <so...@gmail.com>.
.... This is why Tomcat 9.0.1 has no connectors ....

sorry for the typo

On Wed, Nov 8, 2017 at 11:30 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> OK :)
> I finally found the difference :)))
>
> Tomcat.java 8.5.23:
>     public void start() throws LifecycleException {
>         getServer();
>         getConnector();
>         server.start();
>     }
>
> Tomcat.java 9.0.1:
>     public void start() throws LifecycleException {
>         getServer();
>         server.start();
>     }
>
> This is why Tomcat 9.0.2 has no connectors ....
> Is it bug or feature?
>
>
> On Wed, Nov 8, 2017 at 12:07 AM, Tobias Soloschenko <
> tobiassoloschenko@googlemail.com> wrote:
>
>> Hi Maxim,
>>
>> same for me I just created a simple setup like this:
>>
>>         String baseDir =".";
>>         String webappDirLocation = "src/main/webapp/";
>>         String webxmlDirLocation = "src/main/webapp/WEB-INF/web.xml";
>>         Tomcat tomcat = new Tomcat();
>>         tomcat.setPort(8080);
>>         tomcat.setBaseDir(baseDir);
>>         tomcat.getHost().setAppBase(baseDir);
>>         tomcat.getHost().setDeployOnStartup(true);
>>         tomcat.getHost().setAutoDeploy(true);
>>         tomcat.enableNaming();
>>         StandardContext ctx = (StandardContext)
>> tomcat.addWebapp("/project", new File(webappDirLocation).getAbs
>> olutePath());
>>         File additionWebInfClasses = new File("target/classes");
>>         WebResourceRoot resources = new StandardRoot(ctx);
>>         resources.addPreResources(new DirResourceSet(resources,
>> "/WEB-INF/classes",
>>                 additionWebInfClasses.getAbsolutePath(), "/"));
>>         ctx.setResources(resources);
>>         ctx.setDefaultWebXml(new File(webxmlDirLocation).getAbs
>> olutePath());
>>         tomcat.start();
>>         tomcat.getServer().await();
>>
>> I just placed in a Servlet into my classpath and applied the mapping in
>> the web.xml - with the dependencies of tomcat-embed-core and
>> tomcat-embed-jasper of version 9.0.1 it is not working and with 8.5.23 it
>> does.
>>
>> Here is the log of both.
>>
>> 8.5.23
>>
>> Nov. 07, 2017 6:02:44 NACHM. org.apache.coyote.AbstractProtocol init
>> INFORMATION: Initializing ProtocolHandler ["http-nio-8080"]
>> Nov. 07, 2017 6:02:44 NACHM. org.apache.tomcat.util.net.NioSelectorPool
>> getSharedSelector
>> INFORMATION: Using a shared selector for servlet write/read
>> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardService
>> startInternal
>> INFORMATION: Starting service [Tomcat]
>> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardEngine
>> startInternal
>> INFORMATION: Starting Servlet Engine: Apache Tomcat/8.5.23
>> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.startup.ContextConfig
>> getDefaultWebXmlFragment
>> INFORMATION: No global web.xml found
>> Nov. 07, 2017 6:02:45 NACHM. org.apache.coyote.AbstractProtocol start
>> INFORMATION: Starting ProtocolHandler ["http-nio-8080“]
>>
>> 9.0.1
>>
>> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardService
>> startInternal
>> INFORMATION: Starting service [Tomcat]
>> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardEngine
>> startInternal
>> INFORMATION: Starting Servlet Engine: Apache Tomcat/9.0.1
>> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.startup.ContextConfig
>> getDefaultWebXmlFragment
>> INFORMATION: No global web.xml found
>>
>> kind regards
>>
>> Tobias
>>
>> > Am 07.11.2017 um 15:56 schrieb Maxim Solodovnik <so...@gmail.com>:
>> >
>> > Thanks for the hints :)
>> >
>> > I have created sample project: https://github.com/solomax/tom
>> cat-from-java
>> >
>> > I have compared detailed logs.
>> >
>> > Following lines appears in logs while Tomcat8 is used
>> >         Nov 07, 2017 9:1 PM org.apache.catalina.util.LifecycleBase
>> > setStateInternal
>> >         FINE: Setting state for [Connector[HTTP/1.1-8080]] to
>> > [INITIALIZING]
>> >         Nov 07, 2017 9:1 PM org.apache.tomcat.util.modeler.Registry
>> > registerComponent
>> >         FINE: Managed= Tomcat:type=Connector,port=8080
>> >
>> > These lines are missing while Tomcat9 is used
>> >
>> > Maybe you can tell me why?
>> >
>> > On Mon, Nov 6, 2017 at 7:55 PM, Mark Thomas <ma...@apache.org> wrote:
>> >
>> >> On 04/11/17 15:25, Maxim Solodovnik wrote:
>> >>> Maybe I can set breakpoint somewhere? and check what is wrong?
>> >>> Could you point me to the correct class?
>> >>
>> >> No idea where to look at this point. I'd probably start with the
>> start()
>> >> method and go from there.
>> >>
>> >> Maybe try turning on debug logging?
>> >>
>> >> Mark
>> >>
>> >>
>> >>>
>> >>> On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <
>> solomax666@gmail.com>
>> >>> wrote:
>> >>>
>> >>>> I'm OK to add missing code to my tests,
>> >>>> but I'm not sure what need to be added :(
>> >>>>
>> >>>> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <
>> solomax666@gmail.com>
>> >>>> wrote:
>> >>>>
>> >>>>> I see no errors,
>> >>>>> Using debugger I can see tomcat.server.state == STARTED
>> >>>>>
>> >>>>> Everything works as expected if I'm switching back to 8.5.23 without
>> >> any
>> >>>>> other changes
>> >>>>>
>> >>>>> nestat reports:
>> >>>>> *netstat -an |grep 8080*
>> >>>>> tcp6       0      0 :::8080                 :::*
>> >>>>> LISTEN
>> >>>>>
>> >>>>> for 8.5.23
>> >>>>>
>> >>>>>
>> >>>>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org>
>> wrote:
>> >>>>>
>> >>>>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
>> >>>>>>> Hello,
>> >>>>>>>
>> >>>>>>> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
>> >>>>>>> Everything works as expected except tests :(
>> >>>>>>>
>> >>>>>>> I'm using following code to start embedded Tomcat and test CXF web
>> >>>>>> services [1].
>> >>>>>>> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is
>> not
>> >>>>>>> being listened
>> >>>>>>> What need to be changed?
>> >>>>>>
>> >>>>>> If Tomcat isn't listening then there should be an exception or
>> error
>> >>>>>> message reported at some point. Do you see anything in the logs?
>> >>>>>>
>> >>>>>> Mark
>> >>>>>>
>> >>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> [1] https://github.com/apache/openmeetings/blob/master/openmeeti
>> >>>>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
>> >>>>>> AbstractWebServiceTest.java#L98
>> >>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> ------------------------------------------------------------
>> ---------
>> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>>>>>
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>> WBR
>> >>>>> Maxim aka solomax
>> >>>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> WBR
>> >>>> Maxim aka solomax
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > WBR
>> > Maxim aka solomax
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Maxim Solodovnik <so...@gmail.com>.
OK :)
I finally found the difference :)))

Tomcat.java 8.5.23:
    public void start() throws LifecycleException {
        getServer();
        getConnector();
        server.start();
    }

Tomcat.java 9.0.1:
    public void start() throws LifecycleException {
        getServer();
        server.start();
    }

This is why Tomcat 9.0.2 has no connectors ....
Is it bug or feature?


On Wed, Nov 8, 2017 at 12:07 AM, Tobias Soloschenko <
tobiassoloschenko@googlemail.com> wrote:

> Hi Maxim,
>
> same for me I just created a simple setup like this:
>
>         String baseDir =".";
>         String webappDirLocation = "src/main/webapp/";
>         String webxmlDirLocation = "src/main/webapp/WEB-INF/web.xml";
>         Tomcat tomcat = new Tomcat();
>         tomcat.setPort(8080);
>         tomcat.setBaseDir(baseDir);
>         tomcat.getHost().setAppBase(baseDir);
>         tomcat.getHost().setDeployOnStartup(true);
>         tomcat.getHost().setAutoDeploy(true);
>         tomcat.enableNaming();
>         StandardContext ctx = (StandardContext)
> tomcat.addWebapp("/project", new File(webappDirLocation).
> getAbsolutePath());
>         File additionWebInfClasses = new File("target/classes");
>         WebResourceRoot resources = new StandardRoot(ctx);
>         resources.addPreResources(new DirResourceSet(resources,
> "/WEB-INF/classes",
>                 additionWebInfClasses.getAbsolutePath(), "/"));
>         ctx.setResources(resources);
>         ctx.setDefaultWebXml(new File(webxmlDirLocation).
> getAbsolutePath());
>         tomcat.start();
>         tomcat.getServer().await();
>
> I just placed in a Servlet into my classpath and applied the mapping in
> the web.xml - with the dependencies of tomcat-embed-core and
> tomcat-embed-jasper of version 9.0.1 it is not working and with 8.5.23 it
> does.
>
> Here is the log of both.
>
> 8.5.23
>
> Nov. 07, 2017 6:02:44 NACHM. org.apache.coyote.AbstractProtocol init
> INFORMATION: Initializing ProtocolHandler ["http-nio-8080"]
> Nov. 07, 2017 6:02:44 NACHM. org.apache.tomcat.util.net.NioSelectorPool
> getSharedSelector
> INFORMATION: Using a shared selector for servlet write/read
> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardService
> startInternal
> INFORMATION: Starting service [Tomcat]
> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardEngine
> startInternal
> INFORMATION: Starting Servlet Engine: Apache Tomcat/8.5.23
> Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.startup.ContextConfig
> getDefaultWebXmlFragment
> INFORMATION: No global web.xml found
> Nov. 07, 2017 6:02:45 NACHM. org.apache.coyote.AbstractProtocol start
> INFORMATION: Starting ProtocolHandler ["http-nio-8080“]
>
> 9.0.1
>
> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardService
> startInternal
> INFORMATION: Starting service [Tomcat]
> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardEngine
> startInternal
> INFORMATION: Starting Servlet Engine: Apache Tomcat/9.0.1
> Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.startup.ContextConfig
> getDefaultWebXmlFragment
> INFORMATION: No global web.xml found
>
> kind regards
>
> Tobias
>
> > Am 07.11.2017 um 15:56 schrieb Maxim Solodovnik <so...@gmail.com>:
> >
> > Thanks for the hints :)
> >
> > I have created sample project: https://github.com/solomax/
> tomcat-from-java
> >
> > I have compared detailed logs.
> >
> > Following lines appears in logs while Tomcat8 is used
> >         Nov 07, 2017 9:1 PM org.apache.catalina.util.LifecycleBase
> > setStateInternal
> >         FINE: Setting state for [Connector[HTTP/1.1-8080]] to
> > [INITIALIZING]
> >         Nov 07, 2017 9:1 PM org.apache.tomcat.util.modeler.Registry
> > registerComponent
> >         FINE: Managed= Tomcat:type=Connector,port=8080
> >
> > These lines are missing while Tomcat9 is used
> >
> > Maybe you can tell me why?
> >
> > On Mon, Nov 6, 2017 at 7:55 PM, Mark Thomas <ma...@apache.org> wrote:
> >
> >> On 04/11/17 15:25, Maxim Solodovnik wrote:
> >>> Maybe I can set breakpoint somewhere? and check what is wrong?
> >>> Could you point me to the correct class?
> >>
> >> No idea where to look at this point. I'd probably start with the start()
> >> method and go from there.
> >>
> >> Maybe try turning on debug logging?
> >>
> >> Mark
> >>
> >>
> >>>
> >>> On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <solomax666@gmail.com
> >
> >>> wrote:
> >>>
> >>>> I'm OK to add missing code to my tests,
> >>>> but I'm not sure what need to be added :(
> >>>>
> >>>> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <
> solomax666@gmail.com>
> >>>> wrote:
> >>>>
> >>>>> I see no errors,
> >>>>> Using debugger I can see tomcat.server.state == STARTED
> >>>>>
> >>>>> Everything works as expected if I'm switching back to 8.5.23 without
> >> any
> >>>>> other changes
> >>>>>
> >>>>> nestat reports:
> >>>>> *netstat -an |grep 8080*
> >>>>> tcp6       0      0 :::8080                 :::*
> >>>>> LISTEN
> >>>>>
> >>>>> for 8.5.23
> >>>>>
> >>>>>
> >>>>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org>
> wrote:
> >>>>>
> >>>>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
> >>>>>>> Hello,
> >>>>>>>
> >>>>>>> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
> >>>>>>> Everything works as expected except tests :(
> >>>>>>>
> >>>>>>> I'm using following code to start embedded Tomcat and test CXF web
> >>>>>> services [1].
> >>>>>>> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is
> not
> >>>>>>> being listened
> >>>>>>> What need to be changed?
> >>>>>>
> >>>>>> If Tomcat isn't listening then there should be an exception or error
> >>>>>> message reported at some point. Do you see anything in the logs?
> >>>>>>
> >>>>>> Mark
> >>>>>>
> >>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> [1] https://github.com/apache/openmeetings/blob/master/openmeeti
> >>>>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
> >>>>>> AbstractWebServiceTest.java#L98
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>> ------------------------------------------------------------
> ---------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> WBR
> >>>>> Maxim aka solomax
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> WBR
> >>>> Maxim aka solomax
> >>>>
> >>>
> >>>
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
> > --
> > WBR
> > Maxim aka solomax
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
WBR
Maxim aka solomax

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi Maxim,

same for me I just created a simple setup like this:

	String baseDir =".";
        String webappDirLocation = "src/main/webapp/";
        String webxmlDirLocation = "src/main/webapp/WEB-INF/web.xml";
        Tomcat tomcat = new Tomcat();
        tomcat.setPort(8080);
        tomcat.setBaseDir(baseDir);
        tomcat.getHost().setAppBase(baseDir);
        tomcat.getHost().setDeployOnStartup(true);
        tomcat.getHost().setAutoDeploy(true);
        tomcat.enableNaming();
        StandardContext ctx = (StandardContext) tomcat.addWebapp("/project", new File(webappDirLocation).getAbsolutePath());
        File additionWebInfClasses = new File("target/classes");
        WebResourceRoot resources = new StandardRoot(ctx);
        resources.addPreResources(new DirResourceSet(resources, "/WEB-INF/classes",
                additionWebInfClasses.getAbsolutePath(), "/"));
        ctx.setResources(resources);
        ctx.setDefaultWebXml(new File(webxmlDirLocation).getAbsolutePath());
        tomcat.start();
        tomcat.getServer().await();

I just placed in a Servlet into my classpath and applied the mapping in the web.xml - with the dependencies of tomcat-embed-core and tomcat-embed-jasper of version 9.0.1 it is not working and with 8.5.23 it does.

Here is the log of both.

8.5.23

Nov. 07, 2017 6:02:44 NACHM. org.apache.coyote.AbstractProtocol init
INFORMATION: Initializing ProtocolHandler ["http-nio-8080"]
Nov. 07, 2017 6:02:44 NACHM. org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMATION: Using a shared selector for servlet write/read
Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardService startInternal
INFORMATION: Starting service [Tomcat]
Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.core.StandardEngine startInternal
INFORMATION: Starting Servlet Engine: Apache Tomcat/8.5.23
Nov. 07, 2017 6:02:44 NACHM. org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFORMATION: No global web.xml found
Nov. 07, 2017 6:02:45 NACHM. org.apache.coyote.AbstractProtocol start
INFORMATION: Starting ProtocolHandler ["http-nio-8080“]

9.0.1

Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardService startInternal
INFORMATION: Starting service [Tomcat]
Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.core.StandardEngine startInternal
INFORMATION: Starting Servlet Engine: Apache Tomcat/9.0.1
Nov. 07, 2017 6:06:56 NACHM. org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFORMATION: No global web.xml found

kind regards

Tobias

> Am 07.11.2017 um 15:56 schrieb Maxim Solodovnik <so...@gmail.com>:
> 
> Thanks for the hints :)
> 
> I have created sample project: https://github.com/solomax/tomcat-from-java
> 
> I have compared detailed logs.
> 
> Following lines appears in logs while Tomcat8 is used
>         Nov 07, 2017 9:1 PM org.apache.catalina.util.LifecycleBase
> setStateInternal
>         FINE: Setting state for [Connector[HTTP/1.1-8080]] to
> [INITIALIZING]
>         Nov 07, 2017 9:1 PM org.apache.tomcat.util.modeler.Registry
> registerComponent
>         FINE: Managed= Tomcat:type=Connector,port=8080
> 
> These lines are missing while Tomcat9 is used
> 
> Maybe you can tell me why?
> 
> On Mon, Nov 6, 2017 at 7:55 PM, Mark Thomas <ma...@apache.org> wrote:
> 
>> On 04/11/17 15:25, Maxim Solodovnik wrote:
>>> Maybe I can set breakpoint somewhere? and check what is wrong?
>>> Could you point me to the correct class?
>> 
>> No idea where to look at this point. I'd probably start with the start()
>> method and go from there.
>> 
>> Maybe try turning on debug logging?
>> 
>> Mark
>> 
>> 
>>> 
>>> On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <so...@gmail.com>
>>> wrote:
>>> 
>>>> I'm OK to add missing code to my tests,
>>>> but I'm not sure what need to be added :(
>>>> 
>>>> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <so...@gmail.com>
>>>> wrote:
>>>> 
>>>>> I see no errors,
>>>>> Using debugger I can see tomcat.server.state == STARTED
>>>>> 
>>>>> Everything works as expected if I'm switching back to 8.5.23 without
>> any
>>>>> other changes
>>>>> 
>>>>> nestat reports:
>>>>> *netstat -an |grep 8080*
>>>>> tcp6       0      0 :::8080                 :::*
>>>>> LISTEN
>>>>> 
>>>>> for 8.5.23
>>>>> 
>>>>> 
>>>>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org> wrote:
>>>>> 
>>>>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
>>>>>>> Hello,
>>>>>>> 
>>>>>>> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
>>>>>>> Everything works as expected except tests :(
>>>>>>> 
>>>>>>> I'm using following code to start embedded Tomcat and test CXF web
>>>>>> services [1].
>>>>>>> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is not
>>>>>>> being listened
>>>>>>> What need to be changed?
>>>>>> 
>>>>>> If Tomcat isn't listening then there should be an exception or error
>>>>>> message reported at some point. Do you see anything in the logs?
>>>>>> 
>>>>>> Mark
>>>>>> 
>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> [1] https://github.com/apache/openmeetings/blob/master/openmeeti
>>>>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
>>>>>> AbstractWebServiceTest.java#L98
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> WBR
>>>>> Maxim aka solomax
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> WBR
>>>> Maxim aka solomax
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>> 
> 
> 
> -- 
> WBR
> Maxim aka solomax


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks for the hints :)

I have created sample project: https://github.com/solomax/tomcat-from-java

I have compared detailed logs.

Following lines appears in logs while Tomcat8 is used
         Nov 07, 2017 9:1 PM org.apache.catalina.util.LifecycleBase
setStateInternal
         FINE: Setting state for [Connector[HTTP/1.1-8080]] to
[INITIALIZING]
         Nov 07, 2017 9:1 PM org.apache.tomcat.util.modeler.Registry
registerComponent
         FINE: Managed= Tomcat:type=Connector,port=8080

These lines are missing while Tomcat9 is used

Maybe you can tell me why?

On Mon, Nov 6, 2017 at 7:55 PM, Mark Thomas <ma...@apache.org> wrote:

> On 04/11/17 15:25, Maxim Solodovnik wrote:
> > Maybe I can set breakpoint somewhere? and check what is wrong?
> > Could you point me to the correct class?
>
> No idea where to look at this point. I'd probably start with the start()
> method and go from there.
>
> Maybe try turning on debug logging?
>
> Mark
>
>
> >
> > On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> >> I'm OK to add missing code to my tests,
> >> but I'm not sure what need to be added :(
> >>
> >> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <so...@gmail.com>
> >> wrote:
> >>
> >>> I see no errors,
> >>> Using debugger I can see tomcat.server.state == STARTED
> >>>
> >>> Everything works as expected if I'm switching back to 8.5.23 without
> any
> >>> other changes
> >>>
> >>> nestat reports:
> >>> *netstat -an |grep 8080*
> >>> tcp6       0      0 :::8080                 :::*
> >>>  LISTEN
> >>>
> >>> for 8.5.23
> >>>
> >>>
> >>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org> wrote:
> >>>
> >>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
> >>>>> Hello,
> >>>>>
> >>>>> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
> >>>>> Everything works as expected except tests :(
> >>>>>
> >>>>> I'm using following code to start embedded Tomcat and test CXF web
> >>>> services [1].
> >>>>> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is not
> >>>>> being listened
> >>>>> What need to be changed?
> >>>>
> >>>> If Tomcat isn't listening then there should be an exception or error
> >>>> message reported at some point. Do you see anything in the logs?
> >>>>
> >>>> Mark
> >>>>
> >>>>
> >>>>>
> >>>>>
> >>>>> [1] https://github.com/apache/openmeetings/blob/master/openmeeti
> >>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
> >>>> AbstractWebServiceTest.java#L98
> >>>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> WBR
> >>> Maxim aka solomax
> >>>
> >>
> >>
> >>
> >> --
> >> WBR
> >> Maxim aka solomax
> >>
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
WBR
Maxim aka solomax

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Mark Thomas <ma...@apache.org>.
On 04/11/17 15:25, Maxim Solodovnik wrote:
> Maybe I can set breakpoint somewhere? and check what is wrong?
> Could you point me to the correct class?

No idea where to look at this point. I'd probably start with the start()
method and go from there.

Maybe try turning on debug logging?

Mark


> 
> On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <so...@gmail.com>
> wrote:
> 
>> I'm OK to add missing code to my tests,
>> but I'm not sure what need to be added :(
>>
>> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <so...@gmail.com>
>> wrote:
>>
>>> I see no errors,
>>> Using debugger I can see tomcat.server.state == STARTED
>>>
>>> Everything works as expected if I'm switching back to 8.5.23 without any
>>> other changes
>>>
>>> nestat reports:
>>> *netstat -an |grep 8080*
>>> tcp6       0      0 :::8080                 :::*
>>>  LISTEN
>>>
>>> for 8.5.23
>>>
>>>
>>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org> wrote:
>>>
>>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
>>>>> Hello,
>>>>>
>>>>> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
>>>>> Everything works as expected except tests :(
>>>>>
>>>>> I'm using following code to start embedded Tomcat and test CXF web
>>>> services [1].
>>>>> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is not
>>>>> being listened
>>>>> What need to be changed?
>>>>
>>>> If Tomcat isn't listening then there should be an exception or error
>>>> message reported at some point. Do you see anything in the logs?
>>>>
>>>> Mark
>>>>
>>>>
>>>>>
>>>>>
>>>>> [1] https://github.com/apache/openmeetings/blob/master/openmeeti
>>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
>>>> AbstractWebServiceTest.java#L98
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>
>>>
>>> --
>>> WBR
>>> Maxim aka solomax
>>>
>>
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Maxim Solodovnik <so...@gmail.com>.
Maybe I can set breakpoint somewhere? and check what is wrong?
Could you point me to the correct class?

On Fri, Nov 3, 2017 at 5:26 PM, Maxim Solodovnik <so...@gmail.com>
wrote:

> I'm OK to add missing code to my tests,
> but I'm not sure what need to be added :(
>
> On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
>> I see no errors,
>> Using debugger I can see tomcat.server.state == STARTED
>>
>> Everything works as expected if I'm switching back to 8.5.23 without any
>> other changes
>>
>> nestat reports:
>> *netstat -an |grep 8080*
>> tcp6       0      0 :::8080                 :::*
>>  LISTEN
>>
>> for 8.5.23
>>
>>
>> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org> wrote:
>>
>>> On 03/11/17 04:51, Maxim Solodovnik wrote:
>>> > Hello,
>>> >
>>> > I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
>>> > Everything works as expected except tests :(
>>> >
>>> > I'm using following code to start embedded Tomcat and test CXF web
>>> services [1].
>>> > With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is not
>>> > being listened
>>> > What need to be changed?
>>>
>>> If Tomcat isn't listening then there should be an exception or error
>>> message reported at some point. Do you see anything in the logs?
>>>
>>> Mark
>>>
>>>
>>> >
>>> >
>>> > [1] https://github.com/apache/openmeetings/blob/master/openmeeti
>>> ngs-web/src/test/java/org/apache/openmeetings/webservice/
>>> AbstractWebServiceTest.java#L98
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>
>
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Maxim Solodovnik <so...@gmail.com>.
I'm OK to add missing code to my tests,
but I'm not sure what need to be added :(

On Fri, Nov 3, 2017 at 3:24 PM, Maxim Solodovnik <so...@gmail.com>
wrote:

> I see no errors,
> Using debugger I can see tomcat.server.state == STARTED
>
> Everything works as expected if I'm switching back to 8.5.23 without any
> other changes
>
> nestat reports:
> *netstat -an |grep 8080*
> tcp6       0      0 :::8080                 :::*                    LISTEN
>
> for 8.5.23
>
>
> On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 03/11/17 04:51, Maxim Solodovnik wrote:
>> > Hello,
>> >
>> > I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
>> > Everything works as expected except tests :(
>> >
>> > I'm using following code to start embedded Tomcat and test CXF web
>> services [1].
>> > With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is not
>> > being listened
>> > What need to be changed?
>>
>> If Tomcat isn't listening then there should be an exception or error
>> message reported at some point. Do you see anything in the logs?
>>
>> Mark
>>
>>
>> >
>> >
>> > [1] https://github.com/apache/openmeetings/blob/master/openmeeti
>> ngs-web/src/test/java/org/apache/openmeetings/webservice
>> /AbstractWebServiceTest.java#L98
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Maxim Solodovnik <so...@gmail.com>.
I see no errors,
Using debugger I can see tomcat.server.state == STARTED

Everything works as expected if I'm switching back to 8.5.23 without any
other changes

nestat reports:
*netstat -an |grep 8080*
tcp6       0      0 :::8080                 :::*                    LISTEN

for 8.5.23


On Fri, Nov 3, 2017 at 3:08 PM, Mark Thomas <ma...@apache.org> wrote:

> On 03/11/17 04:51, Maxim Solodovnik wrote:
> > Hello,
> >
> > I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
> > Everything works as expected except tests :(
> >
> > I'm using following code to start embedded Tomcat and test CXF web
> services [1].
> > With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is not
> > being listened
> > What need to be changed?
>
> If Tomcat isn't listening then there should be an exception or error
> message reported at some point. Do you see anything in the logs?
>
> Mark
>
>
> >
> >
> > [1] https://github.com/apache/openmeetings/blob/master/
> openmeetings-web/src/test/java/org/apache/openmeetings/webservice/
> AbstractWebServiceTest.java#L98
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
WBR
Maxim aka solomax

Re: Start embedded Tomcat 9.0.1 server from java code

Posted by Mark Thomas <ma...@apache.org>.
On 03/11/17 04:51, Maxim Solodovnik wrote:
> Hello,
> 
> I recently migrated from Tomcat 8.5.23 to Tomcat 9.0.1
> Everything works as expected except tests :(
> 
> I'm using following code to start embedded Tomcat and test CXF web services [1].
> With Tomcat 9.0.1 tests failed, netstat -an displays port 8080 is not
> being listened
> What need to be changed?

If Tomcat isn't listening then there should be an exception or error
message reported at some point. Do you see anything in the logs?

Mark


> 
> 
> [1] https://github.com/apache/openmeetings/blob/master/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java#L98
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org