HUBL local development java error

HI i just recently know that it’s possible to develop locally for a template from this link:
designers.hubspot.com

Local HubL server

The HubL developer server allows web developers that are comfortable with markup and the HubL templating language to build and test HubSpot COS templates locally. The server runs 100% locally with no external dependencies. Once running, you will be…

however i encounter an issue when starting the local server.

OS: OSX
Java version: 11

Error
`
➜ local-hubl-server ./bin/local-hubl-server

WARNING: An illegal reflective access operation has occurred

WARNING: Illegal reflective access by org.mockito.cglib.core.ReflectUtils$2 (file:/Users/kendelarama/Downloads/local-hubl-server/lib/local-hubl-server-deps.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

WARNING: Please consider reporting this to the maintainers of org.mockito.cglib.core.ReflectUtils$2

WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

WARNING: All illegal access operations will be denied in a future release

ERROR [2018-10-18 13:38:05,300] jinjava: Error creating injected context function

! javassist.NotFoundException: com.hubspot.content.cyw

! at javassist.ClassPool.get(ClassPool.java:452)

! at com.hubspot.jinjava.lib.fn.InjectedContextFunctionProxy.defineProxy(InjectedContextFunctionProxy.java:31)

! at com.hubspot.content.cwf.a(Unknown Source)

! at com.hubspot.content.cwf$$FastClassByGuice$$38013f99.invoke(<generated>)

! at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:264)

! at com.google.inject.internal.ProviderMethod$Factory.provision(ProviderMethod.java:401)

! at com.google.inject.internal.ProviderMethod$Factory.get(ProviderMethod.java:376)

! at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

! at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)

! at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

! at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194)

! at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)

! at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)

! at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)

! at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:82)

! at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:123)

! at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:117)

! at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)

! at com.google.inject.internal.InjectionRequestProcessor$StaticInjection.injectMembers(InjectionRequestProcessor.java:117)

! at com.google.inject.internal.InjectionRequestProcessor.injectMembers(InjectionRequestProcessor.java:79)

! at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:171)

! at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)

! at com.google.inject.Guice.createInjector(Guice.java:99)

! at com.google.inject.Guice.createInjector(Guice.java:73)

! at com.hubspot.dropwizard.guice.InjectorFactoryImpl.create(Unknown Source)

! at com.hubspot.dropwizard.guice.GuiceBundle.initialize(Unknown Source)

! at com.yammer.dropwizard.config.Bootstrap.addBundle(Bootstrap.java:43)

! at com.hubspot.content.hubl.dev.LocalHubLDevService.initialize(Unknown Source)

! at com.yammer.dropwizard.Service.run(Service.java:59)

! at com.hubspot.content.hubl.dev.LocalHubLDevService.main(Unknown Source)

ERROR [2018-10-18 13:38:05,360] com.hubspot.dropwizard.guice.GuiceBundle: Exception occurred when creating Guice Injector - exiting

! com.google.inject.CreationException: Unable to create injector, see the following errors:

  1. Error in custom provider, java.lang.RuntimeException: javassist.NotFoundException: com.hubspot.content.cyw

at com.hubspot.content.cwf.a(Unknown Source) (via modules: com.hubspot.content.cxx → com.hubspot.content.cwf)

at com.hubspot.content.cwf.a(Unknown Source) (via modules: com.hubspot.content.cxx → com.hubspot.content.cwf)

while locating com.hubspot.jinjava.Jinjava

for the 1st parameter of com.hubspot.content.hubl.util.snippets.Snippets.setJinjava(Unknown Source)

Caused by: java.lang.RuntimeException: javassist.NotFoundException: com.hubspot.content.cyw

at com.google.common.base.Throwables.propagate(Throwables.java:241)

at com.hubspot.jinjava.lib.fn.InjectedContextFunctionProxy.defineProxy(InjectedContextFunctionProxy.java:72)

at com.hubspot.content.cwf.a(Unknown Source)

at com.hubspot.content.cwf$$FastClassByGuice$$38013f99.invoke(<generated>)

at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:264)

at com.google.inject.internal.ProviderMethod$Factory.provision(ProviderMethod.java:401)

at com.google.inject.internal.ProviderMethod$Factory.get(ProviderMethod.java:376)

at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)

at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194)

at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)

at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)

at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)

at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:82)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:123)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:117)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection.injectMembers(InjectionRequestProcessor.java:117)

at com.google.inject.internal.InjectionRequestProcessor.injectMembers(InjectionRequestProcessor.java:79)

at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:171)

at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)

at com.google.inject.Guice.createInjector(Guice.java:99)

at com.google.inject.Guice.createInjector(Guice.java:73)

at com.hubspot.dropwizard.guice.InjectorFactoryImpl.create(Unknown Source)

at com.hubspot.dropwizard.guice.GuiceBundle.initialize(Unknown Source)

at com.yammer.dropwizard.config.Bootstrap.addBundle(Bootstrap.java:43)

at com.hubspot.content.hubl.dev.LocalHubLDevService.initialize(Unknown Source)

at com.yammer.dropwizard.Service.run(Service.java:59)

at com.hubspot.content.hubl.dev.LocalHubLDevService.main(Unknown Source)

Caused by: javassist.NotFoundException: com.hubspot.content.cyw

at javassist.ClassPool.get(ClassPool.java:452)

at com.hubspot.jinjava.lib.fn.InjectedContextFunctionProxy.defineProxy(InjectedContextFunctionProxy.java:31)

… 28 more

  1. Error injecting method, java.lang.ExceptionInInitializerError

at com.hubspot.content.hubl.util.snippets.Snippets.setEnvironment(Unknown Source)

Caused by: java.lang.ExceptionInInitializerError

at com.hubspot.content.hubl.util.snippets.Snippets$$FastClassByGuice$$933d2e00.invoke(<generated>)

at com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:54)

at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:89)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:123)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:117)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection.injectMembers(InjectionRequestProcessor.java:117)

at com.google.inject.internal.InjectionRequestProcessor.injectMembers(InjectionRequestProcessor.java:79)

at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:171)

at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)

at com.google.inject.Guice.createInjector(Guice.java:99)

at com.google.inject.Guice.createInjector(Guice.java:73)

at com.hubspot.dropwizard.guice.InjectorFactoryImpl.create(Unknown Source)

at com.hubspot.dropwizard.guice.GuiceBundle.initialize(Unknown Source)

at com.yammer.dropwizard.config.Bootstrap.addBundle(Bootstrap.java:43)

at com.hubspot.content.hubl.dev.LocalHubLDevService.initialize(Unknown Source)

at com.yammer.dropwizard.Service.run(Service.java:59)

at com.hubspot.content.hubl.dev.LocalHubLDevService.main(Unknown Source)

Caused by: java.lang.RuntimeException: javassist.NotFoundException: com.hubspot.content.hubl.util.snippets.Template

at com.hubspot.content.hubl.util.snippets.Snippets.load(Unknown Source)

at com.hubspot.content.hubl.util.snippets.Snippets.<clinit>(Unknown Source)

… 18 more

Caused by: javassist.NotFoundException: com.hubspot.content.hubl.util.snippets.Template

at javassist.ClassPool.get(ClassPool.java:452)

at com.hubspot.content.hubl.util.snippets.Snippets.loadSnippetTemplate(Unknown Source)

at com.hubspot.content.hubl.util.snippets.Snippets.load(Unknown Source)

… 19 more

2 errors

! at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)

! at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:176)

! at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)

! at com.google.inject.Guice.createInjector(Guice.java:99)

! at com.google.inject.Guice.createInjector(Guice.java:73)

! at com.hubspot.dropwizard.guice.InjectorFactoryImpl.create(Unknown Source)

! at com.hubspot.dropwizard.guice.GuiceBundle.initialize(Unknown Source)

! at com.yammer.dropwizard.config.Bootstrap.addBundle(Bootstrap.java:43)

! at com.hubspot.content.hubl.dev.LocalHubLDevService.initialize(Unknown Source)

! at com.yammer.dropwizard.Service.run(Service.java:59)

! at com.hubspot.content.hubl.dev.LocalHubLDevService.main(Unknown Source)
`

