403 error while deploying with tomcat client deployer - deployment

I have some trouble using Tomcat Client Deployer (TCD) with a local Tomcat installation. Specifically, I get a 403 error while trying to deploy a simple helloworld web application which leads me to the conclusion that something is not quite right with my tomcat-users.xml.
I just cannot see what it is.
here's the relevant build.xml snippet:
<!-- Configure the folder and context path for this application -->
<property name="webapp" value="helloworld"/>
<property name="path" value="/helloworld"/>
<!-- Configure properties to access the Manager application -->
<property name="url" value="http://localhost:8080/manager/text"/>
<property name="username" value="deploymgr"/>
<property name="password" value="s3cret"/>
tomcat-users.xml:
</tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="tomcat"/>
<user username="deploymgr" password="s3cret" roles="manager-script"/>
<user username="tomcat" password="tomcat" roles="tomcat, manager-gui, manager-jmx, manager-status"/>
</tomcat-users>
deployer.properties:
build=D:/apache-tomcat-7.0.16-deployer/work
webapp=D:/apache-tomcat-7.0.16-deployer/helloworld/
path=/helloworld
url=http://localhost:8080/manager
username=deploymgr
password=s3cret
and when I try to deploy the application, I get the following error message:
D:\apache-tomcat-7.0.16-deployer>ant deploy
Buildfile: D:\apache-tomcat-7.0.16-deployer\build.xml
Trying to override old definition of datatype resources
deploy:
[echo] name: deploymgr, pass: s3cret, url: http://localhost:8080/manager
BUILD FAILED
D:\apache-tomcat-7.0.16-deployer\build.xml:92: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2Fhelloworld&update=true
only thing I find weird is that the error message URL contains a "%2F" instead of a forward slash... could it be that the user configuration is actually correct, I get the 403 simply because of the URL escape code? (I'm working under Windows Vista)
Can someone help me out on this? Oh, and of course the application deploys flawlessly through the user interface :-1
Thanks very much in advance.

perhaps an update on this issue... I've made a mistake in the deployer.properties file. The parameter "url" has to be the same as in build.xml above.
deployer.properties correctly:
build=D:/apache-tomcat-7.0.16-deployer/work
webapp=D:/apache-tomcat-7.0.16-deployer/helloworld/
path=/helloworld
url=http://localhost:8080/manager/text
username=deploymgr
password=s3cret
now it works!

Related

Unable to register Kie Server with Kie Workbench

"I'm setting up Kie Workbench 7.5 and Kie Server 7.5 both into tomcat 8.
But "Remote Servers" is showing blank list.
For installation reference I used http://blog.athico.com/2015/10/installing-kie-server-and-workbench-on.html this blog.
Once I hit http://localhost:8080/kie-server/services/rest/server this URL I am getting expected output as below:
<response type="SUCCESS" msg="Kie Server info">
<kie-server-info>
<capabilities>KieServer</capabilities>
<capabilities>BRM</capabilities>
<capabilities>BPM</capabilities>
<capabilities>CaseMgmt</capabilities>
<capabilities>BPM-UI</capabilities>
<capabilities>BRP</capabilities>
<capabilities>DMN</capabilities>
<capabilities>Swagger</capabilities>
<location>
http://localhost:8080/kie-server/services/rest/server
</location>
<name>tomcat-kieserver</name>
<id>tomcat-kieserver</id>
<version>7.5.0.Final</version>
</kie-server-info>
</response>
Configuration which I proviced
1. setenv.bat
set CATALINA_OPTS=-Xmx512M -Djbpm.tsr.jndi.lookup=java:comp/env/TransactionSynchronizationRegistry -Dorg.kie.server.persistence.ds=java:comp/env/jdbc/jbpm -Djbpm.tm.jndi.lookup=java:comp/env/TransactionManager -Dorg.kie.server.persistence.tm=JBossTS -Dhibernate.connection.release_mode=after_transaction -Dorg.kie.server.id=tomcat-kieserver -Djava.security.auth.login.config=C:/softwares/apache-tomcat-8.5.43/webapps/kie-drools-wb/WEB-INF/classes/login.config -Dorg.kie.server.location=http://localhost:8080/kie-server/services/rest/server -Dorg.kie.server.controller=http://localhost:8080/kie-drools-wb/rest/controller -Dcom.arjuna.ats.jta.recovery.XAResourceRecovery1=com.arjuna.ats.internal.jdbc.recovery.BasicXARecovery;abs://C:/softwares/apache-tomcat-8.5.43/conf/xa-recovery-properties.xml
2. server.xml
<Valve className="org.kie.integration.tomcat.JACCValve" />
3. context.xml
<Resource name="sharedDataSource"
auth="Container"
type="org.h2.jdbcx.JdbcDataSource"
user="sa"
password="sa"
url="jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MVCC=TRUE"
description="H2 Data Source"
loginTimeout="0"
testOnBorrow="false"
factory="org.h2.jdbcx.JdbcDataSourceFactory"/>
4. xa-recovery-properties.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="DB_1_DatabaseUser">sa</entry>
<entry key="DB_1_DatabasePassword">sa</entry>
<entry key="DB_1_DatabaseDynamicClass"></entry>
<entry key="DB_1_DatabaseURL">java:comp/env/h2DataSource</entry>
</properties>
On Tomcat console I am getting below warning:
WARNING [KieServer-ControllerConnect] org.kie.server.services.impl.controller.DefaultRestControllerImpl.connectToSingleController Exception encountered while syncing with controller at http://localhost:8080/kie-drools-wb/rest/controller/server/tomcat-kieserver error Error while sending PUT request to http://localhost:8080/kie-drools-wb/rest/controller/server/tomcat-kieserver response code 401
Workbench 7.0+ is not support Tomcat any more. If you want to use Workbench (it is already renamed to Business Central and has latest version 7.24) it should run on Wildfly 14.
You can try this quick start (just unzip file and it is ready to try or copy configurations): https://www.jbpm.org/learn/gettingStarted.html
If you need to start Workbench on Tomcat, you should use 6.x (which is not supported any more).

Cannot get openjpa tools to run from the command line

What I did:
download and extract the latest openjpa release (3.0.0)
download the mariadb jdbc driver jar and copy it to the same directory where openjpa-all-3.0.0.jar is located
inside the same directory, create a subdirectory META_INF and a file META-INF/persistence.xml with the following contents:
<?xml version="1.0"?>
<persistence version="1.0">
<persistence-unit name="openjpa">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<properties>
<property name="openjpa.ConnectionURL" value="jdbc:mariadb://localhost:3306/databasename"/>
<property name="openjpa.ConnectionDriverName" value="org.mariadb.jdbc.Driver"/>
<property name="openjpa.ConnectionUserName" value="dbuser"/>
<property name="openjpa.ConnectionPassword" value="dbpassword"/>
<property name="openjpa.DynamicEnhancementAgent" value="false"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>
<property name="openjpa.Log" value="SQL=TRACE"/>
<property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=120, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000"/>
</properties>
</persistence-unit>
create an empty directory src as a sub-directory of where the openjpa and mariadb driver jars are
ran the following command:
java -cp ./:openjpa-all-3.0.0.jar:mariadb-java-client-2.4.0.jar:openjpa-all-3.0.0.jar org.apache.openjpa.jdbc.meta.ReverseMappingTool -pkg some.package -d ./src
Instead of getting any kind of output, or an error related to generation, I get:
8 INFO [main] openjpa.Tool - The reverse mapping tool will run on the database. The tool is gathering schema information; this process may take some time. Enable the org.apache.openjpa.jdbc.Schema logging category to see messages about schema data.
Exception in thread "main" <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.openjpa.util.UserException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl#f248234b".
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:71)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:850)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:879)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDBCConfigurationImpl.java:921)
at org.apache.openjpa.jdbc.schema.SchemaGenerator.<init>(SchemaGenerator.java:86)
at org.apache.openjpa.jdbc.meta.ReverseMappingTool.run(ReverseMappingTool.java:2027)
at org.apache.openjpa.jdbc.meta.ReverseMappingTool.run(ReverseMappingTool.java:2005)
at org.apache.openjpa.jdbc.meta.ReverseMappingTool.run(ReverseMappingTool.java:1882)
at org.apache.openjpa.jdbc.meta.ReverseMappingTool$1.run(ReverseMappingTool.java:1863)
at org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:762)
at org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:747)
at org.apache.openjpa.jdbc.meta.ReverseMappingTool.main(ReverseMappingTool.java:1858)
What am I doing wrong?
I tried variations of this, by adding -p persistence.xml#openjpa, -p #openjpa and -connectionDriverName org.mariadb.jdbc.Driver to the command line, but it made no difference.

