Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] The compiled software package cannot run after the directory is moved #23872

Closed
2 of 3 tasks
Joforde opened this issue Jan 21, 2025 · 2 comments
Closed
2 of 3 tasks
Labels
type/bug The PR fixed a bug or issue reported a bug

Comments

@Joforde
Copy link

Joforde commented Jan 21, 2025

Search before asking

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

Version

any released version

Minimal reproduce step

build broker

mvn -pl pulsar-broker package -DskipTests
// verify ok
bin/pulsar standalone

rename or move pulsar software package

cd ../;mv pulsar-4.0.1 pulsar;cd pulsar;
// verify failed
bin/pulsar standalone

What did you expect to see?

broker started success

What did you see instead?

Error: Could not find or load main class org.apache.pulsar.PulsarStandaloneStarter
Caused by: java.lang.ClassNotFoundException: org.apache.pulsar.PulsarStandaloneStarter

Anything else?

When compiling, Pulsar caches the absolute path of the JAR package into the classpath.txt.
like:
/home/xxx/pulsar-4.0.1/pulsar-broker/target/pulsar-broker.jar:

When starting the service, Pulsar reads the file that contains the cached absolute paths of the JAR packages:

pulsar/bin/pulsar

Lines 199 to 223 in e5bd774

add_maven_deps_to_classpath() {
MVN="mvn"
if [ "$MAVEN_HOME" != "" ]; then
MVN=${MAVEN_HOME}/bin/mvn
fi
# Need to generate classpath from maven pom. This is costly so generate it
# and cache it. Save the file into our target dir so a mvn clean will get
# clean it up and force us create a new one.
f="${PULSAR_HOME}/distribution/server/target/classpath.txt"
if [ ! -f "${f}" ]
then
(
cd "${PULSAR_HOME}"
${MVN} -pl distribution/server generate-sources &> /dev/null
)
fi
PULSAR_CLASSPATH=${CLASSPATH}:`cat "${f}"`
}
if [ -d "$PULSAR_HOME/lib" ]; then
PULSAR_CLASSPATH=$PULSAR_CLASSPATH:$PULSAR_HOME/lib/*
else
add_maven_deps_to_classpath
fi

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@Joforde Joforde added the type/bug The PR fixed a bug or issue reported a bug label Jan 21, 2025
@lhotari
Copy link
Member

lhotari commented Jan 22, 2025

Thanks for reporting the issue @Joforde.
The solution for running Pulsar in the build directory is only intended for development.
The software package is available after building in distribution/server/target/apache-pulsar-*-bin.tar.gz.
You can extract this to the location where you want to install Pulsar locally.

@Joforde
Copy link
Author

Joforde commented Jan 23, 2025

Thanks for reporting the issue @Joforde. The solution for running Pulsar in the build directory is only intended for development. The software package is available after building in distribution/server/target/apache-pulsar-*-bin.tar.gz. You can extract this to the location where you want to install Pulsar locally.

So that's it, I learned, thank you for your reply

@Joforde Joforde closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

No branches or pull requests

2 participants