hi im attempting to use apatche 4..1 while using publish methode in this example however i got HttpEntity ClassNotFound exception

You aren't correclty such as the httpcore jar to your class path. Are you currently running it as being a jar, webapp or simply application via some IDE?

Edit: According to your comment.

ClassNotFoundException: org.apache.commons.logging.LogFactory

Thats your reason. Im presuming httpcore uses LogFactory and you're simply excluding it inside your classpath. Search for commons-logging.jar and can include that inside your classpath too.