WildFly 10.0.0 RBAC Custom roles

In my project I need to create custom role for WildFly Management as the roles that are predefined are not enough for me. We are using WildFly 10.0.0 in standalone mode (using standalone-full.xml configuration file). Server is running on CentOS Linux 7.
What I need to make is to allow a certain role to manage configuration (e.g. changing logging level) but managing deployments should be restricted. So far I have enabled rbac on server and tried different roles but none of them meets my requirements. I have digged a little bit in the internet and have not found any solution yet. So my question is is there any way to achieve this with the current state (standalone mode, no LDAP)? And if yes, how to do this?
Wildfly supply two way to authrioze, simple and rbac and deafult is simple, so if you want to use rbac, firstly you should configure some role on simple mode, then swith rbac, otherwise you will not login wildfy management web ui:
Bellow is my example configure:
<access-control provider="rbac">
<role-mapping>
<role name="SuperUser">
<include>
<user name="$local"/>
</include>
</role>
<role name="Administrator">
<include>
<user realm="ManagementRealm" name="admin"/>
<user realm="ApplicationRealm" name="sample"/>
</include>
</role>
<role name="Auditor"/>
<role name="Monitor"/>
<role name="Operator"/>
<role name="Deployer">
<include>
<group realm="ApplicationRealm" name="common"/>
<user realm="ApplicationRealm" name="sample"/>
<user realm="ManagementRealm" name="deployer"/>
</include>
</role>
</role-mapping>
</access-control>
you can configure role at management ui: "Access Control" tab
enter image description here
Notice: Please make sure, you have added user by "user-add.sh"

