小编Bet*_*sta的帖子

尝试向 Web 服务发送 SOAP 请求时出现 WS 安全错误

这是我使用肥皂 UI 发送的 SOAP 请求,但收到一条错误消息“消息不符合配置的策略”

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:csw="http://www.cargospot.com/crystal/cswebservice">
   <soapenv:Header>

     <xwss:SecurityConfiguration dumpMessages="false" xmlns:xwss="http://java.sun.com/xml/ns/xwss/config">
            <xwss:RequireUsernameToken passwordDigestRequired="true" nonceRequired="true"/>
        <xwss:UsernameToken name="somename" password="somepassword" useNonce="true" digestPassword="true"/>
    </xwss:SecurityConfiguration>   
   </soapenv:Header>
   <soapenv:Body>

      <csw:cargoImpMessageRequest>
         <csw:content>test</csw:content>
      </csw:cargoImpMessageRequest>
   </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

我收到以下回复,

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Client</faultcode>
         <faultstring xml:lang="en">com.sun.xml.wss.XWSSecurityException: Message does not conform to configured policy [ AuthenticationTokenPolicy(S) ]:  No Security Header found; nested exception is com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.XWSSecurityException: Message does not conform to configured policy [ AuthenticationTokenPolicy(S) ]:  No Security Header found</faultstring>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)

下面是Web服务安全配置,

<!-- Web Service Security Configuration --> …
Run Code Online (Sandbox Code Playgroud)

java spring web-services spring-security

4
推荐指数
1
解决办法
1万
查看次数

Maven无法下载tomcat-maven-plugin快照

即使在擦除了我的settings.xml之后,我仍然在尝试使用此快照依赖项时收到此错误.鉴于依赖性:

<plugin>            
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.0-SNAPSHOT</version>
    <configuration>                 
        <path>/licensing</path>
        <tomcatWebXml>${basedir}/src/main/mock/web.xml</tomcatWebXml>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

和(在POM中),插件存储库定义:

<pluginRepository>
    <id>Codehaus Snapshots</id>
    <url>http://snapshots.repository.codehaus.org</url>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
    <releases>
        <enabled>true</enabled>  <!-- Workaround for MNG-2974, see note below -->
    </releases>
</pluginRepository> 
Run Code Online (Sandbox Code Playgroud)

我留下了以下404错误.如果我真的导航到那个仓库,它正在寻找的罐子不存在,只是过时的(我不熟悉Maven如何最终解析预期的依赖名称的机制).

想法?

Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-pl
ugin-1.0-SNAPSHOT.jar
[INFO] Unable to find resource 'org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT' in repository Codehaus
Snapshots (http://snapshots.repository.codehaus.org)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to downl
oad the artifact from …

java maven-2

3
推荐指数
2
解决办法
2万
查看次数

Spring MVC 3.1 RedirectAttributes无效

我正在尝试在Spring MVC 3.1-Release中实现RedirectAttributes功能

我正在发送简单的表单到Post URL,并希望看到我在重定向中发送的值:

我的控制器看起来像这样:

@Controller
public class DefaultController {

    @RequestMapping(value="/index.html", method=RequestMethod.GET)
    public ModelAndView indexView(){
        ModelAndView mv = new ModelAndView("index");
    return mv;
    }

    @RequestMapping(value="/greetings.action", method=RequestMethod.POST)
    public ModelAndView startTask(@RequestParam("firstName") String firstName,RedirectAttributes redirectAttributes){
        redirectAttributes.addFlashAttribute("redirectAttributes.firstName", firstName);
        ModelAndView mv = new ModelAndView(new RedirectView("success.html"));
        return mv;
    }

    @RequestMapping(value="/success.html", method=RequestMethod.GET)
    public ModelAndView successView(){
        ModelAndView mv = new ModelAndView("success");
        return mv;
    }
}
Run Code Online (Sandbox Code Playgroud)

现在我的Servlet XML看起来像这样:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
<mvc:annotation-driven/>
<context:component-scan base-package="com.vanilla.flashscope.controllers" />

    <bean …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc java-ee

3
推荐指数
1
解决办法
1万
查看次数

org.hibernate.MappingException:找不到实体类(使用限定类名不起作用)

我正在尝试运行一个简单的SELECT FROM表(我也尝试过SELECT FROM package.Class)查询,但我一直收到此错误:

 org.hibernate.MappingException: entity class not found: demo.Agents
    at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:125)
    at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:191)
    at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:67)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:136)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:475)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:133)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:297)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
    at org.hibernate.console.ConsoleConfiguration$5.execute(ConsoleConfiguration.java:278)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
    at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
    at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:273)
    at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:82)
    at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:56)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
    at org.hibernate.eclipse.console.actions.ExecuteQueryAction.runWithEvent(ExecuteQueryAction.java:60)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) …
Run Code Online (Sandbox Code Playgroud)

orm hql hibernate-tools

3
推荐指数
3
解决办法
2万
查看次数

Camel JAX-RS和跨域请求

我希望能够在我的localhost Camel实例上执行HTTP请求(仅用于开发目的,我知道这是不好的做法).现在,我坚持:

 Origin http://localhost:8000 is not allowed by Access-Control-Allow-Origin.
Run Code Online (Sandbox Code Playgroud)

我搜索了如何告诉Camel允许这样的请求,但没有找到答案.我正在使用camel-cxf和rsServer来创建我的端点.

我有一个端点看起来像这样:

public class LoginEndpoint {
    @GET
    @Path(LOGIN)
    @Produces(MediaType.APPLICATION_JSON)
    public Customer login(@QueryParam("email") String email, @QueryParam("password") String password) {
        return null;
    }
}
Run Code Online (Sandbox Code Playgroud)

比标准路线正在做这项工作.

