将atlassian-agent.jar文件放到随便某个地方,例如Bitbucket目录下,Windows上比如:
1 |
C:\Atlassian\Bitbucket\6.5.1 |
然后想办法把
1 |
-javaagent:/path/to/atlassian-agent.jar |
加到启动脚本里。Confluence和Jira一般是在setenv.sh或setenv.bat中,但Bitbucket没有setenv.sh或setenv.bat。如果是Windows环境下且以服务方式启动的话,则需要使用Configure Bitbucket Service提供的工具修改(当然,如果是以服务方式启动的话Confluence和Jira改setenv.bat也没用,参考文档3),单纯改脚本是没用的(How to update the JVM configuration for a Windows service,https://confluence.atlassian.com/bitbucketserverkb/how-to-update-the-jvm-configuration-for-a-windows-service-800715342.html):
启动报错:
这个错在atlassian-agent的issue里面有人提到:
于是根据文档下源码编译,将
1 2 3 4 5 6 |
<dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> <scope>provided</scope> </dependency> |
改为provided,然后mvn package并使用其中的atlassian-agent-jar-with-dependencies.jar(重命名一下就行)。
不过,这个报错的具体原因还是要去看日志:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdAliasDao': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sharedHomeLockAcquirer' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:676) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at java.lang.Thread.run(Unknown Source) ... 18 frames trimmed Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sharedHomeLockAcquirer' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778) ... 5 common frames omitted Caused by: java.lang.IllegalArgumentException: null at com.atlassian.stash.internal.license.DefaultLicenseHelper.decode(DefaultLicenseHelper.java:71) at com.atlassian.stash.internal.license.DefaultLicenseHelper.getDecoded(DefaultLicenseHelper.java:85) at com.atlassian.stash.internal.license.DefaultLicenseHelper.isClusteringEnabled(DefaultLicenseHelper.java:90) at com.atlassian.stash.internal.home.SharedHomeLockAcquirer.isSharedLockRequired(SharedHomeLockAcquirer.java:106) at com.atlassian.stash.internal.home.SharedHomeLockAcquirer.createHomeLock(SharedHomeLockAcquirer.java:96) at com.atlassian.stash.internal.home.HomeLockAcquirer.lock(HomeLockAcquirer.java:56) ... 5 common frames omitted |
可以看到是授权解析相关的异常,如果是曾经安装过授权的话就会这样。
首先生成新的授权:
参数中的-m和-o会显示在授权信息中。
然后再修改已有的授权。至于如何修改已有的授权,可以根据官网文档:How to find the license key in the Bitbucket Server database,https://confluence.atlassian.com/bitbucketserverkb/how-to-find-the-license-key-in-the-bitbucket-server-database-938849661.html,执行对应的SQL即可:
1 |
select prop_value as "license_key" from app_property where prop_key = 'license'; |
如果是用的是嵌入式数据库的话,可以根据官网文档:Accessing Bitbucket Server’s H2 embedded database,https://confluence.atlassian.com/bitbucketserverkb/accessing-bitbucket-server-s-h2-embedded-database-833935557.html
如果是Linux操作系统的话,启停服务可以用:
1 2 3 |
# service atlbitbucket status # service atlbitbucket stop # service atlbitbucket start |
或位于
1 |
root@atlassian:/opt/atlassian/bitbucket/7.11.1/bin# ll |
的脚本:
1 2 |
bin/start-bitbucket.sh bin/stop-bitbucket.sh |
其中的start-bitbucket.sh最后实际调用的是_start-webapp.sh,我们要加的-javaagent参数也是加到这里:
执行service atlbitbucket start重启启动Bitbucket,然后通过ps -elf观察启动命令是否带上了agent:
注意,如果配过一次,那么在加这个参数可能无效,需要到/var下面把Bitbucket的home文件夹下内容删掉重新初始化。
如果启动不起来的话,多关注日志,可能是路径配错了之类的(建议放到bin下面,之前直接放到/root/atlassian-agent.jar下似乎有问题):
1 2 3 4 5 6 7 8 9 10 11 |
root@atlassian:/var/atlassian/application-data/bitbucket/log# ll total 20 drwxr-xr-x 3 atlbitbucket atlbitbucket 4096 Apr 1 21:19 ./ drwxr-xr-x 12 atlbitbucket atlbitbucket 4096 Apr 1 20:57 ../ -rw-r--r-- 1 atlbitbucket atlbitbucket 5 Apr 1 21:20 bitbucket.pid -rw-r--r-- 1 atlbitbucket atlbitbucket 159 Apr 1 21:17 launcher.log drwxr-xr-x 2 atlbitbucket atlbitbucket 4096 Apr 1 21:20 search/ root@atlassian:/var/atlassian/application-data/bitbucket/log# cat launcher.log Error opening zip file or JAR manifest missing : /root/atlassian-agent.jar Error occurred during initialization of VM agent library failed to init: instrument |
另外,参考文档中提到:
试过编辑start-bitbucket.sh脚本和.bashrc文件,启动后agent都没有正常加载,所以这里配置环境变量选择在/etc/profile文件中配置,打开/etc/profile文件,在最后一行添加如下内容:
export JAVA_OPTS=”-javaagent:{你的Bitbucket安装目录}/bin/atlassian-agent.jar ${JAVA_OPTS}”
如果要破解插件的话,可以看一眼参数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
C:\Atlassian\Bitbucket\6.5.1>java -jar atlassian-agent.jar ==================================================== ======= Atlassian Crack Agent ======= ======= https://zhile.io ======= ======= QQ Group: 30347511 ======= ==================================================== KeyGen usage: java -jar /C:/Atlassian/Bitbucket/6.5.1/atlassian-agent.jar [-d] [-h] -m <arg> [-n <arg>] -o <arg> -p <arg> -s <arg> -d,--datacenter Data center license[default: false] -h,--help Print help message -m,--mail <arg> License email -n,--name <arg> License name[default: <license email>] -o,--organisation <arg> License organisation -p,--product <arg> License product, support: [crowd: Crowd] [questions: Questions plugin for Confluence] [crucible: Crucible] [capture: Capture plugin for JIRA] [conf: Confluence] [training: Training plugin for JIRA] [*: Third party plugin key, looks like: com.foo.bar] [bitbucket: Bitbucket] [tc: Team Calendars plugin for Confluence] [bamboo: Bamboo] [fisheye: FishEye] [portfolio: Portfolio plugin for JIRA] [jc: JIRA Core] [jsd: JIRA Service Desk] [jira: JIRA Software(common jira)] -s,--serverid <arg> License server ID ================================================================================ # Crack agent usage: append -javaagent arg to system environment: JAVA_OPTS. # Example(execute this command or append it to setenv.sh/setenv.bat file): export JAVA_OPTS="-javaagent:/C:/Atlassian/Bitbucket/6.5.1/atlassian-agent.jar ${JAVA_OPTS}" # Then start your confluence/jira server. |
只要把-p后面的内容换成插件对应的App key的就行了,不要用单引号包含,例如:
1 |
C:\Atlassian\Bitbucket\6.5.1>java -jar atlassian-agent.jar -m test@163.com -o test -p com.plugin.commitgraph.commitgraph -s BI4V-XXXX-XXXX-XXXX |
参考资料:
1、https://blog.csdn.net/sdujava2011/article/details/113371636
2、https://gitee.com/pengzhile/atlassian-agent
3、https://confluence.atlassian.com/confkb/how-to-set-system-properties-for-confluence-running-as-a-service-on-windows-873858384.html
转载时请保留出处,违法转载追究到底:进城务工人员小梅 » Bitbucket 6.5.1、7.11.1破解
截图中启动报错吧jaxb.api 的version 改成2.2.12 就好了
大佬可以提供一下最新 bitbucket 可用的重新编译后的atlassian-agent.jar 文件吗?非常感谢!