Hope someone can help.

i had to run a docker container to clean install Java.

I’ve been running into the same issue.

Trying to run local hubl server on a new mac.
It seems to be some incompatibility with a java library and JDK version.
Normally I run zsh but I tried in both zsh and bash. Same issue on both.

I really don’t want to figure out how I can do fresh install in docker tho.

Does anyone have the same issue and maybe a better solution?

Hi @beneelen,

for more info. i ran a docker container and install java and cascade it to the team to use since we are using different OS and environments.

i hope below information can help you.

Directory structure:
/project-name
- local-hubl-server (unpack zipped)
- Dockerfile

Dockerfile:
#assuming latest is ubuntu 18.04

FROM ubuntu:16.04

MAINTAINER Ken Dela Rama 

RUN apt update && apt -y upgrade && apt install -y default-jre

####### ADD YOUR OTHER STUFF HERE like copy config.yml or anything

CMD /root/local-hubl-server/bin/local-hubl-server && /bin/bash

EXPOSE 8080

README.md
Go to the directory

Build the Image

> docker build -t local-hubspot .

I prefer the `remove container` after im done

> docker run -rm -it --name local_hubspot -p 8080:8080 -v ${PWD}/local-hubl-server:/root/local-hubl-server local-hubspot

Or use the detached docker container (detached)

> docker run -d -it --name local_hubspot -p 8080:8080 -v ${PWD}/local-hubl-server:/root/local-hubl-server local-hubspot

Stop the container

> docker stop local-hubspot

Start the already ran docker container

> docker start local-hubspot

Access the base directory URL:

> 127.0.0.1:8080 or localhost:8080

@ken_netfluence Thank you very much for outlining your Docker solution to the HubL server issue. I was getting the exact same error you posted originally (“WARNING: An illegal reflective access operation has occurred…”). I’m trying out your method of running HubL with Java inside a Docker container and I’ve almost got it working, however, I’m unable to access the root directory in the browser. When I run

docker run --rm -it --name local_hubspot -p 8080:8080 -v ${PWD}/local-hubl-server:/root/local-hubl-server local-hubspot

from your example it shows that the HubL server spins up properly with this message

INFO [2019-03-05 21:54:16,675] com.yammer.dropwizard.cli.ServerCommand: Starting LocalHubLDevService
INFO [2019-03-05 21:54:17,768] com.hubspot.content.cxu: Local HubL Server started, running at http://127.0.0.1:8080/

But when I try to access http://127.0.0.1:8080/ or localhost:8080 in the browser I get an ERR_EMPTY_RESPONSE message.

I’m new to Docker and I’m sure I’m missing something quite basic here. Any pointer(s) you (or anyone reading) can offer would be greatly appreciated.

Thank you,

Sam