Problems Deploying application to Weblogic through the Admin Console

I'm using Weblogic 10.3.5. When I deploy my Struts2 application locally in eclipse, it runs fine. When I try to deploy my application through the Admin console, I get a Struts 2 error, name not found for action.
When I look at the .war file, it has all the libraries and classes. I followed these directions for deploying through the Admin Console. I can successfully deploy through the Admin Console, but when I try and use the test links for the application, I get the same error. If I try to access the application through the url:
http://localhost:7001/app-name
I get the same error.
Here is the stack trace:
[[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default
(self-tuning)'] WARN org.apache.struts2.dispatcher.Dispatcher - Could
not find action or result: /eServices/login.action There is no Action
mapped for namespace [/] and action name [login] associated with
context path [/eServices]. - [unknown location] at
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
at
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
at
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:552)
at
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at
oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method) at
oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at
oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at
oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at
oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at
oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at
weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
What am I doing wrong? Why can I access the application when I deploy it through eclipse, but I can't access the application when I deploy it through the Admin Console.
Thanks for your help!
Sounds like your struts.xml file in WEB-INF/classes is somehow wrong when you're trying a manual deploy. Crack open your .ear/.war file and see what's in your struts.xml (if it even exists). Eclipse might be automatically putting it into a folder for you that doesn't get deployed when you do it manually. Below is a working example for reference:
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="myAction"
class="com.something.myAction" >
<result name="success">pages/myPage.jsp</result>
</action>
</package>
</struts>
If the project root context is “app-name“, you can access the above action via a URL like –
http://domain:8080/app-name/myAction.action

Problem changing Database in Hibernate

i'm having a problem with hibernate and don't know exactly what's going on, i have this project at work where i connect to an Oracle 10g Database using the following settings:
Host Name: localhost
port:1521
SID:orcl
user:anfxi
password:password
Now i'm at home trying to work with the same database remotely, im connected via VPN and the database ip is now 10.73.98.230 , i imported my WAR and changed the settings in my
hibernate.cfg.xml from:
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin://localhost:1521:orcl</property>
<property name="hibernate.connection.username">anfexi</property>
<property name="connection.password">password</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>
<property name="current_session_context_class">thread</property>
to:
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin://10.73.98.230:1521:orcl</property>
<property name="hibernate.connection.username">anfexi</property>
<property name="connection.password">password</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>
<property name="current_session_context_class">thread</property>
but i keep getting this error:
ERROR [main] (SchemaValidator.java:135) - could not get database metadata
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl
so it seems to be still using localhost as the DB address, i cleaned my project and rebuilt, still with no luck, is there something else that i could be missing? does the hibernate configuration gets cached in some file i have to erase or something?
EDIT
For what it may serve, i can connect using SQL developer,the problem is just hibernate still using the old localhost:1521:orcl Connection descriptor.
Thanks for your help!
Verify that the xml file you are changing in Eclipse is actually being deployed to the server. I run into problems every once in awhile where Eclipse doesn't know it needs to redeploy certain files for my webapp.
If you are using Tomcat and deploying using the workspace metadata (the default), you can check what the actual deployed WAR files look like by looking at your filesystem under:
WORKSPACE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/APPNAME/.../path/to/hibernate.cfg.xml
If you find the config file is NOT being updated, I would recommend undeploying you app in Eclipse, deleting the entire APPNAME directory in the above path, and redeploying clean.
If none of that works, do a project-wide search for "localhost" and see if there could possible be any hardcoded connections strings anywhere.
This kind of problem is usually due to the wrong configuration file being present. Maybe you have two copies of the file and you changed one but the system is using the other
Typically when building/compiling, resources get copied to a target/build folder. Check source folders and build target folders etc.
Search the file system for all files with the name hibernate.cfg.xml or with the contents localhost:1521:orcl
Check the classpath, or try explicitly putting the folder with the configuration file you want first in the classpath.
It can also be a case of some other configuration overriding your configuration, for instance a datasource filer or a persistence.xml-file. Check those if you have them as well.
How are you running your application? Through a test case, standalone console application, servlet/j2ee container?
It is unable to understand the "orcl" SID. May be the SID is present on your "localhost" but not on the server "10.73.98.230". verify you are using the correct SID available on "10.73.98.230".
Try changing this line in your config file.
<property name="hibernate.connection.url">jdbc:oracle:thin:#10.73.98.230:1521:orcl</property>
replace // with #
you can follow the link the have infomation http://www.cryer.co.uk/brian/oracle/ORA12505.htm
Hope this will help