我如何告诉Camel(或JAX-RS或CXFRS组件,我不知道......)允许跨域请求?

cxf jax-rs cross-domain apache-camel cxfrs

3
推荐指数
1
解决办法
3687
查看次数

如何检测重叠的HTML元素

是否有可能在HTML页面中轻松找到被给定元素(div)隐藏的元素?

如果可能的话,我更喜欢jQuery.你知道这样的插件吗?

我在jQuery API(http://api.jquery.com/)中搜索过,但没有找到有用的东西.

html javascript jquery

3
推荐指数
1
解决办法
4674
查看次数

PhantomJS的includeJs未执行

我是phantomJS的新手,这是我到目前为止所做的:

var page = require('webpage').create();
console.log('The default user agent is ' + page.settings.userAgent);

page.settings.userAgent = 'SpecialAgent';
page.open('http://google.com', function (status) {
    if (status !== 'success') {
        console.log( 'Unable to access network' );
    } else {
        console.log( 'Opened ok' );
        page.includeJs( 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js', function() {
            console.log( 'include JS callback' );
            page.evaluate(function(){
                console.log('include JS callback - eval');
            });
        });
        console.log( 'After include JS' );
    }
    phantom.exit();
});
Run Code Online (Sandbox Code Playgroud)

但输出是

The default user agent is Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34 …
Run Code Online (Sandbox Code Playgroud)

javascript phantomjs

3
推荐指数
1
解决办法
2922
查看次数

if logback in logback - 在两个不同的文件夹中打印日志消息

我正在使用相同的日志级别在两个不同的文件夹中编写日志消息的代码.我面临的问题是下面的代码无法在条件下打印日志消息(当它变为其他时).主要是其他部分不是工作.

简单来说,如何使用两个不同的appender基于If else条件将日志写入两个不同的文件夹中.

代码是:

<if condition='property("type").contains("DEV")'>
    <then>
        <appender-ref ref="FILE-ENGINE" />
    </then>
    <else>
        <appnder-ref ref = "FILE-UI" />
    </else>
</if>
Run Code Online (Sandbox Code Playgroud)

整个配置文件是:

<configuration>

    <property name="USER_HOME" value="D:/Log1/" />

    <property name="USER_HOME2" value="D:/log2/" />


    <if condition='property("type").contains("DEV")'>
        <then>
            <appender-ref ref="FILE-ENGINE" />
        </then>
        <else>
            <appnder-ref ref = "FILE-UI" />
        </else>
    </if>


    <appender name="FILE-ENGINE" class="ch.qos.logback.core.FileAppender">
        <file>${USER_HOME}/${log.name}.log</file>
        <append>true</append>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{35} -
                %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="FILE-UI" class="ch.qos.logback.core.FileAppender">
        <file>${USER_HOME2}/DEBUG.log</file>
        <append>true</append>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{35} -
                %msg%n</pattern>
        </encoder>
    </appender>


    <appender name="FILE-ENGINE-ERROR" class="ch.qos.logback.core.FileAppender">
        <file>${USER_HOME}/${log.name}.error</file>
        <append>true</append>
        <encoder> …
Run Code Online (Sandbox Code Playgroud)

java logback

3
推荐指数
1
解决办法
8786
查看次数

Apache wicket:如何在验证错误后更新模型

我有dateTimeField和ListView的表单.ListView看起来像这样:

final ListView<String> countryView = new ListView<String>("country", model.<List<String>>bind("country")) {
            @Override
            protected void populateItem(final ListItem<String> item) {
                    final String country = item.getModelObject();
                    item.add(new ValidationDisplayableLabel("country", country, new String[] { modelPath }));
                    item.add(new AjaxLink("deleteLink") {
                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            model.getObject().getCountry().remove(country);
                            if (issPeriod) {
                                addButton.setVisible(true);
                                countryTextField.setVisible(true);
                                findButton.setVisible(true);
                            }
                            if (target != null)
                                target.addComponent(rowPanel);
                        }
                    });
            }
        };
        countryTextField = new ValidationDisplayableTextField("countryCodeInput", model.bind("oneCountry"), "job.country.value");

        **countryView.setReuseItems(true);**
        rowPanel.add(countryView);
        rowPanel.add(countryTextField);
        addButton.setOutputMarkupPlaceholderTag(true);
        rowPanel.add(addButton);
Run Code Online (Sandbox Code Playgroud)

addButton看起来像这样:

AjaxSubmitLink addButton = new AjaxSubmitLink(LinkNames.addCountry.toString()) {
        @Override
        public void onSubmit(AjaxRequestTarget target, Form form) …
Run Code Online (Sandbox Code Playgroud)

java apache validation wicket

2
推荐指数
2
解决办法
8541
查看次数

为什么在Spring 3.1和hibernate 4中找到当前线程异常的No Session

我试图配置spring 3.1和hibernate.我写了一个简单的测试项目.我有用户域和userDao及其实现

让我告诉你appliationContext

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

<mvc:annotation-driven />

<context:component-scan base-package="com.rokonoid.apps.user.dao"></context:component-scan>

<!-- Data Source -->

<context:property-placeholder location="classpath:/jdbc.properties" />
<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${database.driver}" />
    <property name="url" value="${database.url}" />
    <property name="username" value="${database.user}" />
    <property name="password" value="${database.password}" />
</bean>

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"></property>
    <property name="packagesToScan" value="com.rokonoid.apps.user.domain"></property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${hibernate.dialect}</prop>
            <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
            <prop key="hibernate.connection.pool_size">${hibernate.connection.pool_size}</prop>
            <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
            <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
            <prop key="hibernate.query.substitutions">true=1 false=0</prop>
        </props>
    </property>
</bean> …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate spring-mvc

2
推荐指数
1
解决办法
2万
查看次数