There are several connectors for the Java application platform. Please select one from the list on the left.
Core Java Jexbox connector hooks into Thread.UncaughtExceptionHandler, so any uncaught exceptions in your application will be sent to your Jexbox database.
The connector extracts complete exception stack trace, including nested exceptions, error message and system properties
How to Install
Configuration
Send Catched Exceptions to Jexbox
jexbox.send(e);
Sending Custom Data With Exceptions
If your want to send additional meta-data to Jexbox about the exception, you can use the following method:
public void sendWithMeta(Throwable e, Map<String, Map<String, String>> metaD)
Each Map<String, String> will appear in Jexbox exception data page as separate tab.
The Web applications connector is an extension to the core Java connector. It add methods which accept HttpServletRequest & HttpSession, so the current request and session data is sent to Jexbox.
How to Install
Maven: Add jexbox-http as a dependency in the application pom.xml
<dependency>
<groupId>com.jexbox.connector</groupId>
<artifactId>jexbox-http</artifactId>
</dependency>
Manual Jar Installation
Download the latest jexbox-http-0.0.1.jar and place it in the applications classpath.
The connector depends on
jexbox-core-0.0.1.jar
com.google.code.gson
javax.servlet API
public void send(Throwable e, HttpServletRequest request);
public void sendWithMeta(Throwable e, HttpServletRequest request, Map<String, Map<String, String<< metaD);
How to Install
We suggest to declare Jexbox as tapestry service in application module as follow
public static JexboxConnectorHttp build(@Symbol(SymbolConstants.PRODUCTION_MODE) boolean productionMode)
{
Properties props = new Properties();
props.put("appId", "copy here your application ID, available in www.jexbox.com admin panel");
props.put("background", "false");
JexboxConnectorHttpImpl notifier = new JexboxConnectorHttpImpl(props);
return notifier;
}
Then to handle automatically non-catched exceptions you will need to decorate RequestExceptionHandler as follow
public RequestExceptionHandler decorateRequestExceptionHandler(final RequestExceptionHandler delegate, final JexboxConnectorHttpImpl jexbox, final RequestGlobals request, final ExceptionAnalyzer analyzer)
{
return new JexboxRequestExceptionHandler(delegate,jexbox, request, analyzer);
}
To send catched exceptions, you should inject JexboxWeb in your page as follow
@Inject protected JexboxConnectorHttp _jexbox;
...
...
...
} catch (Exception e) {
_jexbox.send(e, getRequestGlobals().getHTTPServletRequest());
}
How to Install
Then to handle automatically non-catched exceptions you will need to decorate ExceptionHandlerFactory in faces-config.xml as follow
<factory>
<exception-handler-factory>
com.jexbox.example.jsf.ExampleJexboxExceptionHandlerFactory
</exception-handler-factory>
</factory>
ExampleJexboxExceptionHandlerFactory inherit JexboxExceptionHandlerFactory and look like below
public class ExampleJexboxExceptionHandlerFactory extends JexboxExceptionHandlerFactory{
public ExampleJexboxExceptionHandlerFactory(ExceptionHandlerFactory parent) {
super(parent);
}
protected JexboxConnectorHttp createJexboxConnectorHttp() {
Properties props = new Properties();
props.put("appId", "copy here your application ID, available in www.jexbox.com admin panel");
JexboxConnectorHttpImpl jexbox = new JexboxConnectorHttpImpl(props);
return jexbox;
}
}
To send catched exceptions from page beans
...
...
...
} catch (Exception e) {
FacesContext fc = FacesContext.getCurrentInstance();
JexboxExceptionHandler eh = (JexboxExceptionHandler) fc.getExceptionHandler();
eh.handle(fc, e);
}
How to Install
The Play! Framework connector is implemented as plug-in for Play! applications and can be declared in conf/play.plugins file as follow
10000:com.jexbox.connector.play.JexboxConnectorPlayPlugin
Then to handle automatically non-catched exceptions, decoration of the GlobalSettings will be required in applicaiton Global class
public Promise<Result> onError(RequestHeader request, Throwable t) {
Session session = Http.Context.current().session();
JexboxConnectorPlayPlugin jbp = Play.application().plugin(JexboxConnectorPlayPlugin.class);
jbp.getJexboxConnector().send(t, request, session);
return super.onError(request, t);
}
Then the connector should be configured with settings in the con/application.conf file as follow
#Required
com.jexbox.connector.play.app-id=copy here the application ID, available in www.jexbox.com admin panel
#Optional
com.jexbox.connector.play.host=
com.jexbox.connector.play.environment=
com.jexbox.connector.play.ssl=
com.jexbox.connector.play.appVersion=
com.jexbox.connector.play.background=
com.jexbox.connector.play.proxyHost=
com.jexbox.connector.play.proxyPort=
com.jexbox.connector.play.useSystemProxy=
To send catched exceptions, the instance of Jexbox connector can be obtained in application controllers as follow
...
...
...
} catch (Throwable e) {
Session session = Http.Context.current().session();
Request request = Http.Context.current().request();
JexboxConnectorPlayPlugin jbp = Play.application().plugin(JexboxConnectorPlayPlugin.class);
jbp.getJexboxConnector().send(t, request, session);
}
How to Install
Maven: Add jexbox-http as a dependency in the application pom.xml
<dependency>
<groupId>com.jexbox.connector</groupId>
<artifactId>jexbox-http</artifactId>
</dependency>
Manual Jar Installation
Download the latest jexbox-http-0.0.1.jar and place it in the applications classpath.
The connector depends on
jexbox-core-0.0.1.jar
com.google.code.gson
javax.servlet API
Then to handle automatically non-catched exceptions you will need to decorate HandlerExceptionResolver as follow
@Configuration
public class AppConfiguration {
@Bean
@Scope("singleton")
protected JexboxConnectorHttp jexbox() {
Properties props = new Properties();
props.put("appId", "copy here your application ID, available in www.jexbox.com admin panel");
JexboxConnectorHttpImpl jexbox = new JexboxConnectorHttpImpl(props);
return jexbox;
}
@Bean(name="simpleMappingExceptionResolver")
public SimpleMappingExceptionResolver createSimpleMappingExceptionResolver() {
JexboxMappingExceptionResolver r = new JexboxMappingExceptionResolver(jexbox());
return r;
}
}
JexboxMappingExceptionResolver inherit SimpleMappingExceptionResolver and look like below
public class JexboxMappingExceptionResolver extends SimpleMappingExceptionResolver {
private JexboxConnectorHttp _jexbox;
public JexboxMappingExceptionResolver(JexboxConnectorHttp jexbox) {
super();
_jexbox = jexbox;
}
@Override
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception exception)
{
_jexbox.send(exception, request);
ModelAndView mav = super.doResolveException(request, response, handler, exception);
return mav;
}
}
To send catched exceptions from controllers
@RestController
public class SampleController {
@Autowired
@Qualifier("jexbox")
private JexboxConnectorHttp _jexbox;
@RequestMapping("/")
String index(HttpServletRequest request) {
try {
if(true) throw new RuntimeException("Lets see how Jexbox will catch it!");
} catch (Exception e) {
_jexbox.send(e, request);
}
return "Hello World Ceco!";
}
}