Apache ODE示例无法运行及内存泄漏问题咨询
Let's break down your problems step by step and work through solutions for each one:
1. Fixing Process Deployment & Sendsoap Errors
First, let's tackle why your examples won't run and the sendsoap tool is throwing a class-not-found error:
Process Placement Mistake
You're placing raw example files directly into /var/lib/tomcat/webapps/ode/WEB-INF/processes, but ODE requires processes to be packaged as Business Archive (BAR) files (or ZIP files renamed to .bar). Here's how to fix this:
- For the official helloWorld example, collect all required files (BPEL definition, WSDL,
deploy.xmldescriptor) into a single folder. - Zip the folder, then rename the zip file to
helloWorld.bar. - Move this
.barfile into/var/lib/tomcat/webapps/ode/WEB-INF/processes, then restart Tomcat. ODE will automatically scan and deploy this archive on startup.
Sendsoap Classpath Issue
The sendsoap tool needs access to ODE's dependency JARs to run correctly—you can't just drop the bin directory into Tomcat's ode webapp. Instead:
- Use the
sendsoap.shscript from the original ODE download package'sbindirectory (not the one you copied to Tomcat). This script is pre-configured with the correct classpath. - If you need to run the command manually, specify the full classpath like this:
Replacejava -cp "/path/to/ode-install/lib/*:/path/to/ode-install/tools/sendsoap/lib/*" org.apache.ode.tools.sendsoap.cline.HttpSoapSender http://localhost:8080/ode/processes/helloWorld testRequest.soap/path/to/ode-installwith the actual path where you extracted the ODE zip file.
2. Getting Processes to Show Up in the ODE Web UI
The ODE web interface only displays processes that have been successfully deployed. After packaging your process as a .bar file and placing it in the correct directory:
- Check Tomcat's
catalina.outlog for lines like:Deployed process {http://your-namespace}helloWorld
- If you see this line, the process is deployed and should appear in the web UI. If not, double-check your
deploy.xmldescriptor and ensure all required files are included in the BAR archive.
3. Resolving Memory Leak Warnings
The memory leak warnings you're seeing are common with ODE 1.3.7's default embedded Derby database on Tomcat. Here are two ways to fix this:
Switch to an External Database (Recommended)
Embedded Derby isn't ideal for consistent development because it doesn't clean up resources properly when Tomcat stops. Switch to MySQL or PostgreSQL instead:
- Create a database named
odein your external DB. - Edit
/var/lib/tomcat/webapps/ode/WEB-INF/conf/ode-config.xmlto replace the default Derby datasource with your external DB config. For MySQL, it would look like this:<data-source name="ode-ds" provider="tomcat"> <param name="driverClassName" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/ode?createDatabaseIfNotExist=true"/> <param name="username" value="your-db-username"/> <param name="password" value="your-db-password"/> <param name="maxActive" value="20"/> <param name="maxIdle" value="5"/> </data-source> - Download the MySQL JDBC driver JAR and place it in
/var/lib/tomcat/webapps/ode/WEB-INF/lib. - Restart Tomcat—Derby-related memory leaks should disappear.
Fix Derby Resource Cleanup (If You Must Use It)
If you want to stick with Derby, configure Tomcat to manage the datasource instead of ODE:
- Add this resource to Tomcat's
conf/context.xml:<Resource name="jdbc/ODE" auth="Container" type="javax.sql.DataSource" driverClassName="org.apache.derby.jdbc.ClientDriver" url="jdbc:derby://localhost:1527/ode;create=true" username="sa" password="" maxTotal="20" maxIdle="10" maxWaitMillis="-1"/> - Update
ode-config.xmlto use this container-managed datasource. This lets Tomcat handle resource cleanup when the web app stops, preventing leaks.
Final Verification Steps
- Restart Tomcat and check
catalina.outfor successful deployment logs. - Visit
http://localhost:8080/ode/#/—your deployed processes should now appear in the service list. - Use
sendsoap.sh(or a tool like SoapUI) to send a test request to your process, and verify it responds correctly.
内容的提问来源于stack exchange,提问作者fa__

