This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Mr.David Shapiro

Ranch Hand
+ Follow
since Apr 18, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mr.David Shapiro

I am exhausted. I have tried for a couple days now to get something working with REST service.

I am making a non-gui REST solution used to receive from whatever REST client people will use some json to create a ticket. I did not plan to run this in Tomcat or Weblogic. The issue is it receives the JSON and then shows the content on stdout, but it then throws if I just try and put String ticket in :

Starting http server
May 06, 2016 11:26:41 AM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
com.sas.msds.des.servicenow
May 06, 2016 11:26:42 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class com.sas.msds.des.servicenow.ChangeticketRESTResource
May 06, 2016 11:26:42 AM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
May 06, 2016 11:26:42 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:42 PM'
May 06, 2016 11:26:48 AM com.sun.jersey.spi.container.ContainerRequest getEntity
SEVERE: A message body reader for Java class java.lang.String, and Java type class java.lang.String, and MIME media type applicati
on/json was not found.
The registered message body readers compatible with the MIME media type are: // If I try and receive in POST ChangeTicket ticket instead of String ticket, it complains instead about no writer.
*/* ->
com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider


I have no clue on how to setup providers, message body readers, or message body writers. I am not sure about the right dependencies or order to put them in pom.xml.



It starts a HttpServer and listens on a port.
It has a class called ChangeTicket, which is basically public ChangeTicket() with a lot of set and gets for things to make a ticket. It does have an @override for toString() that returns the json used to make a ticket.

Then, there is a class called ChangeticketRESTResource with:


There is web.xml:



and a pom.xml for maven:




4 years ago
Morning,

Thanks for the response Tim. I see jtds driver mentioned as integrated into Tomcat. I also see mention of something called Realms in server.xml. Unfortunately, it is not clear how to really get from point a to point b with setup if we were using jtds instead and how that then ties back to the database resource setup. It seems to be mixed in with discussion about setting up a domain controller on the same box (yuck).

Is it feasible to use jtds somehow to then use in database resource in context.xml an AD user? Do you have perhaps a little better bit of steps that would actually get you to that point than what is shown in jtds faq or various web pages I see just by attempting to search on tomcat and windows authentication?
5 years ago
Question is on username and setting up a resource to connect to database.

If you have something like the following:

I am not sure what to plug into username= option. Do I put someuser, someuser@domain, or domain\someuser? If I have to put in something like someuser@domain.com, for example, what do I need to setup in Tomcat in addition?

Do I need to worry about setting up windows active directory configuration in servers.xml, web.xml, tomcat-users.xml, etc? Anybody have the ability to provide what would need to get setup if that is the case?
5 years ago
Hello,

I use ajp13 on our dev box with tomcat 6.0.20 on solaris
It is used to not show the port number and to show a standard domain address we use for all apps.
It is working fine in development.

I took the same configuration and tried to set up test environment, but I keep getting

Failure of server APACHE bridge:


--------------------------------------------------------------------------------
No backend server available for connection: timed out after 10 seconds or idempotent set to O

The application is still available if I go directly to the server it is on and use port 8080.

In addition, if I run netstat -a, I see port 8009 listening.
I ran snoop on the server with tomcat and see no attempt by the apache server (located on another server) to even go to D=8009.

On the apache server, I see in its mod_jk.log it sees the following:

[Mon Jan 17 13:03:36 2011][3674:1] [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI '/
apps/jira/*=jira' source 'JkMount'
[Mon Jan 17 13:03:36 2011][3674:1] [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI '/
apps/jira=jira' source 'JkMount'
[Mon Jan 17 13:03:36 2011][3674:1] [debug] jk_map_to_storage::mod_jk.c (3603): no match for /index.html found

This seems to indicate it sees the JkMount rules. The fact snoop does not see any port attempt seems to indicate that it does not even try to go to my tomcat server (or is this not the case?) . I do not think it should try index.html. I think jira uses default.jsp.

Does anybody have any ideas on what I could check or different methods to see what might be going on?

My mod_jk.conf (included in httpd.conf):

<code>
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
# Update this path to match your conf directory location
JkWorkersFile /opt/coolstack/apache2/conf/extra/workers.properties

# Where to put jk logs
# Update this path to match your logs directory location
JkLogFile /opt/coolstack/apache2/logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel debug

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
</code>

Lines in worker.properties:
<code>
worker.list=jira
worker.jira.type=ajp13
worker.jira.host=mistomt01.unx.sas.com
worker.jira.port=8009
</code>


9 years ago

Deepak Bala wrote:You are trying to hack out a mbean so your can reset the datasource ? The JMX documentatin is your best bet. I remember having to do something similar to temporarily suspend a JMS connection factory (or something similar).



I have looked through the documentation. They give no examples on how to do what I am trying. That is why I was hoping somebody here might be able to help.
10 years ago
Hello,

I had code that worked in weblogic 8, but MBeanHome and some other things became deprecated. Now, I am trying to figure out how to reset a datasource in weblogic 10. I have this code:



As you can see I can get the datasource names, and I have a spot there where I have identified one of them I want to reset (i.e., JSF Read (OTT) to Test Reset). I am not sure how to reset though. I tried using invoke, but that did not work. I see something about JDBCServiceRuntimeMBean, but I need an example of how to use JDBCServiceRuntimeMBean.reset() on a specific datasource. There is not an examples I can find out there.
10 years ago
Thanks, I changed id to name. I think the magic fix was that I moved the code that generates the <div>targetDiv</div> that receives the table inside the <form> . This caused some issue because the form had some css style to it that got applied t the code in the targetDiv that I did not want, but I worked those out. It looks like I am back in business!

11 years ago
I have the same thing happening. My case is a little more complicated. I am using innterHTML to create a table that has in the first column (i.e., <td>) an input of checkbox type. I click on submit and the table is generated along with the colum with the checkbox with id="reset". I can put in the input something like: <input type="checkbox" id="reset" onclick="resetvalue(this.value) value="something"> and if I click on the checkbox, it does go to the function I made and show the value that I put in an alert for test purposes. However, String[] reset = getParameterValues("reset") is null if I click on submit again. Any help wuold be appreciated.

11 years ago
The wlINF is my domain name, so you will not have that. But if you do serverRuntime() and then do cd('JDBCServiceRuntime'), what do you have in there? Is it Admin? If I cd('Admin')--in that, wls:/wlINF/serverRuntime/JDBCServiceRuntime/Admin>, I have three directories in there: JDBCDataSourceRuntimeMBeans, JDBCDriverRuntimeMBeans, and JDBCMultiDataSourceRuntimeMBeans. Inside of those directories are nothing. I think that is because there are no JDBC Datasources set up in Admin. I just don't know how to get over to my other instances within wlst in serverRuntime(), but I am not even sure that is the issue either.
11 years ago
The version I am testing on is vesrion 10.0 MP1. If I type serverRuntime() it drops me in wls:/wlINF/ServerRuntime>. wlINF is our domain. If I do an ls(), it shows me a lot of things, one of which is JDBCServiceRuntime. If I cd('JDBCServiceRuntime') and do an ls(), all I see is Admin. Where are the other instances? Do you have any ideas on how to get a reset done with this version? Sigh, and yes, we do have most of the other versions as well, so I will need to know those methods as well.
11 years ago
Hello,

I was asked to make something with WLST to reset connection pools. Unfortunately, there does not seem to be anything easily findable on the web on how to do it. I see things on how to create JDBC resources. There is one thing from somebody doing this:

connect(login,password,url)
serverRuntime()'
cd('JDBCServiceRuntime')
cd('Admin1') # there is no Admin1 on my box, just Admin
cd('JDBCDataSourceRuntimeMBeans')

He lists doing cd into the datasource in the JDBCDataSourceRuntimeMBeans directory, but there are none in that directory on my box. I think it is because
I connected to localhost:7001 (Admin console), but I am not sure that is the issue. I tried connecting to one of the other servers for example localhost:7013, which is
for one of the apps on the box that has connection pools, but it says no server is listening on that port, although looking in the console I do see it running on that port.

Is all resets of pools done from the admin console on 7001 (why do I not see anything in JDBCDataSourceRuntimeMBeans?), or was I right that you needed to connect to the apps port (if so, why does connecting fail?)

Of course, it would be a lot easier if somebody could provide source or a link to some that does resets, but I would like to understand what is going on as well if anybody is willing to share.

Thanks,

David

11 years ago
I am not getting much luck figuring out how to use jaas and login.jsp. I can authenticate on my login.jsp. How do I get it to go back and continue if I determine the authentication was successful? I logincontext.login() successfully, but I am unclear what to put in action= so that it will go back to the page that caused the authentication login page to pop up. I think it was supposed to just automatically redirect on success, but how do I show it authentication was successful? I think it is supposed to be easy, but I am royally confused. Is there something I need to set after I confirm authentication? I even tried to trick it by using jstl to have it parent.back() to the last url, but I think what happens is it goes back to the page that needed authentication and goes hmmm I need to authenticate and sends it back again to the login page. Please help.

David

11 years ago
I really wish there was good examples out on the web. So, eclipse whines that Invalid Security role-name Administrators. I look about and see mention of using weblogic.xml and having something like:



Unfortunatly, when I create this in eclipse under source's WEB-INF, the application will not start up and throws a 404 error. Am I not supposed to create this where I did? Does eclipse have some hidden version of weblogic.xml that I need to modify, or is there something wrong with what I was trying to put in weblogic.xml?

David
11 years ago
Okay, I went through the nightmare of getting examples.security.jaas SAmpleCallbackHandler to work to the point where I can run:



It correctly returns a failed login attempt or a successful login attempt. The web.xml was set up with the following:



However, I am not sure what I need to do with my login.jsp page so that after doing the loginContext.login() it automagically goes back to the page that the security-contraint was set up to send me to the login.jsp page in the first place to log the user in if they are not in the role (i.e., in this case the role is Administrator).

Can somebody explain how this is supposed to work? How will weblogic know that the user is successfully logged in? Is the mere call of loginContext.login() enough? I see there is something called Subject and some mention of RunAs(), which I have no clue what it is. When I tried by the way to just use a parent.history.back() to go back if it sees the return code of the login was 0, it does not seem to leave the login page. Putting a back button with the same code puts me back not at the restricted page I was trying to go to, but back at the page that has the link the user selects to the restricted page.

David
11 years ago
I used eq instead of == after commenting out transform/xml stuff and I get the same error.
11 years ago
JSP