flipkart-incubator / phantom

Phantom is a high performance proxy for accessing distributed services. It is an RPC system with support for different transports and protocols. Phantom is inspired by Twitter Finagle clients and builds on the capabilities of technologies like Netty, Unix Domain Sockets, Netflix Hystrix and Spring. Phantom proxies have been used to serve several hundred million API calls in production deployments at Flipkart.
49 stars 27 forks source link

Phantom sample-http-proxy not running with error in bootstrap sequence #56

Closed Kuntal-G closed 8 years ago

Kuntal-G commented 8 years ago

While running phantom sample-http-proxy there are few issues after successful build of Phantom with different version of Trooper dependencies:

Running with the Command given in getting started:

java -cp "./target/lib/*" org.trpr.platform.runtime.impl.bootstrap.BootstrapLauncher ./src/main/resources/external/bootstrap.xml

With org.trpr.version - 1.3.3

1) First Error -- Error initializing logging framework!. Error message : org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

Solved: I solved it by manually removing slf4j-log4j12-1.7.5.jar from target/lib of sample-http-proxy. But it should be excluded from POM.

2) Second Error : Bean property 'componentContainerClassName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

Solved: I solved it by commenting out property componentContainerClassName in bootstrap.xml as i checked in the source code of Trooper and didnot find the attribute in Bootstrap class

https://github.com/regunathb/Trooper/blob/master/runtime-core/src/main/java/org/trpr/platform/runtime/spi/bootstrap/BootstrapInfo.java

After fixing this two issues, im able to run properly,here's the output

\ Trooper runtime Bootstrap start ** Using logging config file : /home/kuntal/knowledge/bigdata/phantom/sample-http-proxy/./src/main/resources/external/logback.xml 16:58:15.834 [main] INFO o.t.p.r.i.bootstrap.spring.Bootstrap - Logging framework is now initialized! 16:58:15.943 [main] INFO o.s.c.s.FileSystemXmlApplicationContext - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@73871392: startup date [Sun Mar 20 16:58:15 IST 2016]; root of context hierarchy 16:58:15.983 [main] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from URL [file:/home/kuntal/knowledge/bigdata/phantom/sample-http-proxy/./src/main/resources/external/bootstrap.xml] 16:58:16.113 [main] INFO o.t.p.r.i.c.s.SpringContainerImpl - Initializing Bootstrap extension .... ~TrprPlatformCommonBeansContext~ 16:58:16.113 [main] INFO o.t.p.r.i.c.s.SpringContainerImpl - No component container configured for this runtime instance. 16:58:16.115 [main] INFO o.t.p.r.i.bootstrap.spring.Bootstrap -


Trooper **/ \ Runtime Nature : SERVER / **/ Component Container : None / / \ Startup Time : 409 ms / / Host Name: kuntal-Lenovo-G500 /


16:58:16.115 [main] INFO o.t.p.r.i.bootstrap.spring.Bootstrap - \ Trooper Bootstrap complete **

But now when i'm trying to run the below commands, nothing is happening:

http://localhost:8080 http://localhost:8081/admin/dashboard http://localhost:8081/admin/configuration

I checked with _netstat _ command and nothing is listening on this ports.

I faced the same issues of the above ( logback cast exception and spring invalid attributes) Logback issue was fixed similar to above, but even after commenting the spring attributes, im getting this error:

\ Trooper runtime Bootstrap start Using logging config file : /home/kuntal/knowledge/bigdata/phantom/sample-http-proxy/./src/main/resources/external/logback.xml 16:51:47.314 [main] INFO o.t.p.r.i.bootstrap.spring.Bootstrap - Logging framework is now initialized! 16:51:47.423 [main] INFO o.s.c.s.FileSystemXmlApplicationContext - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@2916117f: startup date [Sun Mar 20 16:51:47 IST 2016]; root of context hierarchy 16:51:47.462 [main] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from URL [file:/home/kuntal/knowledge/bigdata/phantom/sample-http-proxy/./src/main/resources/external/bootstrap.xml] 16:51:47.609 [main] INFO o.t.p.r.i.c.s.SpringContainerImpl - Initializing Bootstrap extension .... ~TrprPlatformCommonBeansContext~ 16:51:47.613 [main] ERROR o.t.p.r.i.bootstrap.spring.Bootstrap - Fatal error in bootstrap sequence. Cannot continue! java.lang.NullPointerException: null at org.trpr.platform.runtime.impl.container.spring.SpringContainerImpl.init(SpringContainerImpl.java:89) ~[runtime-core-1.3.4.jar:na] at org.trpr.platform.runtime.impl.bootstrap.spring.Bootstrap.start(Bootstrap.java:254) ~[runtime-core-1.3.4.jar:na] at org.trpr.platform.runtime.impl.bootstrap.spring.Bootstrap.init(Bootstrap.java:136) ~[runtime-core-1.3.4.jar:na] at org.trpr.platform.runtime.impl.bootstrap.BootstrapLauncher.main(BootstrapLauncher.java:39) [runtime-core-1.3.4.jar:na] Fatal error in bootstrap sequence. Cannot continue! java.lang.NullPointerException at org.trpr.platform.runtime.impl.container.spring.SpringContainerImpl.init(SpringContainerImpl.java:89) at org.trpr.platform.runtime.impl.bootstrap.spring.Bootstrap.start(Bootstrap.java:254) at org.trpr.platform.runtime.impl.bootstrap.spring.Bootstrap.init(Bootstrap.java:136) at org.trpr.platform.runtime.impl.bootstrap.BootstrapLauncher.main(BootstrapLauncher.java:39) \ Trooper runtime shutdown initiated.... \ Trooper runtime Stopping....**

In brief ,i couldn't run Phantom by using trooper version 1.3.4</org.trpr.version>

regunathb commented 8 years ago

The changes you have done may not be needed at all. Can you please check if you have any additional jars in your classpath before you run Phantom? Also by removing the componentContainerClassName in bootstrap.xml, you are effectively removing the proxy from bootstrapping and that explains why you don't get to see anything post start up.

Kuntal-G commented 8 years ago

I have checked there is no additional jars in classpath. May be I will check the phantom build on different machine(fresh new) and will let you know soon.

regunathb commented 8 years ago

Closing this issue due to inactivity.