Re: [stardog-users] Java Servlet Container

0 views
Skip to first unread message

Mike Grove

unread,
Aug 22, 2012, 12:05:37 PM8/22/12
to sta...@clarkparsia.com


On Wed, Aug 22, 2012 at 11:30 AM, safrant <saf...@gmail.com> wrote:
Excuse the noobosity, but you mention in your documentation (http://www.stardog.com/docs/network/#http) that Stardog can be dropped into a Java Servlet Container.  Can you hand-hold me a little on how this would be done?  I am trying to put in on JBoss and can't just drop the folder in.  I could package it and build my own web.xml from scratch, but suspect there is an easier way.

That's an outdated bit of documentation.  Earlier versions could be dropped into a servlet container, but this was before we wrote a dedicated database server for Stardog, so now that is not possible.  

In theory, you could roll your own by using the Stardog embedded server and writing a wrapper Servlet around that which you could drop into a servlet container, but that's not something I'd recommend, the provided database server will be a much better option.  But if you have a requirement that it works with a servlet container, it should be possible.

I'll make sure the documentation is updated for the next release to reflect the recent state of things.

Thanks.

Mike
 

Thanks,

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
 
 

Al Baker

unread,
Aug 22, 2012, 7:56:40 PM8/22/12
to sta...@clarkparsia.com
To do the 'your own server' option, you could pick up Stardog Spring support, use one of the autoloading Spring servlet's, e.g. DispatcherServlet, and then configure the DataSourceFactory bean to create the embedded database.  This would be a 'no code' option, you would just need the web.xml, Spring applicationContext.xml, and packaging everything up in a war file. 

Here's a gradle file to get you started:
https://gist.github.com/3430658

After that, then:
1. Put web.xml in src/main/webapp/WEB-INF, likely put a load-on-startup on your servlet to make it immediately available
2. Place applicationContext.xml in same location
3. Configure the dataSource in applicationContext
4. Run 'gradle war' and create the war, drop in Tomcat and enjoy.  STARDOG_HOME will still have to be set, but the stardog.home JVM parameter is useful for this

Note the gradle build will pick up all Stardog jars and drop in WEB-INF/lib on its war packaging, so if there are any conflicts with the app server, you would want to adjust appropriately.

Al
Reply all
Reply to author
Forward
0 new messages