Waiting for namespace handlers - apache-camel

I'm upgrading to Fuse 7.3 and getting new errors in any routes that use CXF.
Blueprint bundle ruleEngineService/5.0.2 is waiting for namespace
handlers [http://camel.apache.org/schema/blueprint]
My blueprint.xml contains the correct schema locations, according to all the documentation. eg. link
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
I haven't changed much since it was working in Fuse 7.0.0.
Features are installed:
cxf | 3.2.7.fuse-731004-redhat-00003 | x | Started | cxf-3.2.7.fuse-731004-redhat-00003 |
camel-cxf | 2.21.0.fuse-731003-redhat-00003 | x | Started | camel-2.21.0.fuse-731003-redhat-00003 |
The things that set this blueprint apart from ones that are resolving are:
<cxf:cxfEndpoint id="myEndpoint" ...>
and
<bean id="myRoute" class="com.application.CxfCamelRoute" />
<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="serviceRoutes">
<routeBuilder ref="myRoute" />
</camelContext>
where CxfCamelRoute contains a reference to cxf://bean:myEndpoint?serviceClass="..."
Regarding blueprint features:
admin#root()> features:list | grep blueprint
kie-aries-blueprint | 7.11.0.Final | | Uninstalled | karaf-features-core-droolsjbpm-7.11.0.Final | KIE Aries Blueprint
camel-blueprint | 2.23.2.fuse-740006 | | Uninstalled | camel-2.23.2.fuse-740006 |
camel-blueprint | 2.21.0.fuse-731003-redhat-00003 | x | Started | camel-2.21.0.fuse-731003-redhat-00003 |
aries-blueprint-spring | 4.3.20.RELEASE_1 | | Uninstalled | spring-legacy-4.2.0.fuse-731003-redhat-00003 |
aries-blueprint | 4.2.0.fuse-731003-redhat-00003 | x | Started | standard-4.2.0.fuse-731003-redhat-00003 | Aries Blueprint
Could it be a conflict between aries-blueprint and camel-blueprint?
I am running out of ideas.

Ok, I seem to have solved it.
I added the repo for KIE (features:addurl mvn:org.kie/kie-karaf-features/7.11.0.Final/xml/features) before doing anything else. The order change fixed my issue. It seems as though KIE 7.11.0.Final adds the following repos:
mvn:org.apache.camel.karaf/apache-camel/RELEASE/xml/features
mvn:org.apache.cxf.karaf/apache-cxf/3.2.7.fuse-sb2-740011/xml/features
The namehandler issue was presumably from some conflict between the Fuse 7.3 libraries, and the latest camel/cxf RELEASE versions.
To me, this feels like a bug, to have KIE 7.11.0.Final use RELEASE features. It clearly has bad consequences. But I don't know another way to make feature:install kie accessible to my Karaf.

Never use RELEASE in maven coordinates. You can end up even with Camel 3, when expecting Camel 2. (Never use LATEST either).
If you use Fuse to install KIE features, you should not install mvn:org.kie/kie-karaf-features/7.11.0.Final/xml/features
First you have to install bridge features that provide feature dependencies for KIE from Fuse:
karaf#root()> feature:repo-add mvn:org.jboss.fuse.features/rhba-features/7.6.0.fuse-760014/xml/features
Adding feature url mvn:org.jboss.fuse.features/rhba-features/7.6.0.fuse-760014/xml/features
Then you have ton install Fuse variant of Kie features. Not this one, but this one
The description in kie-karaf-features-7.11.0.Final-features-fuse.xml is a bit older than current Fuse, because the feature artifactId has changed:
In order to install the below features into Fuse 7, target runtime needs to provide these features:
- drools7-dependencies
- jbpm7-dependencies
- optaplanner-dependencies
- kie7-remote-dependencies
- db-dependencies
- hibernate-dependencies
- hibernate-validator-dependencies
These features are contained in some repository not referenced explicitly with <repository> (loose coupling).
Fuse 7 specific repository is 'mvn:org.jboss.fuse.features/brms-features/VERSION/xml/features'
So here's the command:
karaf#root()> feature:repo-add mvn:org.kie/kie-karaf-features/7.11.0.Final/xml/features-fuse
Adding feature url mvn:org.kie/kie-karaf-features/7.11.0.Final/xml/features-fuse
karaf#root()> feature:list|grep kie
kie │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │ KIE API
kie-ci │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │ KIE CI
kie-spring │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │ KIE Spring
kie-aries-blueprint │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │ KIE Aries Blueprint
kie-camel │ 7.11.0.Final │ │ Uninstalled │ karaf-features-core-droolsjbpm-7.11.0.Final │
kie-dmn │ 7.11.0.Final │ │ Uninstalled │ karaf-features-fuse-droolsjbpm-7.11.0.Final │ Kie DMN
kie-server-client │ 7.11.0.Final │ │ Uninstalled │ karaf-features-fuse-droolsjbpm-7.11.0.Final │ KIE Server Client
servlet-api-kie │ 7.11.0.Final │ │ Uninstalled │ karaf-features-fuse-droolsjbpm-7.11.0.Final │
kie-pmml │ 7.11.0.Final │ │ Uninstalled │ karaf-features-fuse-droolsjbpm-7.11.0.Final │
kie7-remote-dependencies │ 0.0.0 │ │ Uninstalled │ fuse-features-dependencies-droolsjbpm-7.6.0.fuse-760014 │

Related

Importing Apache Commons dbcp2 in Apache Karaf [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 months ago.
Improve this question
I have imported my Apache Camel blueprint xml bundle into Apache Karaf. When I try to start the bundle, it is complaining about dbcp2. I've tried to bundle it into my Apache Karaf but still no luck. The error I am getting:
Error executing command: Error executing command on bundles:
Error starting bundle 129: Unable to resolve xxx.yyy [129](R 129.0): missing
requirement [xxx.yyy [129](R 129.0)] osgi.wiring.package; (&
(osgi.wiring.package=org.apache.commons.dbcp2)(version>=2.9.0)(!(version>=3.0.0)))
[caused by: Unable to resolve org.apache.commons.commons-dbcp2 [119](R 119.0): missing
requirement [org.apache.commons.commons-dbcp2 [119](R 119.0)] osgi.wiring.package; (&
(osgi.wiring.package=javax.transaction)(version>=1.1.0))] Unresolved requirements:
[[xxx.yyy [129](R 129.0)] osgi.wiring.package; (&
(osgi.wiring.package=org.apache.commons.dbcp2)(version>=2.9.0)(!(version>=3.0.0)))]
I am not sure if the problem is the dbcp2 or the javax.transaction.
I've bundled both into my Apache Karaf therefore as shown here:
119 │ Installed │ 80 │ 2.9.0 │ Apache Commons DBCP
120 │ Resolved │ 80 │ 20220320.0.0 │ JSON in Java
129 │ Installed │ 80 │ 0.0.1.SNAPSHOT │ Route for xxxxx (my bundle)
131 │ Resolved │ 80 │ 0 │ wrap_mvn_javax.transaction_jta_1.1
My pom file in my bundle imports dbcp2 as shown here:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.9.0</version>
</dependency>
After trying out a bit of different bundles,
I've found out that bundle:install transaction fixed it.

Serving a Vite.js React project with a FastAPI backend via Docker

I have a project that uses a fastapi backend and a vite.js React front end. I currently have each dockerized as image.
Is there a way I can get fastapi to serve the vite projects static files so I don't have to have two images.
I have seen this https://fastapi.tiangolo.com/tutorial/static-files/ but not sure if that's what I need or would it be like
from fastapi.staticfiles import StaticFiles
load_dotenv() # take environment variables from .env.
app = FastAPI()
# serves static files from the /frontend/dist directory
app.mount("/frontend", StaticFiles(directory="frontend/dist"), name="frontend")
I have ran the above and got error RuntimeError: Directory 'frontend/dist' does not exist
I have my vite project in frontend I ran the vite build command which produced a dist folder with my static files inside. This is my current structure
.
├── README.md
├── backend
│ ├── Dockerfile
│ ├── Pipfile
│ ├── Pipfile.lock
│ └── main.py
└── frontend
├── Dockerfile
├── dist
│ ├── assets
│ │ ├── favicon.17e50649.svg
│ │ ├── index.1cd49a68.js
│ │ └── index.30ea237b.css
│ └── index.html
├── index.html
├── package-lock.json
├── package.json
├── postcss.config.js
├── src
│ ├── App.jsx
│ ├── favicon.svg
│ ├── index.css
│ ├── logo.svg
│ └── main.jsx
├── tailwind.config.js
└── vite.config.js
After MadsLindh suggested the change, I was able to start the fastapi server from within the backend directory but now I get
> uvicorn main:app --reload
INFO: Will watch for changes in these directories: ['/Users/paul/Desktop/deal_query_ui/backend']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [79530] using WatchFiles
INFO: Started server process [79532]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:63011 - "GET / HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63012 - "GET /apple-touch-icon-precomposed.png HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63012 - "GET /apple-touch-icon.png HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63013 - "GET /favicon.ico HTTP/1.1" 404 Not Found
I even tried to go to http://127.0.0.1:8000/frontend/ but nothing I get the same {"detail":"Not Found"}
Docker
I went on to then create a Dockerfile within the root
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.8-slim
EXPOSE 80
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY ./backend/Pipfile ./backend/Pipfile.lock ./
RUN python -m pip install --upgrade pip
RUN pip install pipenv && pipenv install --dev --system --deploy
WORKDIR /app
COPY . /app
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "80"]
When running this locally I get the error
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 407, in main
run(
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 575, in run
server.run()
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 67, in serve
config.load()
File "/usr/local/lib/python3.8/site-packages/uvicorn/config.py", line 479, in load
self.loaded_app = import_from_string(self.app)
File "/usr/local/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/./backend/main.py", line 14, in <module>
app.mount("/frontend", StaticFiles(directory="../frontend/dist"), name="frontend")
File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
raise RuntimeError(f"Directory '{directory}' does not exist")
RuntimeError: Directory '../frontend/dist' does not exist
Which from my experience doesn't make sense to me as I could get the server up and running from within the BE directory.

workspaces internal error when running "yarn dev"

I have a project I cloned from GitHub that was created in Vite+react+tailwind
When I run “yarn dev” I receive the following error
Internal Error: PROJECTNAME#workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
at AF.getCandidates (/Users/name/.yarn/releases/yarn-3.1.1.cjs:437:4421)
at pd.getCandidates (/Users/name/.yarn/releases/yarn-3.1.1.cjs:432:5275)
at /Users/name/.yarn/releases/yarn-3.1.1.cjs:441:7674
at du (/Users/name/.yarn/releases/yarn-3.1.1.cjs:382:4003)
at R (/Users/name/.yarn/releases/yarn-3.1.1.cjs:441:7654)
Then, when I run “yarn install” here is what I get
➤ YN0000: ┌ Resolution step
➤ YN0035: │ #noirgallery/restless#npm:^0.7.0: The remote server failed to provide the requested resource
➤ YN0035: │ Response Code: 404 (Not Found)
➤ YN0035: │ Request Method: GET
➤ YN0035: │ Request URL: https://registry.yarnpkg.com/#noirgallery%2frestless
➤ YN0000: └ Completed in 0s 670ms
➤ YN0000: Failed with errors in 0s 675ms
➤ YN0032: fsevents#npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0061: sane#npm:4.1.0 is deprecated: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
➤ YN0061: resolve-url#npm:0.2.1 is deprecated: https://github.com/lydell/resolve-url#deprecated
➤ YN0061: urix#npm:0.1.0 is deprecated: Please see https://github.com/lydell/urix#deprecated
➤ YN0061: core-js#npm:1.2.7 is deprecated: core-js#<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
And then if I run “yarn dev” again, this just repeats.

How Would I Retrieve All Git Commit SHA-1 Hashes Deployed to AppEngine Using the CLI?

The "Versions" page in the AppEngine section of the GCP console here displays a table containing all of the git commit SHA-1 hashes that have been deployed for a given AppEngine Service.
How would I display this list using the gcloud CLI?
You are able to generate the table you're looking for using the app group within the gcloud CLI.
Here is an example table with some formatting and asc. sorting:
gcloud app versions list \
--format="table[box](last_deployed_time.datetime:label=DEPLOYED, version.id:label=GIT_COMMIT_HASH)" \
--service=$GAE_SERVICE_NAME \
--sort-by=DEPLOYED
#=>
┌───────────────────────────┬──────────────────────────────────────────┐
│ DEPLOYED │ GIT_COMMIT_HASH │
├───────────────────────────┼──────────────────────────────────────────┤
│ 1970-01-01 00:00:00-00:00 │ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx │
│ . . . │ . . . │
│ . . . │ . . . │
│ . . . │ . . . │
│ 1970-01-01 00:00:01-00:00 │ yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy │
└───────────────────────────┴──────────────────────────────────────────┘

Routes not starting in Karaf 4.1.1 but runs in ServiceMix

I am using a simple camel-spring project which has a file route to copy from one location to another. But when i deploy the bundle and even the bundle is in Active State, not sure why the routes are not starting. Below are the dependent bundles i have started.
28 │ Active │ 80 │ 4.1.1 │ Apache Karaf :: OSGi Services :: Event
53 │ Active │ 80 │ 2.19.1 │ camel-commands-core
54 │ Active │ 50 │ 2.19.1 │ camel-core
55 │ Active │ 80 │ 2.19.1 │ camel-karaf-commands
59 │ Active │ 50 │ 2.19.1 │ camel-spring
68 │ Active │ 80 │ 1.0.0.SNAPSHOT │ A Camel Spring Route
But when i use the same Camel Spring Route bundle to install in Apache Service Mix , I see in the route-list that my routes are started and working fine. Do i need to have any other bundles to be start for my route bundle to work .
Please follow the link to take a look into the bundle.
Link to Download Bundle
Here is the Image of the simple project
Below the details from service mix which works.
karaf#root>list | grep Active
43 | Active | 50 | 2.16.5 | camel-core
47 | Active | 50 | 2.16.5 | camel-spring
49 | Active | 80 | 2.16.5 | camel-karaf-commands
224 | Active | 80 | 1.0.0.SNAPSHOT | A Camel Spring Route
Thanks in advance.
You need to install the camel-spring-dm feature in Karaf 4.1.1, eg feature:install camel-spring-dm. Also mind spring-dm is deprecated / dead so its not recommended to be used. Use OSGi Blueprint instead if you want to do XML routes in Karaf/ServiceMix with Camel.
In karaf 4.1.1 spring dm is not present by default. You need to first do
feature:repo-add spring-legacy 4.1.1

Resources